예제 #1
0
 public void Add(Playlist pl)
 {
     foreach (Song x in pl.ListOfSongs)
     {
         listOfSongs.Add(x);
     }
 }
예제 #2
0
 public void AddToPlaylist(Playlist playlist)
 {
     foreach (Song s in songsList)
     {
         playlist.AddSong(s);
     }
 }
예제 #3
0
        public static Playlist ParseSimilar(string query)
        {
            Playlist myPl2 = new Playlist();
            Regex r = new Regex(@".*");
            Regex r1 = new Regex(@"[0-9]*");
            Regex r2 = new Regex(@":.*");

            string[] simSearch = r.Match(query).Value.Replace("similar:", "").Split('+');
            foreach (string s in simSearch)
            {
               //
                string[] tempp = new string[5];

                Stopwatch sw = new Stopwatch();
                Stopwatch sw2 = new Stopwatch();
                sw.Start();
                tempp= LastFmSearch.SimArtist(s);
               // sw.Stop();
               //writer.WriteLine(sw.ElapsedMilliseconds);

              // sw.Start();
                foreach (string s1 in tempp)
                {
                    //List<Song> temp = new List<Song>();
                  //  sw2.Start();
                   // temp = LastFmSearch.TopTracks(5, s1);

                   sw2.Start();
                   foreach (Song s6 in LastFmSearch.TopTracks(5, s1))
                    {
                        myPl2.AddSong(s6);

                    }

                }
                sw.Stop();
                TextWriter writer = new StreamWriter(@"C:\debug.txt", true);
               writer.WriteLine("Total:"+sw.ElapsedMilliseconds);
                writer.WriteLine("Toptrack summ" + sw2.ElapsedMilliseconds);
               writer.Close();
            }

            return myPl2;
        }
예제 #4
0
        public static Playlist ParseTop(string Query)
        {
            Playlist myPl2 = new Playlist();
            Regex r = new Regex(@".*");
            Regex r1 = new Regex(@"[0-9]*");
            Regex r2 = new Regex(@":.*");
            string[] s1;
            string[] s2;
            string[] topSearch = r.Match(Query).Value.Replace("top", "").Split('+');
            foreach (string s in topSearch)
            {
                List<Song> temp = new List<Song>();

                temp = LastFmSearch.TopTracks(Convert.ToInt32(r1.Match(s).Value), r2.Match(s).Value.Replace(":", ""));
                foreach (Song s6 in temp)
                {
                    myPl2.AddSong(s6);
                }

            }
            return myPl2;
        }
예제 #5
0
        private void loadPL_Click(object sender, RoutedEventArgs e)
        {
            OpenFileDialog deserializDialog = new OpenFileDialog();
            deserializDialog.InitialDirectory = "C:\tmp";
            deserializDialog.ShowDialog();
            if (File.Exists(deserializDialog.FileName))
            {
                myPl.Clear();

                listBox1.Items.Clear();
                Stream desStream = File.OpenRead(deserializDialog.FileName);
                BinaryFormatter deserializer = new BinaryFormatter();
                myPl = (Playlist)deserializer.Deserialize(desStream);
                desStream.Close();
                myPl.Play(listBox1);

            }
        }