private void SetKeepUntil(KeepUntilMode mode, int?value, bool addValueIfNeeded) { _suspendChangedEvent++; try { DataTable table = KeepUntilControlUtility.CreateValueTable(mode, addValueIfNeeded ? value : null); _keepValueComboBox.DataSource = table; if (table.Rows.Count == 0) { _keepValueComboBox.Enabled = false; } else { _keepValueComboBox.Enabled = true; _keepValueComboBox.DisplayMember = KeepUntilControlUtility.TextColumnName; _keepValueComboBox.ValueMember = KeepUntilControlUtility.ValueColumnName; _keepValueComboBox.SelectedIndex = KeepUntilControlUtility.GetIndexToSelect(table, value); } _keepModeComboBox.SelectedIndex = KeepUntilControlUtility.ModeToIndex(mode); } finally { _suspendChangedEvent--; } }
private KeepUntilMode GetKeepUntilModeFromString(string mode) { KeepUntilMode keepUntilMode = KeepUntilMode.Forever; if (mode == KeepUntilMode.NumberOfDays.ToString()) { keepUntilMode = KeepUntilMode.NumberOfDays; } else if (mode == KeepUntilMode.NumberOfEpisodes.ToString()) { keepUntilMode = KeepUntilMode.NumberOfEpisodes; } else if (mode == KeepUntilMode.NumberOfWatchedEpisodes.ToString()) { keepUntilMode = KeepUntilMode.NumberOfWatchedEpisodes; } else if (mode == KeepUntilMode.UntilSpaceIsNeeded.ToString()) { keepUntilMode = KeepUntilMode.UntilSpaceIsNeeded; } else if (mode == KeepUntilMode.Forever.ToString()) { keepUntilMode = KeepUntilMode.Forever; } return(keepUntilMode); }
private void SetKeepUntil(KeepUntilMode mode, int? value, bool addValueIfNeeded) { _suspendChangedEvent++; try { DataTable table = KeepUntilControlUtility.CreateValueTable(mode, addValueIfNeeded ? value : null); _keepValueComboBox.DataSource = table; if (table.Rows.Count == 0) { _keepValueComboBox.Enabled = false; } else { _keepValueComboBox.Enabled = true; _keepValueComboBox.DisplayMember = KeepUntilControlUtility.TextColumnName; _keepValueComboBox.ValueMember = KeepUntilControlUtility.ValueColumnName; _keepValueComboBox.SelectedIndex = KeepUntilControlUtility.GetIndexToSelect(table, value); } _keepModeComboBox.SelectedIndex = KeepUntilControlUtility.ModeToIndex(mode); } finally { _suspendChangedEvent--; } }
public static DataTable CreateValueTable(KeepUntilMode mode, int?currentValue) { DataTable result = new DataTable(); result.Columns.Add(KeepUntilControlUtility.TextColumnName, typeof(string)); result.Columns.Add(KeepUntilControlUtility.ValueColumnName, typeof(int)); if (mode == KeepUntilMode.NumberOfDays || mode == KeepUntilMode.NumberOfEpisodes || mode == KeepUntilMode.NumberOfWatchedEpisodes) { bool currentValueAdded = !currentValue.HasValue; int[] values = (mode == KeepUntilMode.NumberOfDays) ? _daysValues : _episodesValues; foreach (int value in values) { if (!currentValueAdded && currentValue.Value <= value) { if (currentValue.Value != value) { AddValueToTable(result, currentValue.Value); } currentValueAdded = true; } AddValueToTable(result, value); } if (!currentValueAdded) { AddValueToTable(result, currentValue.Value); } } return(result); }
public static DataTable CreateValueTable(KeepUntilMode mode, int? currentValue) { DataTable result = new DataTable(); result.Columns.Add(KeepUntilControlUtility.TextColumnName, typeof(string)); result.Columns.Add(KeepUntilControlUtility.ValueColumnName, typeof(int)); if (mode == KeepUntilMode.NumberOfDays || mode == KeepUntilMode.NumberOfEpisodes || mode == KeepUntilMode.NumberOfWatchedEpisodes) { bool currentValueAdded = !currentValue.HasValue; int[] values = (mode == KeepUntilMode.NumberOfDays ) ? _daysValues : _episodesValues; foreach (int value in values) { if (!currentValueAdded && currentValue.Value <= value) { if (currentValue.Value != value) { AddValueToTable(result, currentValue.Value); } currentValueAdded = true; } AddValueToTable(result, value); } if (!currentValueAdded) { AddValueToTable(result, currentValue.Value); } } return result; }
/// <summary> /// Set the keep mode and value of an existing recording. /// </summary> /// <param name="recordingFileName">The filename of the recording.</param> /// <param name="keepUntilMode">The keep until mode to use for this recording.</param> /// <param name="keepUntilValue">The keep until value to use for this recording, or null if the mode doesn't require a value.</param> public async Task SetRecordingKeepUntil(string recordingFileName, KeepUntilMode keepUntilMode, int?keepUntilValue) { var request = NewRequest(HttpMethod.Post, "SetRecordingKeepUntil"); request.AddBody(new { RecordingFileName = recordingFileName, KeepUntilMode = keepUntilMode, KeepUntilValue = keepUntilValue }); await ExecuteAsync(request).ConfigureAwait(false); }
public static int ModeToIndex(KeepUntilMode mode) { switch (mode) { case KeepUntilMode.UntilSpaceIsNeeded: return(0); case KeepUntilMode.NumberOfDays: return(1); case KeepUntilMode.NumberOfEpisodes: return(2); case KeepUntilMode.NumberOfWatchedEpisodes: return(3); case KeepUntilMode.Forever: return(4); } return(0); }
private int?GetKeepValue(int heading, KeepUntilMode mode, int singularName, int pluralName, int?currentValue) { DataTable valueTable = KeepUntilControlUtility.CreateValueTable(mode, currentValue); GUIDialogMenu dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU); if (dlg != null) { dlg.Reset(); dlg.ShowQuickNumbers = false; dlg.SetHeading(heading); string singularValue = "1 " + GUILocalizeStrings.Get(singularName); string pluralSuffix = " " + GUILocalizeStrings.Get(pluralName); foreach (DataRow value in valueTable.Rows) { int val = (int)value[KeepUntilControlUtility.ValueColumnName]; if (val == 1) { dlg.Add(singularValue); } else { dlg.Add(value[KeepUntilControlUtility.TextColumnName] + pluralSuffix); } } dlg.SelectedLabel = KeepUntilControlUtility.GetIndexToSelect(valueTable, currentValue); dlg.DoModal(GetID); if (dlg.SelectedLabel >= 0) { return((int)valueTable.Rows[dlg.SelectedLabel][KeepUntilControlUtility.ValueColumnName]); } } return(null); }
private void ReloadSettingsUI() { _preRecordSeconds = Utility.SetDateTimePickerValue(MainForm, _preRecDateTimePicker, ConfigurationKey.Scheduler.PreRecordsSeconds); _postRecordSeconds = Utility.SetDateTimePickerValue(MainForm, _postRecDateTimePicker, ConfigurationKey.Scheduler.PostRecordsSeconds); _keepUntilMode = KeepUntilMode.UntilSpaceIsNeeded; string keepUntilMode = Proxies.ConfigurationService.GetStringValue(ConfigurationModule.Scheduler, ConfigurationKey.Scheduler.DefaultKeepUntilMode).Result; if (!String.IsNullOrEmpty(keepUntilMode)) { _keepUntilMode = (KeepUntilMode)Enum.Parse(typeof(KeepUntilMode), keepUntilMode); } _keepUntilValue = Proxies.ConfigurationService.GetIntValue(ConfigurationModule.Scheduler, ConfigurationKey.Scheduler.DefaultKeepUntilValue).Result; _keepUntilControl.SetKeepUntil(_keepUntilMode, _keepUntilValue); // TV-Guide string preferredSourceString = Proxies.ConfigurationService.GetStringValue(ConfigurationModule.Scheduler, ConfigurationKey.Scheduler.PreferredGuideSource).Result; _preferredSource = GuideSource.Other; if (!String.IsNullOrEmpty(preferredSourceString)) { _preferredSource = (GuideSource)Enum.Parse(typeof(GuideSource), preferredSourceString); } _sourceComboBox.SelectedIndex = (_preferredSource == GuideSource.XmlTv) ? 0 : 1; // Recording conflicts _combineConsecutiveRecordings = GetBooleanSetting(ConfigurationKey.Scheduler.CombineConsecutiveRecordings); _combineConsecutiveRecordingsCheckBox.Checked = _combineConsecutiveRecordings; _autoCombineConsecutiveRecordings = GetBooleanSetting(ConfigurationKey.Scheduler.AutoCombineConsecutiveRecordings); _autoCombineConsecutiveRecordingsCheckBox.Checked = _autoCombineConsecutiveRecordings; _combineRecordingsOnlyOnSameChannel = GetBooleanSetting(ConfigurationKey.Scheduler.CombineRecordingsOnlyOnSameChannel); _combineRecordingsOnlyOnSameChannelCheckBox.Checked = _combineRecordingsOnlyOnSameChannel; _swapRecorderdTunerPriority = GetBooleanSetting(ConfigurationKey.Scheduler.SwapRecorderTunerPriorityForRecordings); _swapRecorderdTunerPriorityCheckBox.Checked = _swapRecorderdTunerPriority; // eMail server _smtpServerTextBox.Text = Proxies.ConfigurationService.GetStringValue( ConfigurationModule.Scheduler, ConfigurationKey.Scheduler.SmtpServer).Result; _smtpPortNumericUpDown.Value = Proxies.ConfigurationService.GetIntValue( ConfigurationModule.Scheduler, ConfigurationKey.Scheduler.SmtpPort).Result.Value; _smtpUserNameTextBox.Text = Proxies.ConfigurationService.GetStringValue( ConfigurationModule.Scheduler, ConfigurationKey.Scheduler.SmtpUserName).Result; _smtpPasswordTextBox.Text = Proxies.ConfigurationService.GetStringValue( ConfigurationModule.Scheduler, ConfigurationKey.Scheduler.SmtpPassword).Result; _smtpUseSslCheckBox.Checked = GetBooleanSetting(ConfigurationKey.Scheduler.SmtpEnableSsl); _adminEmailsTextBox.Text = Proxies.ConfigurationService.GetStringValue( ConfigurationModule.Scheduler, ConfigurationKey.Scheduler.AdministratorEmail).Result; _fromEmailTextBox.Text = Proxies.ConfigurationService.GetStringValue( ConfigurationModule.Scheduler, ConfigurationKey.Scheduler.EmailSender).Result; // IMBot settings _msnUserNameTextBox.Text = Proxies.ConfigurationService.GetStringValue(ConfigurationModule.Messenger, ConfigurationKey.Messenger.MsnAccount).Result; _msnPasswordTextBox.Text = Proxies.ConfigurationService.GetStringValue(ConfigurationModule.Messenger, ConfigurationKey.Messenger.MsnPassword).Result; int?minutesBeforeAlert = Proxies.ConfigurationService.GetIntValue(ConfigurationModule.Messenger, ConfigurationKey.Messenger.MinutesBeforeAlert).Result; if (minutesBeforeAlert.HasValue) { _msnMinutesBeforeAlert.Value = minutesBeforeAlert.Value; } _msnAddressesTextBox.Text = Proxies.ConfigurationService.GetStringValue(ConfigurationModule.Messenger, ConfigurationKey.Messenger.MsnContactList).Result; // ARGUS TV Scheduler _serverTextBox.Text = Proxies.ServerSettings.ServiceUrlPrefix; bool?includeBetaVersionsInUpdateCheck = Proxies.ConfigurationService.GetBooleanValue(ConfigurationModule.Scheduler, ConfigurationKey.Scheduler.IncludeBetaVersionsInUpdateCheck).Result; _includeBetaVersionsInUpdateCheck = includeBetaVersionsInUpdateCheck.HasValue && includeBetaVersionsInUpdateCheck.Value; _checkBetaVersionsCheckBox.Checked = _includeBetaVersionsInUpdateCheck; // Disk space settings int minimumFreeDiskSpaceInMB = Proxies.ConfigurationService.GetIntValue(ConfigurationModule.Scheduler, ConfigurationKey.Scheduler.MinimumFreeDiskSpaceInMB).Result.Value; if (minimumFreeDiskSpaceInMB >= _minFreeDiskSpaceNumericUpDown.Minimum && minimumFreeDiskSpaceInMB <= _minFreeDiskSpaceNumericUpDown.Maximum) { _minFreeDiskSpaceNumericUpDown.Value = minimumFreeDiskSpaceInMB; } else { _minFreeDiskSpaceNumericUpDown.Minimum = minimumFreeDiskSpaceInMB; _minFreeDiskSpaceNumericUpDown.Value = minimumFreeDiskSpaceInMB; } _freeDiskSpaceNumericUpDown.Minimum = _minFreeDiskSpaceNumericUpDown.Value; int freeDiskSpaceInMB = Proxies.ConfigurationService.GetIntValue(ConfigurationModule.Scheduler, ConfigurationKey.Scheduler.FreeDiskSpaceInMB).Result.Value; if (freeDiskSpaceInMB >= _freeDiskSpaceNumericUpDown.Minimum && freeDiskSpaceInMB <= _freeDiskSpaceNumericUpDown.Maximum) { _freeDiskSpaceNumericUpDown.Value = freeDiskSpaceInMB; } else { _freeDiskSpaceNumericUpDown.Value = _freeDiskSpaceNumericUpDown.Minimum; } this._minFreeDiskSpaceNumericUpDown.ValueChanged += new System.EventHandler(this._minFreeDiskSpaceNumericUpDown_ValueChanged); int wakeupMinutes = Proxies.ConfigurationService.GetIntValue(ConfigurationModule.Scheduler, ConfigurationKey.Scheduler.WakeupBeforeEventMinutes).Result.Value; _wakeupMinutesNumericUpDown.Value = Math.Max(wakeupMinutes, _wakeupMinutesNumericUpDown.Minimum); _createThumbnails = GetBooleanSetting(ConfigurationKey.Scheduler.CreateVideoThumbnails); _createThumbnailsCheckBox.Checked = _createThumbnails; _alwaysCreate4trFiles = GetBooleanSetting(ConfigurationKey.Scheduler.AlwaysCreateMetadataFiles); _alwaysCreate4trFilesCheckBox.Checked = _alwaysCreate4trFiles; EnableButtons(); }
public static int ModeToIndex(KeepUntilMode mode) { switch (mode) { case KeepUntilMode.UntilSpaceIsNeeded: return 0; case KeepUntilMode.NumberOfDays: return 1; case KeepUntilMode.NumberOfEpisodes: return 2; case KeepUntilMode.NumberOfWatchedEpisodes: return 3; case KeepUntilMode.Forever: return 4; } return 0; }
private int? GetKeepValue(int heading, KeepUntilMode mode, int singularName, int pluralName, int? currentValue) { DataTable valueTable = KeepUntilControlUtility.CreateValueTable(mode, currentValue); GUIDialogMenu dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU); if (dlg != null) { dlg.Reset(); dlg.ShowQuickNumbers = false; dlg.SetHeading(heading); string singularValue = "1 " + GUILocalizeStrings.Get(singularName); string pluralSuffix = " " + GUILocalizeStrings.Get(pluralName); foreach (DataRow value in valueTable.Rows) { int val = (int)value[KeepUntilControlUtility.ValueColumnName]; if (val == 1) { dlg.Add(singularValue); } else { dlg.Add(value[KeepUntilControlUtility.TextColumnName] + pluralSuffix); } } dlg.SelectedLabel = KeepUntilControlUtility.GetIndexToSelect(valueTable, currentValue); dlg.DoModal(GetID); if (dlg.SelectedLabel >= 0) { return (int)valueTable.Rows[dlg.SelectedLabel][KeepUntilControlUtility.ValueColumnName]; } } return null; }
private void ReloadSettingsUI() { _preRecordSeconds = Utility.SetDateTimePickerValue(MainForm, _preRecDateTimePicker, ConfigurationKey.Scheduler.PreRecordsSeconds); _postRecordSeconds = Utility.SetDateTimePickerValue(MainForm, _postRecDateTimePicker, ConfigurationKey.Scheduler.PostRecordsSeconds); _keepUntilMode = KeepUntilMode.UntilSpaceIsNeeded; string keepUntilMode = Proxies.ConfigurationService.GetStringValue(ConfigurationModule.Scheduler, ConfigurationKey.Scheduler.DefaultKeepUntilMode).Result; if (!String.IsNullOrEmpty(keepUntilMode)) { _keepUntilMode = (KeepUntilMode)Enum.Parse(typeof(KeepUntilMode), keepUntilMode); } _keepUntilValue = Proxies.ConfigurationService.GetIntValue(ConfigurationModule.Scheduler, ConfigurationKey.Scheduler.DefaultKeepUntilValue).Result; _keepUntilControl.SetKeepUntil(_keepUntilMode, _keepUntilValue); // TV-Guide string preferredSourceString = Proxies.ConfigurationService.GetStringValue(ConfigurationModule.Scheduler, ConfigurationKey.Scheduler.PreferredGuideSource).Result; _preferredSource = GuideSource.Other; if (!String.IsNullOrEmpty(preferredSourceString)) { _preferredSource = (GuideSource)Enum.Parse(typeof(GuideSource), preferredSourceString); } _sourceComboBox.SelectedIndex = (_preferredSource == GuideSource.XmlTv) ? 0 : 1; // Recording conflicts _combineConsecutiveRecordings = GetBooleanSetting(ConfigurationKey.Scheduler.CombineConsecutiveRecordings); _combineConsecutiveRecordingsCheckBox.Checked = _combineConsecutiveRecordings; _autoCombineConsecutiveRecordings = GetBooleanSetting(ConfigurationKey.Scheduler.AutoCombineConsecutiveRecordings); _autoCombineConsecutiveRecordingsCheckBox.Checked = _autoCombineConsecutiveRecordings; _combineRecordingsOnlyOnSameChannel = GetBooleanSetting(ConfigurationKey.Scheduler.CombineRecordingsOnlyOnSameChannel); _combineRecordingsOnlyOnSameChannelCheckBox.Checked = _combineRecordingsOnlyOnSameChannel; _swapRecorderdTunerPriority = GetBooleanSetting(ConfigurationKey.Scheduler.SwapRecorderTunerPriorityForRecordings); _swapRecorderdTunerPriorityCheckBox.Checked = _swapRecorderdTunerPriority; // eMail server _smtpServerTextBox.Text = Proxies.ConfigurationService.GetStringValue( ConfigurationModule.Scheduler, ConfigurationKey.Scheduler.SmtpServer).Result; _smtpPortNumericUpDown.Value = Proxies.ConfigurationService.GetIntValue( ConfigurationModule.Scheduler, ConfigurationKey.Scheduler.SmtpPort).Result.Value; _smtpUserNameTextBox.Text = Proxies.ConfigurationService.GetStringValue( ConfigurationModule.Scheduler, ConfigurationKey.Scheduler.SmtpUserName).Result; _smtpPasswordTextBox.Text = Proxies.ConfigurationService.GetStringValue( ConfigurationModule.Scheduler, ConfigurationKey.Scheduler.SmtpPassword).Result; _smtpUseSslCheckBox.Checked = GetBooleanSetting(ConfigurationKey.Scheduler.SmtpEnableSsl); _adminEmailsTextBox.Text = Proxies.ConfigurationService.GetStringValue( ConfigurationModule.Scheduler, ConfigurationKey.Scheduler.AdministratorEmail).Result; _fromEmailTextBox.Text = Proxies.ConfigurationService.GetStringValue( ConfigurationModule.Scheduler, ConfigurationKey.Scheduler.EmailSender).Result; // IMBot settings _msnUserNameTextBox.Text = Proxies.ConfigurationService.GetStringValue(ConfigurationModule.Messenger, ConfigurationKey.Messenger.MsnAccount).Result; _msnPasswordTextBox.Text = Proxies.ConfigurationService.GetStringValue(ConfigurationModule.Messenger, ConfigurationKey.Messenger.MsnPassword).Result; int? minutesBeforeAlert = Proxies.ConfigurationService.GetIntValue(ConfigurationModule.Messenger, ConfigurationKey.Messenger.MinutesBeforeAlert).Result; if (minutesBeforeAlert.HasValue) { _msnMinutesBeforeAlert.Value = minutesBeforeAlert.Value; } _msnAddressesTextBox.Text = Proxies.ConfigurationService.GetStringValue(ConfigurationModule.Messenger, ConfigurationKey.Messenger.MsnContactList).Result; // ARGUS TV Scheduler _serverTextBox.Text = Proxies.ServerSettings.ServiceUrlPrefix; bool? includeBetaVersionsInUpdateCheck = Proxies.ConfigurationService.GetBooleanValue(ConfigurationModule.Scheduler, ConfigurationKey.Scheduler.IncludeBetaVersionsInUpdateCheck).Result; _includeBetaVersionsInUpdateCheck = includeBetaVersionsInUpdateCheck.HasValue && includeBetaVersionsInUpdateCheck.Value; _checkBetaVersionsCheckBox.Checked = _includeBetaVersionsInUpdateCheck; // Disk space settings int minimumFreeDiskSpaceInMB = Proxies.ConfigurationService.GetIntValue(ConfigurationModule.Scheduler, ConfigurationKey.Scheduler.MinimumFreeDiskSpaceInMB).Result.Value; if (minimumFreeDiskSpaceInMB >= _minFreeDiskSpaceNumericUpDown.Minimum && minimumFreeDiskSpaceInMB <= _minFreeDiskSpaceNumericUpDown.Maximum) { _minFreeDiskSpaceNumericUpDown.Value = minimumFreeDiskSpaceInMB; } else { _minFreeDiskSpaceNumericUpDown.Minimum = minimumFreeDiskSpaceInMB; _minFreeDiskSpaceNumericUpDown.Value = minimumFreeDiskSpaceInMB; } _freeDiskSpaceNumericUpDown.Minimum = _minFreeDiskSpaceNumericUpDown.Value; int freeDiskSpaceInMB = Proxies.ConfigurationService.GetIntValue(ConfigurationModule.Scheduler, ConfigurationKey.Scheduler.FreeDiskSpaceInMB).Result.Value; if (freeDiskSpaceInMB >= _freeDiskSpaceNumericUpDown.Minimum && freeDiskSpaceInMB <= _freeDiskSpaceNumericUpDown.Maximum) { _freeDiskSpaceNumericUpDown.Value = freeDiskSpaceInMB; } else { _freeDiskSpaceNumericUpDown.Value = _freeDiskSpaceNumericUpDown.Minimum; } this._minFreeDiskSpaceNumericUpDown.ValueChanged += new System.EventHandler(this._minFreeDiskSpaceNumericUpDown_ValueChanged); int wakeupMinutes = Proxies.ConfigurationService.GetIntValue(ConfigurationModule.Scheduler, ConfigurationKey.Scheduler.WakeupBeforeEventMinutes).Result.Value; _wakeupMinutesNumericUpDown.Value = Math.Max(wakeupMinutes, _wakeupMinutesNumericUpDown.Minimum); _createThumbnails = GetBooleanSetting(ConfigurationKey.Scheduler.CreateVideoThumbnails); _createThumbnailsCheckBox.Checked = _createThumbnails; _alwaysCreate4trFiles = GetBooleanSetting(ConfigurationKey.Scheduler.AlwaysCreateMetadataFiles); _alwaysCreate4trFilesCheckBox.Checked = _alwaysCreate4trFiles; EnableButtons(); }
private void OnChangeKeepUntilMode() { GUIDialogMenu dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU); if (dlg != null) { dlg.Reset(); dlg.SetHeading(Utility.GetLocalizedText(TextId.DefaultKeepMode)); dlg.Add(Utility.GetLocalizedText(TextId.UntilSpaceNeeded)); dlg.Add(Utility.GetLocalizedText(TextId.NumberOfDays)); dlg.Add(Utility.GetLocalizedText(TextId.NumberOfEpisodes)); dlg.Add(Utility.GetLocalizedText(TextId.NumberOfWatchedEpisodes)); dlg.Add(Utility.GetLocalizedText(TextId.Forever)); int selectedId = 0; switch (_currentKeepUntilMode) { case KeepUntilMode.UntilSpaceIsNeeded: selectedId = 0; break; case KeepUntilMode.NumberOfDays: selectedId = 1; break; case KeepUntilMode.NumberOfEpisodes: selectedId = 2; break; case KeepUntilMode.NumberOfWatchedEpisodes: selectedId = 3; break; case KeepUntilMode.Forever: selectedId = 4; break; } dlg.SelectedLabel = selectedId; dlg.DoModal(GetID); if (dlg.SelectedId > 0) { switch (dlg.SelectedLabel) { case 0: _currentKeepUntilMode = KeepUntilMode.UntilSpaceIsNeeded; break; case 1: _currentKeepUntilMode = KeepUntilMode.NumberOfDays; break; case 2: _currentKeepUntilMode = KeepUntilMode.NumberOfEpisodes; break; case 3: _currentKeepUntilMode = KeepUntilMode.NumberOfWatchedEpisodes; break; case 4: _currentKeepUntilMode = KeepUntilMode.Forever; break; } if (_currentKeepUntilMode != KeepUntilMode.Forever && _currentKeepUntilMode != KeepUntilMode.UntilSpaceIsNeeded) { DataTable valueTable = KeepUntilControlUtility.CreateValueTable(_currentKeepUntilMode, null); _currentKeepUntilValue = (int)valueTable.Rows[0][KeepUntilControlUtility.ValueColumnName]; } } } }
private void LoadSettings() { Log.Debug("ServerSettingsBase: LoadSettings()"); bool? _autoCreateThumbs = ConfigurationServiceAgent.GetBooleanValue(ConfigurationModule.Scheduler, ConfigurationKey.Scheduler.CreateVideoThumbnails, true); bool? _metaDataForRecs = ConfigurationServiceAgent.GetBooleanValue(ConfigurationModule.Scheduler, ConfigurationKey.Scheduler.AlwaysCreateMetadataFiles, true); bool? _swapTunerPriority = ConfigurationServiceAgent.GetBooleanValue(ConfigurationModule.Scheduler, ConfigurationKey.Scheduler.SwapRecorderTunerPriorityForRecordings, true); bool? _autoCombineConsecutive = ConfigurationServiceAgent.GetBooleanValue(ConfigurationModule.Scheduler, ConfigurationKey.Scheduler.AutoCombineConsecutiveRecordings, true); bool? _combineConsecutive = ConfigurationServiceAgent.GetBooleanValue(ConfigurationModule.Scheduler, ConfigurationKey.Scheduler.CombineConsecutiveRecordings, true); bool? _combineOnlyOnSameChannel = ConfigurationServiceAgent.GetBooleanValue(ConfigurationModule.Scheduler, ConfigurationKey.Scheduler.CombineRecordingsOnlyOnSameChannel, true); int? _preRecord = ConfigurationServiceAgent.GetIntValue(ConfigurationModule.Scheduler, ConfigurationKey.Scheduler.PreRecordsSeconds, true); int? _postRecord = ConfigurationServiceAgent.GetIntValue(ConfigurationModule.Scheduler, ConfigurationKey.Scheduler.PostRecordsSeconds, true); int? _keepUntilValue = ConfigurationServiceAgent.GetIntValue(ConfigurationModule.Scheduler, ConfigurationKey.Scheduler.DefaultKeepUntilValue, true); int? _freeDiskSpace = ConfigurationServiceAgent.GetIntValue(ConfigurationModule.Scheduler, ConfigurationKey.Scheduler.FreeDiskSpaceInMB, true); int? _minFreeDiskSpace = ConfigurationServiceAgent.GetIntValue(ConfigurationModule.Scheduler, ConfigurationKey.Scheduler.MinimumFreeDiskSpaceInMB, true); string _keepUntilMode = ConfigurationServiceAgent.GetStringValue(ConfigurationModule.Scheduler, ConfigurationKey.Scheduler.DefaultKeepUntilMode, true); string _guideSource = ConfigurationServiceAgent.GetStringValue(ConfigurationModule.Scheduler, ConfigurationKey.Scheduler.PreferredGuideSource, true); if (_autoCreateThumbs.HasValue) _autoCreateThumbsButton.Selected = _autoCreateThumbs.Value; if (_metaDataForRecs.HasValue) _metaDataForRecsButton.Selected = _metaDataForRecs.Value; if (_keepUntilValue.HasValue) _currentKeepUntilValue = _keepUntilValue.Value; if (_keepUntilMode != string.Empty) _currentKeepUntilMode = GetKeepUntilModeFromString(_keepUntilMode); if (_guideSource != string.Empty) _currentGuideSource = GetGuideSourceFromString(_guideSource); _autoCreateThumbsButton.IsEnabled = _autoCreateThumbs.HasValue; _metaDataForRecsButton.IsEnabled = _metaDataForRecs.HasValue; _preRecordButton.IsEnabled = _preRecord.HasValue; _postRecordButton.IsEnabled = _postRecord.HasValue; _keepUntilValueButton.IsEnabled = _keepUntilValue.HasValue; _freeDiskSpaceSpinButton.IsEnabled = _freeDiskSpace.HasValue; _minFreeDiskSpaceSpinButton.IsEnabled = _minFreeDiskSpace.HasValue; if (_preRecord.HasValue) { int prerec = _preRecord.Value/60; bool valueFoundInList = false; for (int i = 0; i <= 60; i++) { _preRecordButton.AddSpinLabel(i.ToString(), 0); if (i == prerec) valueFoundInList = true; } if (valueFoundInList) { _preRecordButton.SpinValue = prerec; } else { _preRecordButton.AddSpinLabel(prerec.ToString(), 0); _preRecordButton.SpinValue = _preRecordButton.SpinMaxValue() - 1; } } if (_postRecord.HasValue) { int postrec = _postRecord.Value/60; bool valueFoundInList = false; for (int i = 0; i <= 60; i++) { _postRecordButton.AddSpinLabel(i.ToString(), 0); if (i == postrec) valueFoundInList = true; } if (valueFoundInList) { _postRecordButton.SpinValue = postrec; } else { _postRecordButton.AddSpinLabel(postrec.ToString(), 0); _postRecordButton.SpinValue = _postRecordButton.SpinMaxValue() - 1; } } if (_freeDiskSpace.HasValue) { int freespace = _freeDiskSpace.Value/1000; bool valueFoundInList = false; for (int i = 1; i < 1000; i++) { _freeDiskSpaceSpinButton.AddSpinLabel(i.ToString(), 0); if (i == freespace) valueFoundInList = true; } if (valueFoundInList) { _freeDiskSpaceSpinButton.SpinValue = freespace - 1; } else { _freeDiskSpaceSpinButton.AddSpinLabel(freespace.ToString(), 0); _freeDiskSpaceSpinButton.SpinValue = _freeDiskSpaceSpinButton.SpinMaxValue() - 1; } } if (_minFreeDiskSpace.HasValue) { int freespace = _minFreeDiskSpace.Value/1000; bool valueFoundInList = false; for (int i = 1; i <= 1000; i++) { _minFreeDiskSpaceSpinButton.AddSpinLabel(i.ToString(), 0); if (i == freespace) valueFoundInList = true; } if (valueFoundInList) { _minFreeDiskSpaceSpinButton.SpinValue = freespace - 1; } else { _minFreeDiskSpaceSpinButton.AddSpinLabel(freespace.ToString(), 0); _minFreeDiskSpaceSpinButton.SpinValue = _minFreeDiskSpaceSpinButton.SpinMaxValue() - 1; } } }
private bool GetKeepUntilValues(KeepUntilMode keepUntilMode, int? keepUntilValue, out KeepUntilMode newMode, out int? newValue) { newMode = keepUntilMode; newValue = keepUntilValue; GUIDialogMenu dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU); if (dlg != null) { dlg.Reset(); dlg.SetHeading(1042); // Keep until dlg.Add(Utility.GetLocalizedText(TextId.UntilSpaceNeeded)); dlg.Add(Utility.GetLocalizedText(TextId.NumberOfDays)); dlg.Add(Utility.GetLocalizedText(TextId.NumberOfEpisodes)); dlg.Add(Utility.GetLocalizedText(TextId.NumberOfWatchedEpisodes)); dlg.Add(Utility.GetLocalizedText(TextId.Forever)); switch (keepUntilMode) { case KeepUntilMode.UntilSpaceIsNeeded: dlg.SelectedLabel = 0; break; case KeepUntilMode.NumberOfDays: dlg.SelectedLabel = 1; break; case KeepUntilMode.NumberOfEpisodes: dlg.SelectedLabel = 2; break; case KeepUntilMode.NumberOfWatchedEpisodes: dlg.SelectedLabel = 3; break; case KeepUntilMode.Forever: dlg.SelectedLabel = 4; break; } dlg.DoModal(GetID); if (dlg.SelectedId > 0) { switch (dlg.SelectedLabel) { case 0: newMode = KeepUntilMode.UntilSpaceIsNeeded; newValue = null; return true; case 1: { int? value = GetKeepValue(1045, KeepUntilMode.NumberOfDays, 3014, 3015, keepUntilMode == KeepUntilMode.NumberOfDays ? keepUntilValue : 7); if (value.HasValue) { newMode = KeepUntilMode.NumberOfDays; newValue = value; return true; } } break; case 2: { int? value = GetKeepValue(887, KeepUntilMode.NumberOfEpisodes, 682, 914, keepUntilMode == KeepUntilMode.NumberOfEpisodes ? keepUntilValue : 3); if (value.HasValue) { newMode = KeepUntilMode.NumberOfEpisodes; newValue = value; return true; } } break; case 3: { int? value = GetKeepValue(887, KeepUntilMode.NumberOfWatchedEpisodes, 682, 914, keepUntilMode == KeepUntilMode.NumberOfWatchedEpisodes ? keepUntilValue : 3); if (value.HasValue) { newMode = KeepUntilMode.NumberOfWatchedEpisodes; newValue = value; return true; } } break; case 4: newMode = KeepUntilMode.Forever; newValue = null; return true; } } } return false; }
/// <summary> /// Set the keep mode and value of an existing recording. /// </summary> /// <param name="recordingFileName">The filename of the recording.</param> /// <param name="keepUntilMode">The keep until mode to use for this recording.</param> /// <param name="keepUntilValue">The keep until value to use for this recording, or null if the mode doesn't require a value.</param> public async Task SetRecordingKeepUntil(string recordingFileName, KeepUntilMode keepUntilMode, int? keepUntilValue) { var request = NewRequest(HttpMethod.Post, "SetRecordingKeepUntil"); request.AddBody(new { RecordingFileName = recordingFileName, KeepUntilMode = keepUntilMode, KeepUntilValue = keepUntilValue }); await ExecuteAsync(request).ConfigureAwait(false); }
private void LoadSettings() { Log.Debug("ServerSettingsBase: LoadSettings()"); bool?_autoCreateThumbs = Proxies.ConfigurationService.GetBooleanValue(ConfigurationModule.Scheduler, ConfigurationKey.Scheduler.CreateVideoThumbnails).Result; bool?_metaDataForRecs = Proxies.ConfigurationService.GetBooleanValue(ConfigurationModule.Scheduler, ConfigurationKey.Scheduler.AlwaysCreateMetadataFiles).Result; bool?_swapTunerPriority = Proxies.ConfigurationService.GetBooleanValue(ConfigurationModule.Scheduler, ConfigurationKey.Scheduler.SwapRecorderTunerPriorityForRecordings).Result; bool?_autoCombineConsecutive = Proxies.ConfigurationService.GetBooleanValue(ConfigurationModule.Scheduler, ConfigurationKey.Scheduler.AutoCombineConsecutiveRecordings).Result; bool?_combineConsecutive = Proxies.ConfigurationService.GetBooleanValue(ConfigurationModule.Scheduler, ConfigurationKey.Scheduler.CombineConsecutiveRecordings).Result; bool?_combineOnlyOnSameChannel = Proxies.ConfigurationService.GetBooleanValue(ConfigurationModule.Scheduler, ConfigurationKey.Scheduler.CombineRecordingsOnlyOnSameChannel).Result; int?_preRecord = Proxies.ConfigurationService.GetIntValue(ConfigurationModule.Scheduler, ConfigurationKey.Scheduler.PreRecordsSeconds).Result; int?_postRecord = Proxies.ConfigurationService.GetIntValue(ConfigurationModule.Scheduler, ConfigurationKey.Scheduler.PostRecordsSeconds).Result; int?_keepUntilValue = Proxies.ConfigurationService.GetIntValue(ConfigurationModule.Scheduler, ConfigurationKey.Scheduler.DefaultKeepUntilValue).Result; int?_freeDiskSpace = Proxies.ConfigurationService.GetIntValue(ConfigurationModule.Scheduler, ConfigurationKey.Scheduler.FreeDiskSpaceInMB).Result; int?_minFreeDiskSpace = Proxies.ConfigurationService.GetIntValue(ConfigurationModule.Scheduler, ConfigurationKey.Scheduler.MinimumFreeDiskSpaceInMB).Result; string _keepUntilMode = Proxies.ConfigurationService.GetStringValue(ConfigurationModule.Scheduler, ConfigurationKey.Scheduler.DefaultKeepUntilMode).Result; string _guideSource = Proxies.ConfigurationService.GetStringValue(ConfigurationModule.Scheduler, ConfigurationKey.Scheduler.PreferredGuideSource).Result; if (_autoCreateThumbs.HasValue) { _autoCreateThumbsButton.Selected = _autoCreateThumbs.Value; } if (_metaDataForRecs.HasValue) { _metaDataForRecsButton.Selected = _metaDataForRecs.Value; } if (_keepUntilValue.HasValue) { _currentKeepUntilValue = _keepUntilValue.Value; } if (_keepUntilMode != string.Empty) { _currentKeepUntilMode = GetKeepUntilModeFromString(_keepUntilMode); } if (_guideSource != string.Empty) { _currentGuideSource = GetGuideSourceFromString(_guideSource); } _autoCreateThumbsButton.IsEnabled = _autoCreateThumbs.HasValue; _metaDataForRecsButton.IsEnabled = _metaDataForRecs.HasValue; _preRecordButton.IsEnabled = _preRecord.HasValue; _postRecordButton.IsEnabled = _postRecord.HasValue; _keepUntilValueButton.IsEnabled = _keepUntilValue.HasValue; _freeDiskSpaceSpinButton.IsEnabled = _freeDiskSpace.HasValue; _minFreeDiskSpaceSpinButton.IsEnabled = _minFreeDiskSpace.HasValue; if (_preRecord.HasValue) { int prerec = _preRecord.Value / 60; bool valueFoundInList = false; for (int i = 0; i <= 60; i++) { _preRecordButton.AddSpinLabel(i.ToString(), 0); if (i == prerec) { valueFoundInList = true; } } if (valueFoundInList) { _preRecordButton.SpinValue = prerec; } else { _preRecordButton.AddSpinLabel(prerec.ToString(), 0); _preRecordButton.SpinValue = _preRecordButton.SpinMaxValue() - 1; } } if (_postRecord.HasValue) { int postrec = _postRecord.Value / 60; bool valueFoundInList = false; for (int i = 0; i <= 60; i++) { _postRecordButton.AddSpinLabel(i.ToString(), 0); if (i == postrec) { valueFoundInList = true; } } if (valueFoundInList) { _postRecordButton.SpinValue = postrec; } else { _postRecordButton.AddSpinLabel(postrec.ToString(), 0); _postRecordButton.SpinValue = _postRecordButton.SpinMaxValue() - 1; } } if (_freeDiskSpace.HasValue) { int freespace = _freeDiskSpace.Value / 1000; bool valueFoundInList = false; for (int i = 1; i < 1000; i++) { _freeDiskSpaceSpinButton.AddSpinLabel(i.ToString(), 0); if (i == freespace) { valueFoundInList = true; } } if (valueFoundInList) { _freeDiskSpaceSpinButton.SpinValue = freespace - 1; } else { _freeDiskSpaceSpinButton.AddSpinLabel(freespace.ToString(), 0); _freeDiskSpaceSpinButton.SpinValue = _freeDiskSpaceSpinButton.SpinMaxValue() - 1; } } if (_minFreeDiskSpace.HasValue) { int freespace = _minFreeDiskSpace.Value / 1000; bool valueFoundInList = false; for (int i = 1; i <= 1000; i++) { _minFreeDiskSpaceSpinButton.AddSpinLabel(i.ToString(), 0); if (i == freespace) { valueFoundInList = true; } } if (valueFoundInList) { _minFreeDiskSpaceSpinButton.SpinValue = freespace - 1; } else { _minFreeDiskSpaceSpinButton.AddSpinLabel(freespace.ToString(), 0); _minFreeDiskSpaceSpinButton.SpinValue = _minFreeDiskSpaceSpinButton.SpinMaxValue() - 1; } } }
public void SetKeepUntil(KeepUntilMode mode, int? value) { SetKeepUntil(mode, value, true); }
public void SetKeepUntil(KeepUntilMode mode, int?value) { SetKeepUntil(mode, value, true); }