示例#1
0
 private async void bttn_Search_Click(object sender, EventArgs e)
 {
     if(!string.IsNullOrEmpty(txt_Search.Text))
     {
         progbarNewestShows.Visible = true;
         await Task.Run(async() =>
         { 
             AMediaFile mf = new AMediaFile(500);
             var allfiles = await availableshows.AllFiles;
             foreach (string s in allfiles)
             {
                 if (s.IndexOf(txt_Search.Text, StringComparison.OrdinalIgnoreCase) != -1)
                 {
                     AMediaFile tmp = new AMediaFile(Path.GetFileNameWithoutExtension(s));
                     tmp.MyPath = s;
                     mf.Add(tmp);
                 }
             }
             mf.MediaFiles = Utility.Dynamicate(mf.MediaFiles); 
             if (Utility.TaskIsRunning(tskAddtoDisplay))
             {//If already started stop and start over
                 cts.Cancel();
                 cts = new CancellationTokenSource();
             }
             tskAddtoDisplay = Task.Run(() => AddtoDisplayListView(mf, cts.Token));
             await tskAddtoDisplay;
         });
     }
 } 
示例#2
0
        //Get file names and turn to AMediaFile
        private async Task<AMediaFile> PopulateDisplayList(string thePath, CancellationToken cts)
        {
            IEnumerable<string> files;
            IEnumerable<string> folders;
            if (thePath == "Newest Shows")
            {
                files = await tsklatestshows;
                folders = new List<string>(1);
            }
            else
            {
                files = await availableshows.MediaFilesinFolder(thePath);
                folders = await availableshows.Folders_In_Folder(thePath);
            }

            AMediaFile TheDisplayList = new AMediaFile(1);
            if (files == null) files = new List<string>(1);
            foreach (string item in folders)
            {
                if (item != "Error! Path not a folder or it doesn't exist" & item.IndexOf("no results") == -1 && !cts.IsCancellationRequested)
                {
                    AMediaFile t = new AMediaFile(Path.GetFileName(item));
                    t.MyPath = item;
                    if (item.IndexOf("\\TV\\") != -1)
                        t.MyType = "TV";
                    else if (string.IsNullOrEmpty(t.MyType))
                        t.MyType = "MOVIE";
                    TheDisplayList.Add(t);
                }
                else if (cts.IsCancellationRequested)
                {
                    this.Invoke((MethodInvoker)delegate { lstvw_Display.Clear(); });
                    break;
                }
            }
            foreach (string item in files)
            {
                if (item != "Error! Path not a folder or it doesn't exist" & item.IndexOf("no results") == -1)
                {
                    AMediaFile t = new AMediaFile(System.IO.Path.GetFileNameWithoutExtension(item));
                    t.MyPath = item;
                    if (item.IndexOf("\\TV\\") != -1)
                        t.MyType = "TV";
                    else if (string.IsNullOrEmpty(t.MyType))
                        t.MyType = "MOVIE";
                    TheDisplayList.Add(t);
                }
            }
            return TheDisplayList;
        }
示例#3
0
 private void StartPlaylist(object sender, EventArgs e)
 {
     AMediaFile playlist = new AMediaFile(1); 
     foreach (ListViewItem item in lstvw_ToWatch.Items)
     { 
             AMediaFile ms = new AMediaFile(item.Text); 
             ms.MyPath = item.Name;
             playlist.Add(ms); 
     }
     Utility.Create_PlayList(Utility.PlayListPath, playlist.MediaFiles);
     System.Diagnostics.Process.Start(Utility.PlayListPath); 
     //System.Windows.Forms.SendKeys.Send("F"); make full screen
 }
示例#4
0
 private void bttn_Download_Click(object sender, EventArgs e)
 {
     if (lstv_Downloads.Items.Count > 0)
     {
         ATorrent DLList = new ATorrent(100);
         AMediaFile dlList = new AMediaFile(100);
         foreach (ListViewItem li in lstv_Downloads.Items)
         {
             ATorrent t = new ATorrent();
             t.Name = 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.Add(t);
             AMediaFile mf = new AMediaFile(li.Text);
             dlList.Add(mf);
         }
         Utility.Download(DLList.Torrents);
         //  UpdateAfterDownload(lstv_Downloads.Items);
     }
     //else lblSearch.Text = "You must select shows to download first!";
     //update fav box
     //lstbx_Favorites.Items.Clear();
     //foreach (AShow ms in availableShows.LatestShows)
       //  lstbx_Favorites.Items.Add(ms.ToString()); 
 }