protected override void IterateCore(HyenaDataReader reader)
        {
            SafeUri uri = new SafeUri(reader.Get <string> (0));

            current_track_id = reader.Get <int> (1);

            // Wait for the result to be ready
            result_ready_event.Reset();
            detector.ProcessFile(uri);
            result_ready_event.WaitOne();

            if (IsCancelRequested)
            {
                return;
            }

            if (result_bpm > 0)
            {
                Log.DebugFormat("Saving BPM of {0} for {1}", result_bpm, result_uri);
                ServiceManager.DbConnection.Execute(update_query, result_bpm, DateTime.Now, current_track_id);
            }
            else
            {
                ServiceManager.DbConnection.Execute(update_query, -1, DateTime.Now, current_track_id);
                Log.DebugFormat("Unable to detect BPM for {0}", result_uri);
            }
        }
Esempio n. 2
0
 private void OnDetectClicked(object o, EventArgs args)
 {
     if (track != null)
     {
         detect_button.Sensitive = false;
         detector.ProcessFile(track.Uri);
     }
 }