Exemplo n.º 1
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.º 2
0
 public void AddWatch(WatchItem watch)
 {
     watch.Added = DateTime.Now;
     _watchItemList.Add(watch);
 }
Exemplo n.º 3
0
        public void ContextMenu(object info)
        {
            WatchItem     watch = info as WatchItem;
            GUIDialogMenu dlg   = (GUIDialogMenu)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU);

            if (dlg == null)
            {
                return;
            }


            dlg.Reset();
            dlg.SetHeading("Torrent watchlist");
            dlg.Add("Add Series");
            dlg.Add("Search Series");
            dlg.Add("Add Movie");
            dlg.Add("Add custom");
            dlg.Add("Manual Search");
            dlg.Add("Remove selected");
            dlg.Add("Clear list");
            dlg.Add("Force RSS update");
            dlg.DoModal(GUIWindowManager.ActiveWindow);

            switch (dlg.SelectedLabelText)
            {
            case "Add Series":
            {
                AddSeries();
                MyTorrents.Instance().ShowTorrentWatch();
                break;
            }

            case "Search Series":
            {
                SearchSeries();
            }
            break;

            case "Add Movie":
                break;

            case "Manual Search":
                MyTorrents.Instance()._torrentWatchlist.SearchTorrent();
                break;

            case "Add custom":
            {
                VirtualKeyboard keyboard = (VirtualKeyboard)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_VIRTUAL_KEYBOARD);
                keyboard.Reset();
                keyboard.Text = "";
                keyboard.DoModal(GUIWindowManager.ActiveWindow);

                if (!keyboard.IsConfirmed)
                {
                    return;
                }

                watch            = new WatchItem();
                watch.SearchTerm = keyboard.Text;

                TorrentLabel label = DialogAskLabel.Ask();
                if (label != null)
                {
                    watch.Label = label.Name;
                    MyTorrents.Instance()._torrentWatchlist.AddWatch(watch);
                    Log.Instance().Print(String.Format("Watch [{0}] added.", watch.SearchTerm));
                }
                break;
            }

            case "Clear list":
            {
                MyTorrents.Instance()._torrentWatchlist.Clear();
                break;
            }

            case "Remove selected":
            {
                MyTorrents.Instance()._torrentWatchlist.RemoveWatch(watch);
                // torrentList.RemoveItem(torrentList.SelectedListItemIndex);
                break;
            }

            case "Force RSS update":
            {
                RSSChannelManager.Instance().UpdateChannels(true);
                break;
            }
            }

            MyTorrents.Instance().ShowTorrentWatch();
        }