Exemplo n.º 1
0
        private void REST_ResultMetaDataMuziekweb(object sender, bool success, ResultSongs resultSongs, object userState = null)
        {
            try
            {
                Song song = userState as Song;
                if (resultSongs != null && resultSongs.Songs.Count > 0)
                {
                    // Copy song data to userstate
                    song.ContextID = resultSongs.Songs[0].ContextID;

                    song.Score             = resultSongs.Songs[0].Score;
                    song.TrackNumber       = resultSongs.Songs[0].TrackNumber;
                    song.Album             = resultSongs.Songs[0].Album; // shallow copy
                    song.AlbumTrackID      = resultSongs.Songs[0].AlbumTrackID;
                    song.SongTitle         = resultSongs.Songs[0].SongTitle;
                    song.SongTitle_Link    = resultSongs.Songs[0].SongTitle_Link;
                    song.UniformTitle      = resultSongs.Songs[0].UniformTitle;
                    song.UniformTitle_Link = resultSongs.Songs[0].UniformTitle_Link;
                    song.PlayTimeInSec     = resultSongs.Songs[0].PlayTimeInSec;
                    song.Performers        = resultSongs.Songs[0].Performers;// shallow copy
                }
            }
            finally
            {
                // Signal metadata is retrieved
                signalEvent.Set();
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Called when metadata request returns (or simulated in SongInfoRetrieve
        /// to skip metadata request)
        /// </summary>
        private void REST_ResultMetaDataMuziekweb(object sender, bool success, ResultSongs resultSongs, object userState = null)
        {
            try
            {
                ResultFingerprintRecognition resultRecognitions = userState as ResultFingerprintRecognition;

                Console.WriteLine("Detected: " + resultRecognitions.FingerTracks[0].FingerTrackReference.ToString() + " Q=" + (resultRecognitions.TimeStatistics.TotalQueryTime.TotalMilliseconds / 1000).ToString("#0.000"));
                if (resultSongs != null && resultSongs.Songs.Count > 0)
                {
                    Console.WriteLine("MetaData: " + SongInfo(resultSongs.Songs[0]));
                }
                Console.Write("  P=" + resultRecognitions.FingerTracks[0].SearchStrategy.SearchName + " (I=" + resultRecognitions.FingerTracks[0].SearchStrategy.SearchIteration.ToString() + ")");
                Console.Write(" | BER=" + resultRecognitions.FingerTracks[0].BER.ToString());
                Console.Write(" | Index=" + resultRecognitions.FingerTracks[0].SearchStrategy.IndexNumberInMatchList.ToString() + " | HitCount=" + resultRecognitions.FingerTracks[0].SearchStrategy.SubFingerCountHitInFingerprint.ToString());
                Console.WriteLine();
            }
            finally
            {
                // Release detecttask so new one can be initiated
                lock (lockObject)
                {
                    detectTask = null;
                }
            }
        }