Exemple #1
0
 void MOnline_LoadingSongCompleted(MySong Output)
 {
     Block_Control_Online(true);
     Add_Song_NowPlaying(Output);
     Current_NowPlaying = List_NowPlaying.Count - 1;
     PlaySong();
 }
Exemple #2
0
        public MySong GetMoreSongInfo(string Html, MySong Item)
        {
            try
            {
                string lyric = "";
                string linkStream;
                Item.Image = "";
                HtmlDocument wap = new HtmlDocument();
                wap.LoadHtml(Html);
                //Lấy lyrics
                try
                {
                    HtmlNode lyricNode = wap.DocumentNode.SelectSingleNode("//div[@class='lyric']");
                    foreach (HtmlNode node in lyricNode.ChildNodes)
                    {
                        lyric += WebUtility.HtmlDecode(node.InnerText);
                    }
                }
                catch { }
                Item.Lyric = lyric;
                //Lấy Stream
                try
                {
                    HtmlNode stream = wap.DocumentNode.SelectSingleNode("//div[@class='download']");
                    linkStream = stream.ChildNodes[1].ChildNodes[1].GetAttributeValue("href", "");
                }
                catch { linkStream = null; }

                Item.Stream = linkStream;
                return(Item);
            }
            catch { return(null); };
        }
        public void Update_LibraryArtists()
        {
            try
            {
                MediaLibrary MLibrary = new MediaLibrary();
                Offline_Artist.Clear();
                foreach (Artist ar in MLibrary.Artists)
                {
                    MyArtist temp = new MyArtist();
                    temp.Name = ar.Name;
                    foreach (Song so in ar.Songs)
                    {
                        MySong t1 = new MySong();
                        t1.Name = so.Name;
                        //t1.Genre = so.Genre.Name;
                        t1.Artist.Name = so.Artist.Name;
                        t1.Album.Name  = so.Album.Name;
                        temp.Songs.Add(t1);
                    }

                    foreach (Album al in ar.Albums)
                    {
                        MyAlbum t1 = new MyAlbum();
                        t1.Name        = al.Name;
                        t1.Artist.Name = al.Artist.Name;
                        temp.Albums.Add(t1);
                    }
                    Offline_Artist.Add(temp);
                }
            }
            catch { }
        }
Exemple #4
0
 void WClient_ArtistInfo_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e)
 {
     try
     {
         OnL_Current_Songs[Current_Selected].Image = GetImageInfo(e.Result);
         MySong temp = new MySong(OnL_Current_Songs[Current_Selected]);
         LoadingSongCompleted(temp);
         State = true;
     }
     catch { }
 }
        public override bool ParseLine(string commandLine)
        {
            string[] tokens2 = commandLine.Split('\"');

            if (tokens2.Length < 3) return false;

            song = new MySong(tokens2[0].Split(' ')[1], tokens2[1], tokens2[3]);
            IsEnded = false;

            return true;
        }
Exemple #6
0
 void Init_Songs(MySong Item)
 {
     if (Item.bool_on == false)
     {
         Slider_Time.Maximum = Item.OfflineSong.Duration.TotalSeconds;
         TimeEnd             = Get_String_Time(Item.OfflineSong.Duration.Minutes, Item.OfflineSong.Duration.Seconds);
     }
     NameNowSong   = Item.Name;
     NameNowArtist = Item.Artist.Name;
     ImageNowSong  = Item.Image;
 }
        public override bool ParseLine(string commandLine)
        {
            string[] tokens2 = commandLine.Split('\"');

            if (tokens2.Length < 3)
            {
                return(false);
            }

            song    = new MySong(tokens2[0].Split(' ')[1], tokens2[1], tokens2[3]);
            IsEnded = false;

            return(true);
        }
 int Cheack_List_OnNowPlaying(MySong Item)
 {
     try
     {
         for (int i = 0; i < List_NowPlaying.Count; i++)
         {
             if (List_NowPlaying[i].Stream == Item.Stream)
             {
                 return(i);
             }
         }
         return(-1);
     }
     catch { return(-1); }
 }
 int Cheack_List_OffNowPlaying(MySong Item)
 {
     try
     {
         for (int i = 0; i < List_NowPlaying.Count; i++)
         {
             if (List_NowPlaying[i].OfflineSong == Item.OfflineSong)
             {
                 return(i);
             }
         }
         return(-1);
     }
     catch { return(-1); }
 }
Exemple #10
0
        private ObservableCollection <MySong> GetTop20Song(string Html, short genre)
        {
            ObservableCollection <MySong> listSongs = new ObservableCollection <MySong>();

            try
            {
                HtmlDocument docPage = new HtmlDocument();
                docPage.LoadHtml(Html);
                HtmlNodeCollection nodePDRank = docPage.DocumentNode.SelectSingleNode("//ul[@class='list_show_chart']").SelectNodes("li");
                if (nodePDRank == null)
                {
                    return(null);
                }

                short i = 1;
                foreach (HtmlNode nodeSong in nodePDRank)
                {
                    MySong             tempSong        = new MySong();
                    HtmlNode           nodeInfo        = nodeSong.SelectSingleNode("div[@class='box_info_field']").ChildNodes[3];
                    HtmlNodeCollection nodeCollectionA = nodeInfo.SelectNodes(".//a");
                    tempSong.Name = nodeInfo.InnerText;
                    tempSong.URL  = nodeInfo.GetAttributeValue("href", "");
                    foreach (HtmlNode n in nodeSong.SelectSingleNode("div[@class='box_info_field']").ChildNodes[5].SelectNodes("a"))
                    {
                        tempSong.Artist.Name += n.InnerText + " ";
                    }

                    switch (genre)
                    {
                    case 0:
                        tempSong.Album.Name = "Top 20 V-Pop";
                        break;

                    case 1:
                        tempSong.Album.Name = "Top 20 UK-US";
                        break;

                    case 2:
                        tempSong.Album.Name = "Top 20 K-Pop";
                        break;
                    }
                    listSongs.Add(tempSong);
                    i++;
                }
                return(listSongs);
            }
            catch { return(listSongs); }
        }
Exemple #11
0
        public void Update_LibrarySongs()
        {
            MediaLibrary MLibrary = new MediaLibrary();

            List_Current_Song = MLibrary.Songs;
            OffL_Current_Songs.Clear();
            foreach (Song so in MLibrary.Songs)
            {
                MySong temp = new MySong();
                temp.Name        = so.Name;
                temp.Artist.Name = so.Artist.Name;
                temp.Album.Name  = so.Album.Name;
                //temp.Genre = so.Genre.Name;
                OffL_Current_Songs.Add(temp);
            }
        }
 private void MOnline_LoadingSongCompleted(MySong Output)
 {
     try
     {
         Block_Control_Online(true);
         int index = Add_Song_NowPlaying(Output);
         if (index == -2)
         {
             return;
         }
         Current_NowPlaying = index;
         PlaySong();
     }
     catch { }
     finally
     {
     }
 }
Exemple #13
0
        private async Task <MySong> PostMember(MySong mySong)

        {
            // chuyen doi tuong member thanh dang json
            var mySongJson = JsonConvert.SerializeObject(mySong);

            HttpContent contentTosent = new StringContent(mySongJson, Encoding.UTF8, "application/json");

            HttpClient httpClient = new HttpClient();
            var        response   = await httpClient.PostAsync(API, contentTosent);

            var stringContent = await response.Content.ReadAsStringAsync();

            var returnMySong = JsonConvert.DeserializeObject <MySong>(stringContent);

            Debug.WriteLine(returnMySong.Id);
            return(returnMySong);
        }
Exemple #14
0
        public void Load_Songs_Artist(int index)
        {
            MediaLibrary ML = new MediaLibrary();

            List_Current_Song = ML.Artists[index].Songs;

            OffL_Current_Songs.Clear();
            foreach (Song so in ML.Artists[index].Songs)
            {
                MySong temp = new MySong();
                temp.Name        = so.Name;
                temp.Artist.Name = so.Artist.Name;
                temp.Album.Name  = so.Album.Name;
                //temp.Genre = so.Genre.Name;
                temp.Stream = null;
                OffL_Current_Songs.Add(temp);
            }
        }
Exemple #15
0
        public ObservableCollection <MySong> GetListSong(string Html)
        {
            ObservableCollection <MySong> listSongs = new ObservableCollection <MySong>();

            try
            {
                HtmlDocument docPage = new HtmlDocument();
                docPage.LoadHtml(Html);
                HtmlNode nodeListSong = docPage.DocumentNode.SelectSingleNode("//div[@class='search_returns_frame']").ChildNodes[1];
                if (nodeListSong == null)
                {
                    return(null);
                }
                HtmlNodeCollection nodeSongs = nodeListSong.SelectNodes("li");
                if (nodeSongs == null)
                {
                    return(null);
                }
                foreach (HtmlNode nodeSong in nodeSongs)
                {
                    try
                    {
                        MySong song = new MySong();

                        HtmlNode           songName = nodeSong.SelectSingleNode("div[@class='info_song']");
                        HtmlNodeCollection collectionNodesAInSongName = songName.SelectNodes(".//a");

                        song.Name = collectionNodesAInSongName[0].InnerText;
                        song.URL  = collectionNodesAInSongName[0].GetAttributeValue("href", "");

                        for (int i = 1; i < collectionNodesAInSongName.Count; i++)
                        {
                            song.Artist.Name += collectionNodesAInSongName[i].InnerText;
                        }

                        song.Album.Name = "Nhạc Của Tui";
                        listSongs.Add(song);
                    }
                    catch { }
                }
                return(listSongs);
            }
            catch { return(listSongs); }
        }
Exemple #16
0
        public void Load_Songs()
        {
            MediaLibrary ML = new MediaLibrary();

            List_Current_Song = ML.Songs;

            OffL_Current_Songs.Clear();
            foreach (Song so in ML.Songs)
            {
                MySong temp = new MySong();
                temp.Name        = so.Name;
                temp.Artist.Name = so.Artist.Name;
                temp.Album.Name  = so.Album.Name;
                //temp.Genre = so.Genre.Name;
                temp.Stream = null;
                temp.Image  = "/Assets/Picture/Music_Offline.png";
                OffL_Current_Songs.Add(temp);
            }
        }
 int Add_Song_NowPlaying(MySong Item)
 {
     try
     {
         int index;
         if (Item.Stream == null)
         {
             index = Cheack_List_OffNowPlaying(Item);
             if (index == -1)
             {
                 MySong temp = new MySong(Item);
                 List_NowPlaying.Add(temp);
                 return(List_NowPlaying.Count - 1);
             }
             else
             {
                 return(index);
             }
         }
         else
         {
             index = Cheack_List_OnNowPlaying(Item);
             if (index == -1)
             {
                 MySong temp = new MySong(Item);
                 List_NowPlaying.Add(temp);
                 return(List_NowPlaying.Count - 1);
             }
             else
             {
                 if (Item.Path != null)
                 {
                     List_NowPlaying[index].Path = Item.Path;
                     List_NowPlaying[index].Update_Offline_Track();
                 }
                 return(index);
             }
         }
     }
     catch { return(-2); }
 }
Exemple #18
0
        public SongView()
        {
            InitializeComponent();
            _nowPage = 1; // First page

            // List
            songList       = new ObservableCollection <MySong>();
            lv.ItemsSource = songList;

            // Button
            btnType.Clicked += BtnType_Clicked;

            MySong test = new MySong {
                songname = "天黑請閉眼", singer = "陳零九&邱鋒澤"
            };

            songList.Add(test);
            test = new MySong {
                songname = "天亮請睜眼", singer = "陳零九&邱鋒澤"
            };
            songList.Add(test);
        }
Exemple #19
0
        public void Update_LibraryAlbums()
        {
            MediaLibrary MLibrary = new MediaLibrary();

            Offline_Album.Clear();
            foreach (Album ar in MLibrary.Albums)
            {
                MyAlbum temp = new MyAlbum();
                temp.Name = ar.Name;
                foreach (Song so in ar.Songs)
                {
                    MySong t1 = new MySong();
                    t1.Name = so.Name;
                    //t1.Genre = so.Genre.Name;
                    t1.Artist.Name = so.Artist.Name;
                    t1.Album.Name  = so.Album.Name;
                    temp.Songs.Add(t1);
                }

                temp.Artist.Name = ar.Artist.Name;
                Offline_Album.Add(temp);
            }
        }
 void MOnline_DownloadCompleted(MySong Output)
 {
     Status_Download.Text = "Download '" + Output.Name + "' complete !";
     ListDownload.Add(Output);
 }
Exemple #21
0
 public void Download(MySong temp)
 {
     Song_Download = temp;
     WClient_Download.OpenReadAsync(new Uri(temp.Stream));
 }
 public ChangeMusicCommand(MySong s)
 {
     this.song = s;
     this.IsEnded = false;
 }
 public ChangeMusicCommand(MySong s)
 {
     this.song    = s;
     this.IsEnded = false;
 }
 public static void CopySong(MySong Item)
 {
     Song_Post = new MySong(Item);
 }
Exemple #25
0
        void Add_Song_NowPlaying(MySong Item)
        {
            MySong temp = new MySong(Item);

            List_NowPlaying.Add(temp);
        }
Exemple #26
0
 public Task <MySong> Create(MySong mySong)
 {
     throw new NotImplementedException();
 }