Example #1
0
        static private XmlNode UpdateSeries(String sSeriesID, bool first)
        {
            int series = Int32.Parse(sSeriesID);

            if (DBOption.GetOptions(DBOption.cOverrideLanguage))
            {
                string SelLang = GetLanguageOverride(sSeriesID);
                return(getFromCache(series, SelLang + ".xml", SelLang));
            }
            else
            {
                return(getFromCache(series, SelLanguageAsString + ".xml"));
            }
        }
Example #2
0
 static private XmlNode UpdateSeries(String sSeriesID, String languageID, bool first, bool aOverride = false)
 {
     // we may need to get english original name even when series language is overridden
     if (DBOption.GetOptions(DBOption.cOverrideLanguage) && !aOverride)
     {
         languageID = GetLanguageOverride(sSeriesID);
         int series = Int32.Parse(sSeriesID);
         return(getFromCache(series, languageID + ".xml", languageID));
     }
     else
     {
         // if we have an overridden language then we do not care
         int series = Int32.Parse(sSeriesID);
         return(getFromCache(series, languageID + ".xml", languageID));
     }
 }
Example #3
0
        static public bool SubmitRating(RatingType type, string itemId, int rating)
        {
            string account = DBOption.GetOptions(DBOption.cOnlineUserID);

            if (String.IsNullOrEmpty(account))
            {
                string[] lines = new string[] { Translation.TVDB_INFO_ACCOUNTID_1, Translation.TVDB_INFO_ACCOUNTID_2 };
                //TVSeriesPlugin.ShowDialogOk(Translation.TVDB_INFO_TITLE, lines); //trakt.tv also listens to this, also can store ratings locally.
                MPTVSeriesLog.Write("Cannot submit rating to thetvdb.com, this requires your Account Identifier to be set.");
                return(false);
            }

            if (itemId == "0" || rating < 0 || rating > 10)
            {
                MPTVSeriesLog.Write("Cannot submit rating, invalid values...this is most likely a programming error");
                return(false);
            }

            if (!DBOnlineMirror.IsMirrorsAvailable)
            {
                // Server maybe available now.
                DBOnlineMirror.Init();
                if (!DBOnlineMirror.IsMirrorsAvailable)
                {
                    GUIDialogOK dlgOK = ( GUIDialogOK )GUIWindowManager.GetWindow(( int )GUIWindow.Window.WINDOW_DIALOG_OK);
                    dlgOK.SetHeading(Translation.TVDB_ERROR_TITLE);
                    if (!TVSeriesPlugin.IsNetworkAvailable)
                    {
                        string[] lines = new string[] { Translation.NETWORK_ERROR_UNAVAILABLE_1, Translation.NETWORK_ERROR_UNAVAILABLE_2 };
                        TVSeriesPlugin.ShowDialogOk(Translation.TVDB_ERROR_TITLE, lines);
                    }
                    else
                    {
                        string[] lines = new string[] { Translation.TVDB_ERROR_UNAVAILABLE_1, Translation.TVDB_ERROR_UNAVAILABLE_2 };
                        TVSeriesPlugin.ShowDialogOk(Translation.TVDB_ERROR_TITLE, lines);
                    }

                    MPTVSeriesLog.Write("Cannot submit rating, the online database is unavailable");
                    return(false);
                }
            }
            // ok we're good
            MPTVSeriesLog.Write(string.Format("Submitting Rating of {2} for {0} {1}", type.ToString(), itemId, rating), MPTVSeriesLog.LogLevel.Debug);
            Generic(string.Format(apiURIs.SubmitRating, account, type.ToString(), itemId, rating), true, false, Format.NoExtension);
            return(true);
        }
Example #4
0
        public static SQLAccess GetInstance(DBOption opt)
        {
            string constr = string.Empty;

            switch (opt)
            {
            case DBOption.Default:
                constr = "default";
                break;

            case DBOption.DiShang:
                constr = "dishanscon";
                break;
            }

            return(GetInstance(constr));
        }
Example #5
0
 void InitializeOption(string newOption)
 {
     if (newOption != string.Empty && newOption != _option) // else no need to do anything
     {
         if (_option == string.Empty)                       // empty, this is the first Set
         {
             _option = newOption;
             // Load the Current Value from the DB (before Eventhandler is added)
             this.Checked = DBOption.GetOptions(newOption);
             // Register the Eventhandler for the CheckStateChanged Event
             this.CheckStateChanged += new EventHandler(OptionCheckBox_CheckStateChanged);
         }
         else // has been Set before and wants to change -> illegal
         {
             throw new InvalidOperationException(string.Format("The Option Property of the OptionCheckBox instance \"{0}\" was attempted to be changed to \"{1}\", but the Property is already set to \"{2}\".",
                                                               this.Name, newOption, Option));
         }
     }
 }
Example #6
0
        protected override void OnPageLoad()
        {
            // set window name
            GUIPropertyManager.SetProperty("#currentmodule", Translation.Actors);

            // clear any properties from previous series
            ClearProperties();

            // set default layout
            int defaultLayout = 0;

            int.TryParse(DBOption.GetOptions(DBOption.cActorLayout), out defaultLayout);
            CurrentLayout = (Layout)defaultLayout;

            // update button label
            GUIControl.SetControlLabel(GetID, ButtonLayouts.GetID, GetLayoutTranslation(CurrentLayout));

            // retrieve actors and load into facade
            DownloadActorsList();
        }
Example #7
0
        private void FillSeriesList()
        {
            this.listBoxSeries.Items.Clear();
            this.listBoxOnline.Items.Clear();
            this.listBoxLocal.Items.Clear();
            foreach (var s in matches.Where(leps => leps.Value.Count > 0).Select(m => m.Key))
            {
                if (!listBoxSeries.Items.Contains(s))
                {
                    if (!checkBoxFilter.Checked || !seriesHasAllEpsMatched(s))
                    {
                        this.listBoxSeries.Items.Add(s);
                    }
                }
            }
            if (listBoxSeries.SelectedIndex < 0 && listBoxSeries.Items.Count > 0)
            {
                listBoxSeries.SelectedIndex = 0;
            }

            if (listBoxSeries.Items.Count == 0)
            {
                comboMatchOptions.Enabled = false;
                comboMatchOptions.Items.Clear();
                buttonMatchAgain.Enabled = false;
                txtBoxStatusBar.Text     = "There are no episodes requiring manual selection...";
            }
            else
            {
                comboMatchOptions.Enabled = true;
                buttonMatchAgain.Enabled  = true;
            }

            if (DBOption.GetOptions(DBOption.cCheckShowOnlyEpisodesRequiringManualSelection) && listBoxSeries.Items.Count == 0)
            {
                ImportWizard_OnWizardNavigate(UserFinishedRequestedAction.Next);
            }
        }
 private void textBoxPlaylistFolder_TextChanged(object sender, EventArgs e)
 {
     DBOption.SetOptions(DBOption.cPlaylistPath, textBoxPlaylistFolder.Text);
 }
 private void LoadFromDB()
 {
     // Playlist Folder
     PlaylistPath = DBOption.GetOptions(DBOption.cPlaylistPath);
     textBoxPlaylistFolder.Text = PlaylistPath;
 }
Example #10
0
 public DepartmentController(IOptions <DBOption> option, IDepartmentService departmentService, ILogger <EmployeeController> logger) : base(logger)
 {
     this.m_CmsOptions   = option.Value;
     m_DepartmentService = departmentService;
 }
Example #11
0
        /// <summary>
        /// Play all episodes of a series
        /// </summary>
        /// <param name="seriesId">ID of a series</param>
        /// <param name="onlyUnwatched">Play only unwatched episodes</param>
        /// <param name="autostart">If yes, automatically starts playback with the first episode</param>
        /// <param name="startIndex">Index of the item with which playback should start</param>
        /// <param name="switchToPlaylistView">If yes the playlistview will be shown</param>
        public static void PlaySeries(int seriesId, bool autostart, int startIndex, bool onlyUnwatched, bool switchToPlaylistView)
        {
            if (GUIGraphicsContext.form.InvokeRequired)
            {
                PlaySeriesAsyncDelegate d = new PlaySeriesAsyncDelegate(PlaySeries);
                GUIGraphicsContext.form.Invoke(d, new object[] { seriesId, autostart, startIndex, onlyUnwatched, switchToPlaylistView });
                return;
            }

            List <DBEpisode> episodes = DBEpisode.Get(seriesId);

            if (episodes == null || episodes.Count == 0)
            {
                return;
            }

            // filter out anything we can't play
            episodes.RemoveAll(e => string.IsNullOrEmpty(e[DBEpisode.cFilename]));

            // filter out watched episodes
            if (onlyUnwatched)
            {
                episodes.RemoveAll(e => e[DBOnlineEpisode.cWatched] != 0);
            }
            if (episodes.Count == 0)
            {
                return;
            }

            // Sort episodes and add them to the MP-TVSeries playlist player
            // Setup playlist player
            if (playlistPlayer == null)
            {
                playlistPlayer = PlayListPlayer.SingletonPlayer;
                playlistPlayer.PlaylistAutoPlay = true;
                playlistPlayer.RepeatPlaylist   = DBOption.GetOptions(DBOption.cRepeatPlaylist);
            }

            playlistPlayer.GetPlaylist(PlayListType.PLAYLIST_TVSERIES).Clear();
            episodes.Sort();

            foreach (DBEpisode episode in episodes)
            {
                PlayListItem playlistItem = new PlayListItem(episode);
                playlistPlayer.GetPlaylist(PlayListType.PLAYLIST_TVSERIES).Add(playlistItem);
            }

            //automatically start playing the playlist
            if (autostart)
            {
                // and activate the playlist window if its not activated yet
                if (switchToPlaylistView)
                {
                    GUIWindowManager.ActivateWindow(GUITVSeriesPlayList.GetWindowID);
                }

                playlistPlayer.CurrentPlaylistType = PlayListType.PLAYLIST_TVSERIES;
                playlistPlayer.Reset();
                playlistPlayer.Play(0);
            }
        }
Example #12
0
 public EmployeeController(IOptions <DBOption> option, IEmployeeService employeeService, ILogger <EmployeeController> logger) : base(logger)
 {
     this.m_CmsOptions = option.Value;
     m_Service         = employeeService;
 }
Example #13
0
 private void textBoxPassword_TextChanged(object sender, EventArgs e)
 {
     // Hash Password
     DBOption.SetOptions(DBOption.cTraktPassword, textBoxPassword.Text.ToSHA1Hash());
     TraktAPI.Password = DBOption.GetOptions(DBOption.cTraktPassword);
 }
Example #14
0
 private void textBoxUsername_TextChanged(object sender, EventArgs e)
 {
     DBOption.SetOptions(DBOption.cTraktUsername, textBoxUsername.Text);
     TraktAPI.Username = DBOption.GetOptions(DBOption.cTraktUsername);
 }