Пример #1
0
        static void TestMetaDataLookup()
        {
            string file = @"C:\Documents and Settings\Admin_2\My Documents\My Music\iTunes\iTunes Music\After the fire\Der Kommissar\01 Der Kommissar.mp3";
            //string file = @"C:\Documents and Settings\Admin_2\My Documents\My Music\iTunes\iTunes Music\Alanis Morissette\So-Called Chaos\01 Eight Easy Steps.mp3";
            //string file = @"C:\Documents and Settings\Admin_2\My Documents\My Music\iTunes\iTunes Music\Unknown Artist\Unknown Album\16 Pump UP the jam.mp3";
            //string file = @"C:\Documents and Settings\Admin_2\My Documents\My Music\iTunes\iTunes Music\Ziqo\Unknown Album\01 Vamos Embora.mp3";

            MetaDataLookup req = new MetaDataLookup();

            Console.WriteLine("looking up '{0}'...", file);
            req.Lookup(file);
            Console.WriteLine("puid={0}", req.MetaData.Puid);
            Console.WriteLine("title={0}", req.MetaData.Title);
            Console.WriteLine("artist={0}", req.MetaData.Artist);
            Console.WriteLine("genre={0}", req.MetaData.Genre);
        }
Пример #2
0
        static void TestManyMetaDataLookup()
        {
            ITunesLibrary lib = new ITunesLibrary();

            lib.MaxSongsToFetch = 50;
            lib.LoadSongs();
            lib.WaitLoad();

            Stopwatch sw = new Stopwatch();

            sw.Start();
            try {
                foreach (Song song in lib.Songs)
                {
                    MetaDataLookup req = new MetaDataLookup();
                    //MetaDataLookupOld req = new MetaDataLookupOld();
                    req.Lookup(song);
                    if (req.Status == MetaDataStatus.Success)
                    {
                        if (song.Title == req.MetaData.Title && song.Artist == req.MetaData.Artist)
                        {
                            System.Diagnostics.Debug.WriteLine(String.Format("same: {0}", song));
                        }
                        else
                        {
                            System.Diagnostics.Debug.WriteLine(String.Format("different: {0}. title={1}, artist={2}", song, req.MetaData.Title, req.MetaData.Artist));
                        }
                    }
                    else
                    {
                        System.Diagnostics.Debug.WriteLine(String.Format("failed: {0}", song));
                    }
                }
            }
            finally {
                sw.Stop();
                System.Diagnostics.Debug.WriteLine(String.Format("Tried {0} song in {1} ({2} secs per song)", lib.Songs.Count, sw.Elapsed, (sw.ElapsedMilliseconds / lib.Songs.Count) / 1000));
            }
        }