private void loadVietNamChart() { string playlistID = "87"; deleteTrackInPlaylist(playlistID); string url = "https://chiasenhac.vn/nhac-hot/vietnam.html"; CQ dom = CQ.CreateFromUrl(url); for (int i = 1; i < 21; i++) { Monitor.Enter(locker); try { VietNamChart_worker.ReportProgress((int)((++progress * 1.0f / totalProgress) * 100)); } catch (System.Exception) { } finally { Monitor.Exit(locker); } string realUrl = dom[@"div.music_recommendation div.d-table div[id*='music-listen']:nth-of-type(" + i + ") div.tool ul li:nth-of-type(1) a"].Attr("href"); string trackID; if (Database.checkTrackExisted(realUrl)) { trackID = Database.getTrackIdBaseOnTrackLink(realUrl); } else { trackID = Database.addTrackToDatabase(realUrl); } Database.AddTrackToPlaylist(trackID, playlistID); } }
private void button1_Click(object sender, System.EventArgs e) { VietNamChart_worker.RunWorkerAsync(); USUKChart_worker.RunWorkerAsync(); ChineseChart_worker.RunWorkerAsync(); KoreaChart_worker.RunWorkerAsync(); JapaneseChart_worker.RunWorkerAsync(); }