private void bgw_SearchForNewEpisodes_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { ATorrent[] Results = (e.Result as ATorrent[]); int i = 0; ATorrent DLList = new ATorrent(100); foreach(ListViewItem li in lstv_Downloads.Items) { ATorrent t = new ATorrent(); t.Name = li.ToString(); t.Seeders = Int32.Parse(li.SubItems[1].Text); t.FileSize = li.SubItems[2].Text; t.Quality = li.SubItems[3].Text; t.DaysOld = li.SubItems[4].Text; t.Language = li.SubItems[5].Text; t.Link = li.SubItems[6].Text; DLList.Torrents[i] = t; i++; } Results = Utility.Dynamicate(Results); foreach (ATorrent s in Results) { if (DLList.ExactMatch(s) == 9999) { ListViewItem item = new ListViewItem(s.ToString()); item.SubItems.Add(s.Seeders.ToString()); item.SubItems.Add(s.FileSize); item.SubItems.Add(s.Quality); item.SubItems.Add(s.DaysOld); item.SubItems.Add(s.Language); item.SubItems.Add(s.Link); lstv_Downloads.Items.Add(item); } } progbar_NewEpisodes.Visible = false; lblProgress.Text = "Search Completed"; }
}//add to DL's private void bttn_AddtoDownloads_Click(object sender, EventArgs e) { int i = 0; ATorrent DLList = new ATorrent(); DLList.Torrents = new ATorrent[100]; foreach (ListViewItem li in lstv_Downloads.Items) { ATorrent t = new ATorrent(li.Text); t.Seeders = Int32.Parse(li.SubItems[1].Text); t.FileSize = li.SubItems[2].Text; t.Quality = li.SubItems[3].Text; t.DaysOld = li.SubItems[4].Text; t.Language = li.SubItems[5].Text; t.Link = li.SubItems[6].Text; DLList.Torrents[i] = t; i++; } ListViewItem item = new ListViewItem(); if (lstv_SearchResults.SelectedItems.Count > 0) item = lstv_SearchResults.SelectedItems[0]; else item = lstv_SearchResults.Items[0]; ATorrent ms = new ATorrent(item.Text); ms.Link = item.SubItems[6].Text; if (item.Text.IndexOf("No Results Found!") == -1) { if (DLList.ExactMatch(ms) == 9999) lstv_Downloads.Items.Add((ListViewItem)item.Clone()); else lblSearch.Text = "Show is already on the DLList!"; } }
private AShow[] CheckForNewEpisodes(bool SearchAll, int MinSeeders) { ATorrent DLList = new ATorrent(); DLList.Torrents = new ATorrent[100]; int i = 0; int OGepi = 0; ATorrent results = new ATorrent(35); foreach (AShow t in Favorites.Shows)//Favorites.Shows) { if (t != null & t.MyType == "TV") { bool SearchAgain = true; OGepi = t.Episode; while (SearchAgain == true) { SearchAgain = false; t.Episode += 1; Search search = new Search(t.ToString(), MinSeeders, SearchAll); search.StartSearching(); results.Torrents = search.Results.Torrents; if (results.Torrents[0] != null && results.Torrents[0].Name != "No Results Found!") { if (results.Torrents[0].Name != "9999" & results.ExactMatch(t) != 9999) { if (DLList.ExactMatch(t) == 9999) { DLList.Add(results.Torrents[0]); SearchAgain = SearchAll;//true to keep searching for the next episode } } } } t.Episode = OGepi; i++; int poss = 0; foreach (AShow x in Favorites.Shows) { if (x != null) { poss++; } else break; } float a = poss; float b = i; int c = Convert.ToInt32((b / a) * 100); bgw_SearchForNewEpisodes.ReportProgress(c); } else break; } return DLList.Torrents; }