Exemplo n.º 1
0
        public void SelectQuality(SeriesItem item)
        {
            GUIDialogMenu dialog = (GUIDialogMenu)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU);

            if (dialog == null)
            {
                return;
            }

            dialog.Reset();
            dialog.SetHeading("Choose Resolution");
            dialog.Add("SD");
            dialog.Add("720p");
            dialog.Add("1080i");
            dialog.Add("1080p");
            dialog.Add("480p");

            dialog.DoModal(GUIWindowManager.ActiveWindow);

            if (dialog.SelectedId != -1)
            {
                MyTorrents.Instance()._torrentWatchlist.GetSeriesList().Where(e => e.show.ID == item.show.ID).First().quality = dialog.SelectedLabelText;

                GUIPropertyManager.SetProperty("#MyTorrents.SeriesInfo.Quality", dialog.SelectedLabelText);
            }
        }
Exemplo n.º 2
0
        public void SelectSource(SeriesItem item)
        {
            GUIDialogMenu dialog = (GUIDialogMenu)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU);

            if (dialog == null)
            {
                return;
            }

            dialog.Reset();
            dialog.SetHeading("Choose Source");
            dialog.Add("HDTV");
            dialog.Add("VHSRip");
            dialog.Add("TVRip");
            dialog.Add("DVDRip");
            dialog.Add("BDRip");
            dialog.Add("BluRay");
            dialog.Add("WEB");
            dialog.Add("DVD");

            dialog.DoModal(GUIWindowManager.ActiveWindow);

            if (dialog.SelectedId != -1)
            {
                MyTorrents.Instance()._torrentWatchlist.GetSeriesList().Where(e => e.show.ID == item.show.ID).First().source = dialog.SelectedLabelText;

                GUIPropertyManager.SetProperty("#MyTorrents.SeriesInfo.Source", dialog.SelectedLabelText);
            }
        }
Exemplo n.º 3
0
        public void SelectTracker(SeriesItem item)
        {
            GUIDialogMenu dialog = (GUIDialogMenu)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU);

            if (dialog == null)
            {
                return;
            }

            dialog.Reset();
            dialog.SetHeading("Choose TV Series to add");
            TorrentSearchEngine tse = null;

            try
            {
                tse = new TorrentSearchEngine(Configuration.Instance().Settings["TorrentSearch.Config"] as string);
            }
            catch
            {
                Log.Instance().Print("MyTorrents.xml config file loading failed!");
            }
            foreach (ITorrentSearch engine in tse.Engines)
            {
                dialog.Add(engine.Name);
            }
            dialog.DoModal(GUIWindowManager.ActiveWindow);

            if (dialog.SelectedId != -1)
            {
                MyTorrents.Instance()._torrentWatchlist.GetSeriesList().Where(e => (e as SeriesItem).show.ID == item.show.ID).First().tracker = dialog.SelectedLabelText;

                GUIPropertyManager.SetProperty("#MyTorrents.SeriesInfo.Tracker", dialog.SelectedLabelText);
            }
        }
Exemplo n.º 4
0
        public void AddSeries()
        {
            GUIDialogMenu dialog = (GUIDialogMenu)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU);

            if (dialog == null)
            {
                return;
            }

            dialog.Reset();
            dialog.SetHeading("Choose TV Series to add");
            foreach (Series s in MyTorrents.Instance()._torrentWatchlist.allseries)
            {
                dialog.Add(s.Name);
            }
            dialog.DoModal(GUIWindowManager.ActiveWindow);

            if (dialog.SelectedId != -1)
            {
                SeriesItem item         = new SeriesItem();
                Series     chosenseries = MyTorrents.Instance()._torrentWatchlist.allseries[dialog.SelectedId - 1];
                item.quality           = "720p";
                item.source            = "HDTV";
                item.type              = "New episodes";
                item.show              = new Series();
                item.show.Name         = chosenseries.Name;
                item.show.OriginalName = chosenseries.OriginalName;
                item.show.ID           = chosenseries.ID;
                item.tracker           = "PublicHD";
                MyTorrents.Instance()._torrentWatchlist._watchItemList.Add(item);
            }
        }
Exemplo n.º 5
0
        public void FolderClickMenu(GUIListItem fldr, GUIListItem _selectedtorrent, TorrentLabel label)
        {
            GUIDialogMenu dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU);

            if (dlg == null)
            {
                return;
            }

            dlg.Reset();
            dlg.SetHeading("Folder Options");
            dlg.Add("Set as download location");
            //dlg.Add("Add to favourite places");
            dlg.DoModal(GUIWindowManager.ActiveWindow);

            switch (dlg.SelectedLabelText)
            {
            case "Set as download location":
            {
                MyTorrents.Instance().HideFolderBrowser();

                if (MyTorrents.ListType == "SeriesInfo")
                {
                    SeriesItem item = _selectedtorrent.AlbumInfoTag as SeriesItem;

                    MyTorrents.Instance()._torrentWatchlist.GetSeriesList().Where(e => e.show.ID == item.show.ID).First().folder = fldr.Path + @"\" + fldr.Label;
                    GUIPropertyManager.SetProperty("#MyTorrents.SeriesInfo.Folder", fldr.Path + @"\" + fldr.Label);
                }
                else
                {
                    DefaultDir = TorrentEngine.Instance().TorrentSession.GetSettings("dir_active_download");
                    string response  = TorrentEngine.Instance().TorrentSession.GetResponse(string.Format("?action=setsetting&s=dir_active_download&v={0}", fldr.Path + @"\" + fldr.Label));
                    string response2 = TorrentEngine.Instance().TorrentSession.GetResponse("?action=setsetting&s=dir_active_download_flag&v=1");
                    TorrentSearch.TorrentMatch match = _selectedtorrent.AlbumInfoTag as TorrentSearch.TorrentMatch;


                    bool ok = TorrentEngine.Instance().StartDownloading(match.Url, label.Name, true, match.cookie, match.Id, _downloadoption, "");
                    if (!ok)
                    {
                        GUIDialogNotify notify = (GUIDialogNotify)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_NOTIFY);
                        notify.Reset();
                        notify.SetHeading("Failed!");
                        notify.SetText("Unable to start download.");
                        notify.DoModal(GUIWindowManager.ActiveWindow);
                    }
                    string revert = TorrentEngine.Instance().TorrentSession.GetResponse(string.Format("?action=setsetting&s=dir_active_download&v={0}", DefaultDir));
                }
                break;
            }
            }
        }
Exemplo n.º 6
0
        public void SearchSeries()
        {
            VirtualKeyboard keyboard = (VirtualKeyboard)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_VIRTUAL_KEYBOARD);

            keyboard.Reset();
            keyboard.Text = "";
            keyboard.DoModal(GUIWindowManager.ActiveWindow);

            if (!keyboard.IsConfirmed)
            {
                return;
            }

            IList <TraktShow> searchshow = TraktAPI.SearchShows(keyboard.Text).ToList();
            GUIDialogMenu     dialog     = (GUIDialogMenu)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU);

            if (dialog == null)
            {
                return;
            }

            dialog.Reset();
            dialog.SetHeading("Choose TV Series to add");
            foreach (TraktShow ts in searchshow)
            {
                dialog.Add(string.Format("{0} - ({1})", ts.Title, ts.Year));
            }
            dialog.DoModal(GUIWindowManager.ActiveWindow);

            if (dialog.SelectedId != -1)
            {
                TraktShow  t    = searchshow[dialog.SelectedId - 1];
                SeriesItem item = new SeriesItem();
                item.quality           = "720p";
                item.show              = new Series();
                item.show.Name         = t.Title;
                item.show.OriginalName = t.Title;
                item.show.Description  = t.Overview;
                foreach (string genre in t.Genres)
                {
                    item.show.Genres += "|" + genre;
                }
                item.show.Rating = ((double)t.Ratings.Percentage / 10.0).ToString();
                item.show.Poster = t.Images.Banner;
                item.show.ID     = t.Tvdb;
                item.tracker     = "BTN";
                MyTorrents.Instance()._torrentWatchlist._watchItemList.Add(item);
            }
        }
Exemplo n.º 7
0
        public bool Load()
        {
            _watchItemList.Clear();

            if (DatabaseUtility.TableExists(_sqlClient, "WatchList"))
            {
                SQLiteResultSet resultSet = _sqlClient.Execute("SELECT * FROM WatchList;");

                foreach (SQLiteResultSet.Row row in resultSet.Rows)
                {
                    WatchItem watch = new WatchItem();
                    watch.SearchTerm = row.fields[(int)resultSet.ColumnIndices["Search"]];
                    watch.Added      = new DateTime(Convert.ToInt64(row.fields[(int)resultSet.ColumnIndices["Added"]]));
                    watch.Label      = row.fields[(int)resultSet.ColumnIndices["Label"]];
                    _watchItemList.Add(watch);
                }
            }
            if (DatabaseUtility.TableExists(_sqlClient, "SeriesWatchList"))
            {
                SQLiteResultSet resultSet = _sqlClient.Execute("SELECT * FROM SeriesWatchList;");

                foreach (SQLiteResultSet.Row row in resultSet.Rows)
                {
                    SeriesItem watch = new SeriesItem();
                    watch.show              = new Series();
                    watch.show.Name         = row.fields[(int)resultSet.ColumnIndices["SeriesName"]];
                    watch.show.OriginalName = row.fields[(int)resultSet.ColumnIndices["OriginalSeriesName"]];
                    watch.show.ID           = row.fields[(int)resultSet.ColumnIndices["SeriesID"]];
                    watch.Added             = new DateTime(Convert.ToInt64(row.fields[(int)resultSet.ColumnIndices["Added"]]));
                    watch.quality           = row.fields[(int)resultSet.ColumnIndices["Quality"]];
                    watch.tracker           = row.fields[(int)resultSet.ColumnIndices["Tracker"]];
                    watch.type              = row.fields[(int)resultSet.ColumnIndices["Type"]];
                    watch.source            = row.fields[(int)resultSet.ColumnIndices["Source"]];
                    watch.folder            = row.fields[(int)resultSet.ColumnIndices["Folder"]];
                    watch.includespecials   = Convert.ToBoolean(row.fields[(int)resultSet.ColumnIndices["IncludeSpecials"]]);
                    _watchItemList.Add(watch);
                }
            }
            return(true);
        }
Exemplo n.º 8
0
        public void ChooseType(SeriesItem item)
        {
            GUIDialogMenu dialog = (GUIDialogMenu)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU);

            if (dialog == null)
            {
                return;
            }

            dialog.Reset();
            dialog.SetHeading("Choose Watching Type");
            dialog.Add("New episodes");
            dialog.Add("Missing episodes");

            dialog.DoModal(GUIWindowManager.ActiveWindow);

            if (dialog.SelectedId != -1)
            {
                MyTorrents.Instance()._torrentWatchlist.GetSeriesList().Where(e => e.show.ID == item.show.ID).First().type = dialog.SelectedLabelText;

                GUIPropertyManager.SetProperty("#MyTorrents.SeriesInfo.Type", dialog.SelectedLabelText);
            }
        }
Exemplo n.º 9
0
        public void ShowSeries(object info)
        {
            SelectedWatch = info as SeriesItem;
            Series selected = MyTorrents.Instance()._torrentWatchlist.allseries.Where(e => e.ID == (SelectedWatch).show.ID).FirstOrDefault();

            if (selected != null)
            {
                //get updated info from mp-tvseries
                SelectedWatch.show = selected;
            }
            GUIPropertyManager.SetProperty("#MyTorrents.SeriesInfo", "yes");
            GUIPropertyManager.SetProperty("#MyTorrents.SeriesInfo.SeriesName", SelectedWatch.show.Name);
            GUIPropertyManager.SetProperty("#MyTorrents.SeriesInfo.SeriesPoster", SelectedWatch.show.Poster);
            GUIPropertyManager.SetProperty("#MyTorrents.SeriesInfo.SeriesInfo", SelectedWatch.show.Description);
            GUIPropertyManager.SetProperty("#MyTorrents.SeriesInfo.SeriesGenres", SelectedWatch.show.Genres);
            GUIPropertyManager.SetProperty("#MyTorrents.SeriesInfo.SeriesRating", SelectedWatch.show.Rating);
            GUIPropertyManager.SetProperty("#MyTorrents.SeriesInfo.Quality", SelectedWatch.quality);
            GUIPropertyManager.SetProperty("#MyTorrents.SeriesInfo.Tracker", SelectedWatch.tracker);
            GUIPropertyManager.SetProperty("#MyTorrents.SeriesInfo.Type", SelectedWatch.type);
            GUIPropertyManager.SetProperty("#MyTorrents.SeriesInfo.Source", SelectedWatch.source);
            GUIPropertyManager.SetProperty("#MyTorrents.SeriesInfo.Folder", SelectedWatch.folder);
            GUIPropertyManager.SetProperty("#MyTorrents.SeriesInfo.Specials", SelectedWatch.includespecials.ToString());
            //MyTorrents.Instance()._torrentWatchlist._watchItemList.Where(e => (e as SeriesItem).show.ID == SelectedWatch.show.ID).FirstOrDefault() = SelectedWatch;
        }
Exemplo n.º 10
0
 public void AddSeriesWatch(SeriesItem series)
 {
     series.Added = DateTime.Now;
     _watchItemList.Add(series);
 }
Exemplo n.º 11
0
        public void OnToggleSpecials(SeriesItem item, bool includespecials)
        {
            MyTorrents.Instance()._torrentWatchlist.GetSeriesList().Where(e => e.show.ID == item.show.ID).First().includespecials = includespecials;

            GUIPropertyManager.SetProperty("#MyTorrents.SeriesInfo.Specials", includespecials.ToString());
        }
Exemplo n.º 12
0
 public void ChooseFolder(SeriesItem item)
 {
     MyTorrents.ListType = "SeriesFolderBrowser";
     GUIPropertyManager.SetProperty("#MyTorrents.SeriesInfo", "no");
     MyTorrents.Instance().ShowFolderBrowser();
 }