public GetSetting ( string tagName ) : TvDatabase.Setting | ||
tagName | string | |
return | TvDatabase.Setting |
public DateTime GetNextWakeupTime(DateTime earliestWakeupTime) { TvBusinessLayer layer = new TvBusinessLayer(); bool remoteSchedulerEnabled = (layer.GetSetting("xmlTvRemoteSchedulerEnabled", "false").Value == "true"); if (!remoteSchedulerEnabled) { return DateTime.MaxValue; } DateTime now = DateTime.Now; DateTime defaultRemoteScheduleTime = new DateTime(now.Year, now.Month, now.Day, 0, 0, 0); string remoteScheduleTimeStr = layer.GetSetting("xmlTvRemoteScheduleTime", defaultRemoteScheduleTime.ToString()).Value; DateTime remoteScheduleTime = (DateTime) (System.ComponentModel.TypeDescriptor.GetConverter(new DateTime(now.Year, now.Month, now.Day)).ConvertFrom( remoteScheduleTimeStr)); if (remoteScheduleTime == DateTime.MinValue) { remoteScheduleTime = defaultRemoteScheduleTime; } if ((now < remoteScheduleTime) && (remoteScheduleTime > DateTime.MinValue)) { remoteScheduleTime.AddDays(1); } Log.Debug(this._handlerName + ".GetNextWakeupTime {0}", remoteScheduleTime); remoteScheduleTime.AddMinutes(-1); // resume 60sec before return remoteScheduleTime; }
public override void LoadSettings() { var layer = new TvBusinessLayer(); numEpgGrabber.Value = ValueSanityCheck( Convert.ToDecimal(layer.GetSetting(UserFactory.EPG_TAGNAME, UserFactory.EPG_PRIORITY.ToString()).Value), 1, 100); numDefaultUser.Value = ValueSanityCheck( Convert.ToDecimal(layer.GetSetting(UserFactory.USER_TAGNAME, UserFactory.USER_PRIORITY.ToString()).Value), 1, 100); numScheduler.Value = ValueSanityCheck( Convert.ToDecimal(layer.GetSetting(UserFactory.SCHEDULER_TAGNAME, UserFactory.SCHEDULER_PRIORITY.ToString()).Value), 1, 100); numVirtualuser.Value = Convert.ToInt32(layer.GetSetting("VirtualUserIdleTime", "5").Value); Setting setting = layer.GetSetting(UserFactory.CUSTOM_TAGNAME, ""); gridUserPriorities.Rows.Clear(); string[] users = setting.Value.Split(';'); foreach (string user in users) { string[] shareItem = user.Split(','); if ((shareItem.Length.Equals(2)) && ((shareItem[0].Trim().Length > 0) || (shareItem[1].Trim().Length > 0))) { gridUserPriorities.Rows.Add(shareItem); } } }
public TvWishListSetup() { InitializeComponent(); myTvWishes = new TvWishProcessing(); PluginGuiLocalizeStrings.LoadMPlanguage(); //initialize TV database myinterface = new ServiceInterface(); //try to shorten wait time when switching to the page by opening the connection at the beginning myinterface.ConnectToDatabase(); TvBusinessLayer layer = new TvBusinessLayer(); Setting setting; //default pre and post record from general recording settings setting = layer.GetSetting("preRecordInterval", "5"); prerecord = setting.Value; setting = layer.GetSetting("postRecordInterval", "5"); postrecord = setting.Value; IList<Channel> allChannels = Channel.ListAll(); IList<ChannelGroup> allChannelGroups = ChannelGroup.ListAll(); IList<RadioChannelGroup> allRadioChannelGroups = RadioChannelGroup.ListAll(); IList<Card> allCards = Card.ListAll(); Log.Debug("allCards.Count=" + allCards.Count.ToString()); myTvWishes.TvServerSettings(prerecord, postrecord, allChannelGroups, allRadioChannelGroups, allChannels, allCards, TvWishItemSeparator); LanguageTranslation(); LoadSettings(); }
private ITvSubChannel _subchannel; // the active sub channel to record /// <summary> /// Initializes a new instance of the <see cref="Recording"/> class. /// </summary> /// <param name="cardHandler">The card handler.</param> public Recorder(ITvCardHandler cardHandler) { _eventAudio = new ManualResetEvent(false); _eventVideo = new ManualResetEvent(false); TvBusinessLayer layer = new TvBusinessLayer(); _cardHandler = cardHandler; _timeshiftingEpgGrabberEnabled = (layer.GetSetting("timeshiftingEpgGrabberEnabled", "no").Value == "yes"); _waitForTimeshifting = Int32.Parse(layer.GetSetting("timeshiftWaitForTimeshifting", "15").Value); }
private void ActivePortsHandler_OnPowerSchedulerEvent(PowerSchedulerEventArgs args) { switch (args.EventType) { case PowerSchedulerEventType.Started: case PowerSchedulerEventType.Elapsed: TvBusinessLayer layer = new TvBusinessLayer(); _enabled = Convert.ToBoolean(layer.GetSetting("PowerSchedulerActivePortsHandlerEnabled", "true").Value); _useAwayMode = Convert.ToBoolean(layer.GetSetting("PowerSchedulerActivePortsHandlerAwayMode", "false").Value); break; } }
protected override void OnPageLoad() { base.OnPageLoad(); spinPreRecord.SetRange(0, 30); spinPostRecord.SetRange(0, 30); TvBusinessLayer layer = new TvBusinessLayer(); spinPreRecord.Value = Int32.Parse(layer.GetSetting("preRecordInterval", "5").Value); spinPostRecord.Value = Int32.Parse(layer.GetSetting("postRecordInterval", "5").Value); cbAutoDeleteRecordings.Selected = (layer.GetSetting("autodeletewatchedrecordings", "no").Value == "yes"); cbCreateTagInfoXML.Selected = (layer.GetSetting("createtaginfoxml", "yes").Value == "yes"); }
/// <summary> /// Initializes a new instance of the <see cref="TimeShifter"/> class. /// </summary> /// <param name="cardHandler">The card handler.</param> public TimeShifter(ITvCardHandler cardHandler) : base(cardHandler) { _cardHandler = cardHandler; var layer = new TvBusinessLayer(); _linkageScannerEnabled = (layer.GetSetting("linkageScannerEnabled", "no").Value == "yes"); _linkageGrabber = new ChannelLinkageGrabber(cardHandler.Card); _timeshiftingEpgGrabberEnabled = (layer.GetSetting("timeshiftingEpgGrabberEnabled", "no").Value == "yes"); _timeAudioEvent = DateTime.MinValue; _timeVideoEvent = DateTime.MinValue; }
public void DoCopy() { try { string baseTs = Path.GetDirectoryName(_fileStart) + "\\" + Path.GetFileNameWithoutExtension(_fileStart).Substring(0, 19); Log.Info("TsCopier: baseTs: {0}", baseTs); int idCurrent = Int32.Parse(Path.GetFileNameWithoutExtension(_fileStart).Remove(0, 19)); int idStart = idCurrent; int idStop = Int32.Parse(Path.GetFileNameWithoutExtension(_fileEnd).Remove(0, 19)); TvBusinessLayer layer = new TvBusinessLayer(); decimal maxFiles = Convert.ToDecimal(layer.GetSetting("timeshiftMaxFiles", "20").Value); Log.Info("TsCopier: baseTs={0} idCurrent={1} idStop={2} maxFiles={3}", baseTs, idCurrent, idStop, maxFiles); Directory.CreateDirectory(Path.GetDirectoryName(_recording) + "\\" + Path.GetFileNameWithoutExtension(_recording) + "_tsbuffers"); int cycles = 1; if (idStop > idStart) cycles = (idStop - idStart) + 1; else if (idStop < idStart) cycles = (int)(maxFiles - idStart) + 1 + idStop; for (int i = idStart; i <= cycles; i++) { string currentSourceBuffer = baseTs + idCurrent.ToString() + ".ts"; string targetTs = Path.GetDirectoryName(_recording) + "\\" + Path.GetFileNameWithoutExtension(_recording) + "_tsbuffers\\" + Path.GetFileName(currentSourceBuffer); Log.Info("TsCopier: Copying - source: {0}, target: {1}", currentSourceBuffer, targetTs); FileStream reader = new FileStream(currentSourceBuffer, FileMode.Open, FileAccess.Read, FileShare.ReadWrite); FileStream writer = new FileStream(targetTs, FileMode.CreateNew, FileAccess.Write); reader.Seek(_posStart, SeekOrigin.Begin); byte[] buf = new byte[1024]; int bytesRead = reader.Read(buf, 0, 1024); while (bytesRead > 0) { if (reader.Position > _posEnd && currentSourceBuffer == _fileEnd) bytesRead -= (int)(reader.Position - _posEnd); if (bytesRead <= 0) break; writer.Write(buf, 0, bytesRead); bytesRead = reader.Read(buf, 0, 1024); } writer.Flush(); writer.Close(); writer.Dispose(); writer = null; reader.Close(); reader.Dispose(); reader = null; Log.Info("TsCopier: copying done."); idCurrent++; if (idCurrent > maxFiles) idCurrent = 1; } Log.Info("TsCopier: processed all timeshift buffer files for recording."); } catch (Exception ex) { Log.Write(ex); } }
private void LoadLanguages() { _loaded = true; mpListView2.BeginUpdate(); try { mpListView2.Items.Clear(); List<KeyValuePair<String, String>> languages = TvLibrary.Epg.Languages.Instance.GetLanguagePairs(); TvBusinessLayer layer = new TvBusinessLayer(); Setting setting = layer.GetSetting(languagesSettingsKey); foreach (KeyValuePair<String, String> language in languages) { ListViewItem item = new ListViewItem(new string[] { language.Value, language.Key }); mpListView2.Items.Add(item); item.Tag = language.Key; item.Checked = setting.Value.IndexOf((string)item.Tag) >= 0; } mpListView2.Sort(); } finally { mpListView2.EndUpdate(); } }
public override void OnSectionActivated() { _cards = Card.ListAll(); base.OnSectionActivated(); mpGroupBox1.Visible = false; RemoteControl.Instance.EpgGrabberEnabled = true; comboBoxGroups.Items.Clear(); IList<ChannelGroup> groups = ChannelGroup.ListAll(); foreach (ChannelGroup group in groups) comboBoxGroups.Items.Add(new ComboBoxExItem(group.GroupName, -1, group.IdGroup)); if (comboBoxGroups.Items.Count == 0) comboBoxGroups.Items.Add(new ComboBoxExItem("(no groups defined)", -1, -1)); comboBoxGroups.SelectedIndex = 0; timer1.Enabled = true; mpListView1.Items.Clear(); buttonRestart.Visible = false; mpButtonRec.Enabled = false; TvBusinessLayer layer = new TvBusinessLayer(); if (layer.GetSetting("idleEPGGrabberEnabled", "yes").Value != "yes") { mpButtonReGrabEpg.Enabled = false; } _channelNames = new Dictionary<int, string>(); IList<Channel> channels = Channel.ListAll(); foreach (Channel ch in channels) { _channelNames.Add(ch.IdChannel, ch.DisplayName); } }
public override void OnSectionActivated() { _needRestart = false; _ignoreEvents = true; TvBusinessLayer layer = new TvBusinessLayer(); base.OnSectionActivated(); listView1.Items.Clear(); ListViewGroup listGroup = listView1.Groups["listViewGroupAvailable"]; foreach (ITvServerPlugin plugin in _loader.Plugins) { ListViewItem item = listView1.Items.Add(""); item.Group = listGroup; item.SubItems.Add(plugin.Name); item.SubItems.Add(plugin.Author); item.SubItems.Add(plugin.Version); Setting setting = layer.GetSetting(String.Format("plugin{0}", plugin.Name), "false"); item.Checked = setting.Value == "true"; item.Tag = setting; } listGroup = listView1.Groups["listViewGroupIncompatible"]; foreach (Type plugin in _loader.IncompatiblePlugins) { ListViewItem item = listView1.Items.Add(""); item.Group = listGroup; item.SubItems.Add(plugin.Name); item.SubItems.Add("Unknown"); item.SubItems.Add(plugin.Assembly.GetName().Version.ToString()); item.Checked = false; } listView1.AutoResizeColumns(ColumnHeaderAutoResizeStyle.HeaderSize); _ignoreEvents = false; }
private void LoadLanguages() { _loaded = true; mpListView2.BeginUpdate(); try { mpListView2.Items.Clear(); TvLibrary.Epg.Languages languages = new TvLibrary.Epg.Languages(); List<String> codes = languages.GetLanguageCodes(); List<String> list = languages.GetLanguages(); TvBusinessLayer layer = new TvBusinessLayer(); Setting setting = layer.GetSetting(languagesSettingsKey); for (int j = 0; j < list.Count; j++) { ListViewItem item = new ListViewItem(new string[] { list[j], codes[j] }); mpListView2.Items.Add(item); item.Tag = codes[j]; item.Checked = setting.Value.IndexOf((string)item.Tag) >= 0; } mpListView2.Sort(); } finally { mpListView2.EndUpdate(); } }
public override void OnSectionDeActivated() { base.OnSectionDeActivated(); TvBusinessLayer layer = new TvBusinessLayer(); Setting s = layer.GetSetting("generalEPGAlwaysFillHoles", "no"); s.Value = checkBoxAlwaysFillHoles.Checked ? "yes" : "no"; s.Persist(); s = layer.GetSetting("generalEPGAlwaysReplace", "no"); s.Value = checkBoxAlwaysUpdate.Checked ? "yes" : "no"; s.Persist(); s = layer.GetSetting("generalGrapOnlyForSameTransponder", "no"); s.Value = checkboxSameTransponder.Checked ? "yes" : "no"; s.Persist(); DebugSettings.DisableCRCCheck = !checkBoxEnableCRCCheck.Checked; s = layer.GetSetting("idleEPGGrabberEnabled", "yes"); s.Value = checkBoxEnableEPGWhileIdle.Checked ? "yes" : "no"; s.Persist(); s = layer.GetSetting("timeoutEPG", "10"); s.Value = numericUpDownEpgTimeOut.Value.ToString(); s.Persist(); s = layer.GetSetting("timeoutEPGRefresh", "240"); s.Value = numericUpDownEpgRefresh.Value.ToString(); s.Persist(); s = layer.GetSetting("timeshiftingEpgGrabberEnabled", "no"); s.Value = checkBoxEnableEpgWhileTimeshifting.Checked ? "yes" : "no"; s.Persist(); s = layer.GetSetting("timeshiftingEpgGrabberTimeout", "2"); s.Value = numericUpDownTSEpgTimeout.Value.ToString(); s.Persist(); s = layer.GetSetting("epgTitleTemplate", "%TITLE%"); s.Value = edTitleTemplate.Text; s.Persist(); s = layer.GetSetting("epgDescriptionTemplate", "%DESCRIPTION%"); s.Value = edDescriptionTemplate.Text; s.Persist(); }
public bool AddSchedule(int channelId, String programName, DateTime startTime, DateTime endTime, int scheduleType, Int32 priority, Int32 keepmethod, DateTime keepdate, Int32 preRecordInterval, Int32 postRecordInterval) { try { TvBusinessLayer layer = new TvBusinessLayer(); TvDatabase.Schedule s = new TvDatabase.Schedule(channelId, programName, startTime, endTime); if (scheduleType < 0) { s.ScheduleType = (int)TvDatabase.ScheduleRecordingType.Once; } else { s.ScheduleType = scheduleType; } if (priority != -1) { s.Priority = priority; } if (keepmethod != -1) { s.KeepMethod = keepmethod; s.KeepDate = keepdate; } if ((preRecordInterval < 0) && (postRecordInterval < 0)) { //Use the settings from Mediaportal s.PreRecordInterval = Int32.Parse(layer.GetSetting("preRecordInterval", "5").Value); s.PostRecordInterval = Int32.Parse(layer.GetSetting("postRecordInterval", "5").Value); } else { // Use the settings from XBMC s.PreRecordInterval = preRecordInterval; s.PostRecordInterval = postRecordInterval; } s.Persist(); RemoteControl.Instance.OnNewSchedule(); return true; } catch { return false; } }
private void LoadSettings() { TvBusinessLayer layer = new TvBusinessLayer(); double timeout; if (!double.TryParse(layer.GetSetting("timeshiftingEpgGrabberTimeout", "2").Value, out timeout)) timeout = 2; _epgTimer.Interval = timeout * 60000; }
/// <summary> /// Initializes a new instance of the <see cref="TimeShifter"/> class. /// </summary> /// <param name="cardHandler">The card handler.</param> public TimeShifter(ITvCardHandler cardHandler) { _eventAudio.Reset(); _eventVideo.Reset(); _cardHandler = cardHandler; TvBusinessLayer layer = new TvBusinessLayer(); _linkageScannerEnabled = (layer.GetSetting("linkageScannerEnabled", "no").Value == "yes"); _linkageGrabber = new ChannelLinkageGrabber(cardHandler.Card); _timeshiftingEpgGrabberEnabled = (layer.GetSetting("timeshiftingEpgGrabberEnabled", "no").Value == "yes"); _waitForTimeshifting = Int32.Parse(layer.GetSetting("timeshiftWaitForTimeshifting", "15").Value); _timeAudioEvent = DateTime.MinValue; _timeVideoEvent = DateTime.MinValue; }
public override void LoadSettings() { TvBusinessLayer layer = new TvBusinessLayer(); numericUpDownMinFiles.Value = ValueSanityCheck( Convert.ToDecimal(layer.GetSetting("timeshiftMinFiles", "6").Value), 3, 100); numericUpDownMaxFiles.Value = ValueSanityCheck(Convert.ToDecimal(layer.GetSetting("timeshiftMaxFiles", "20").Value), 3, 100); numericUpDownMaxFileSize.Value = ValueSanityCheck(Convert.ToDecimal(layer.GetSetting("timeshiftMaxFileSize", "256").Value), 20, 1024); numericUpDownWaitUnscrambled.Value = ValueSanityCheck(Convert.ToDecimal(layer.GetSetting("timeshiftWaitForUnscrambled", "5").Value), 1, 30); numericUpDownWaitTimeshifting.Value = ValueSanityCheck(Convert.ToDecimal(layer.GetSetting("timeshiftWaitForTimeshifting", "15").Value), 1, 30); numericUpDownMaxFreeCardsToTry.Value = ValueSanityCheck( Convert.ToDecimal(layer.GetSetting("timeshiftMaxFreeCardsToTry", "0").Value), 0, 100); }
public override void OnSectionDeActivated() { TvBusinessLayer layer = new TvBusinessLayer(); Setting setting = layer.GetSetting("xmlTv"); setting.Value = textBoxFolder.Text; setting.Persist(); setting = layer.GetSetting("xmlTvUseTimeZone", "true"); setting.Value = checkBox1.Checked ? "true" : "false"; setting.Persist(); setting = layer.GetSetting("xmlTvImportXML", "true"); setting.Value = cbImportXML.Checked ? "true" : "false"; setting.Persist(); setting = layer.GetSetting("xmlTvImportLST", "true"); setting.Value = cbImportLST.Checked ? "true" : "false"; setting.Persist(); setting = layer.GetSetting("xmlTvTimeZoneHours", "0"); setting.Value = textBoxHours.Text; setting.Persist(); setting = layer.GetSetting("xmlTvTimeZoneMins", "0"); setting.Value = textBoxMinutes.Text; setting.Persist(); setting = layer.GetSetting("xmlTvDeleteBeforeImport", "true"); setting.Value = checkBoxDeleteBeforeImport.Checked ? "true" : "false"; setting.Persist(); setting = layer.GetSetting("xmlTvRemoteURL", "http://www.mysite.com/TVguide.xml"); setting.Value = txtRemoteURL.Text; setting.Persist(); setting = layer.GetSetting("xmlTvRemoteScheduleTime", "06:30"); DateTimeFormatInfo DTFI = new DateTimeFormatInfo(); DTFI.ShortDatePattern = _shortTimePattern24Hrs; DateTime xmlTvRemoteScheduleTime = dateTimePickerScheduler.Value; setting.Value = xmlTvRemoteScheduleTime.ToString("t", DTFI); setting.Persist(); setting = layer.GetSetting("xmlTvRemoteSchedulerEnabled", "false"); setting.Value = chkScheduler.Checked ? "true" : "false"; setting.Persist(); setting = layer.GetSetting("xmlTvRemoteSchedulerDownloadOnWakeUpEnabled", "false"); setting.Value = radioDownloadOnWakeUp.Checked ? "true" : "false"; setting.Persist(); base.OnSectionDeActivated(); }
static UserFactory() { var layer = new TvBusinessLayer(); try { _priorityEpg = (int)ValueSanityCheck( Convert.ToDecimal(layer.GetSetting(EPG_TAGNAME, EPG_PRIORITY.ToString()).Value), PRIORITY_MIN_VALUE, PRIORITY_MAX_VALUE); Log.Debug("UserFactory setting PriorityEPG : {0}", _priorityEpg); _priorityUser = (int)ValueSanityCheck( Convert.ToDecimal(layer.GetSetting(USER_TAGNAME, USER_PRIORITY.ToString()).Value), PRIORITY_MIN_VALUE, PRIORITY_MAX_VALUE); Log.Debug("UserFactory setting PriorityUser : {0}", _priorityUser); _priorityScheduler = (int)ValueSanityCheck( Convert.ToDecimal(layer.GetSetting(SCHEDULER_TAGNAME, SCHEDULER_PRIORITY.ToString()).Value), PRIORITY_MIN_VALUE, PRIORITY_MAX_VALUE); Log.Debug("UserFactory setting PriorityScheduler : {0}", _priorityScheduler); Setting setting = layer.GetSetting(CUSTOM_TAGNAME, ""); string[] users = setting.Value.Split(';'); foreach (string user in users) { string[] shareItem = user.Split(','); bool hasItems = shareItem.Length.Equals(2); if (hasItems) { string host = shareItem[0].Trim(); int priority; if (host.Length > 0 && Int32.TryParse(shareItem[1].Trim(), out priority)) { Log.Debug("UserFactory setting PriorityCustomUser : {0} - {1}", host, priority); _priorityCustomUsers[host] = priority; } } } } catch (Exception ex) { Log.Error("UserFactory - error reading priority settings from database", ex); } }
public override void OnSectionDeActivated() { TvBusinessLayer layer = new TvBusinessLayer(); Setting setting = layer.GetSetting("CMDebugMode", "false"); if (debug.Checked) setting.Value = "true"; else setting.Value = "false"; setting.Persist(); base.OnSectionDeActivated(); }
public override void OnSectionActivated() { base.OnSectionActivated(); TvBusinessLayer layer = new TvBusinessLayer(); checkBoxAlwaysFillHoles.Checked = (layer.GetSetting("generalEPGAlwaysFillHoles", "no").Value == "yes"); checkBoxAlwaysUpdate.Checked = (layer.GetSetting("generalEPGAlwaysReplace", "no").Value == "yes"); checkboxSameTransponder.Checked = (layer.GetSetting("generalGrapOnlyForSameTransponder", "no").Value == "yes"); checkBoxEnableEPGWhileIdle.Checked = (layer.GetSetting("idleEPGGrabberEnabled", "yes").Value == "yes"); checkBoxEnableCRCCheck.Checked = !DebugSettings.DisableCRCCheck; numericUpDownEpgTimeOut.Value = Convert.ToDecimal(layer.GetSetting("timeoutEPG", "10").Value); numericUpDownEpgRefresh.Value = Convert.ToDecimal(layer.GetSetting("timeoutEPGRefresh", "240").Value); checkBoxEnableEpgWhileTimeshifting.Checked = (layer.GetSetting("timeshiftingEpgGrabberEnabled", "no").Value == "yes"); numericUpDownTSEpgTimeout.Value = Convert.ToDecimal(layer.GetSetting("timeshiftingEpgGrabberTimeout", "2").Value); edTitleTemplate.Text = layer.GetSetting("epgTitleTemplate", "%TITLE%").Value; edDescriptionTemplate.Text = layer.GetSetting("epgDescriptionTemplate", "%DESCRIPTION%").Value; }
private void ProcessActiveHandler_OnPowerSchedulerEvent(PowerSchedulerEventArgs args) { switch (args.EventType) { case PowerSchedulerEventType.Started: case PowerSchedulerEventType.Elapsed: IPowerScheduler ps = GlobalServiceProvider.Instance.Get<IPowerScheduler>(); if (ps == null) return; PowerSetting setting = ps.Settings.GetSetting("Processes"); TvBusinessLayer layer = new TvBusinessLayer(); // Get processes to be monitored string processes = layer.GetSetting("PowerSchedulerProcesses").Value; // Split processes into processList elements List<string> processList = new List<string>(); foreach (string process in processes.Split(',')) processList.Add(process.Trim()); // If something has changed... if (!IsEqual(processList, setting.Get<List<string>>())) { setting.Set<List<string>>(processList); _processList = processList; Log.Debug("ProcessActiveHandler: Preventing standby for processes: {0}", processes); } // Check for MP client running? setting = ps.Settings.GetSetting("CheckForMPClientRunning"); _checkForMPClientRunning = Convert.ToBoolean(layer.GetSetting("PowerSchedulerCheckForMPClientRunning", "false").Value); if (setting.Get<bool>() != _checkForMPClientRunning) { setting.Set<bool>(_checkForMPClientRunning); Log.Debug("ProcessActiveHandler: Prevent standby when MP client is not running : {0}", _checkForMPClientRunning); } // Check if away mode should be used setting = ps.Settings.GetSetting("ProcessesAwayMode"); _useAwayMode = Convert.ToBoolean(layer.GetSetting("PowerSchedulerProcessesAwayMode", "false").Value); if (setting.Get<bool>() != _useAwayMode) { setting.Set<bool>(_useAwayMode); Log.Debug("ProcessActiveHandler: Use away mode: {0}", _useAwayMode); } break; } }
public void SetNewChannel(int idChannel) { TvBusinessLayer layer = new TvBusinessLayer(); _tsBufferExtractorSetup = layer.GetSetting("TsBufferExtractorSetup", "A").Value; _preRecordInterval = Decimal.Parse(layer.GetSetting("preRecordInterval", "5").Value); _snapshotBufferPosition = -1; _snapshotBufferFile = string.Empty; _snapshotBufferId = 0; Log.Debug("TsBufferExtractor: SetNewChannel({0})", idChannel); _idChannelToWatch = idChannel; StartTimer(); }
public override void SaveSettings() { var layer = new TvBusinessLayer(); Setting setting = layer.GetSetting("TsBufferExtractorSetup"); if (radioButton1.Checked) setting.Value = "A"; if (radioButton2.Checked) setting.Value = "B"; if (radioButton3.Checked) setting.Value = "C"; setting.Persist(); }
private void LoadLanguages() { _loaded = true; mpListView2.BeginUpdate(); try { mpListView2.Items.Clear(); TvLibrary.Epg.Languages languages = new TvLibrary.Epg.Languages(); List<String> codes = languages.GetLanguageCodes(); List<String> list = languages.GetLanguages(); TvBusinessLayer layer = new TvBusinessLayer(); Setting setting = layer.GetSetting("radioLanguages"); string values = ""; for (int j = 0; j < list.Count; j++) { ListViewItem item = new ListViewItem(new string[] { list[j], codes[j] }); mpListView2.Items.Add(item); item.Tag = codes[j]; if (setting.Value == "") { values += item.Tag; values += ","; } else { if (setting.Value.IndexOf((string)item.Tag) >= 0) { item.Checked = true; } } } mpListView2.Sort(); if (setting.Value == "") { setting.Value = values; setting.Persist(); //DatabaseManager.Instance.SaveChanges(); } } finally { mpListView2.EndUpdate(); } }
public override void LoadSettings() { var layer = new TvBusinessLayer(); tsBufferExtractorSetup = layer.GetSetting("TsBufferExtractorSetup", "A").Value; switch (tsBufferExtractorSetup) { case "A": radioButton1.Checked = true; break; case "B": radioButton2.Checked = true; break; case "C": radioButton3.Checked = true; break; } }
/// <summary> /// ctor /// </summary> public TvCardCollection(IEpgEvents epgEvents) { Log.Log.WriteFile("----------------------------"); _epgEvents = epgEvents; // Logic here to delay detection of cards // Ideally this should occur after standby event. TvBusinessLayer layer = new TvBusinessLayer(); Setting setting = layer.GetSetting("delayCardDetect", "0"); int delayDetect = Convert.ToInt32(setting.Value); if (delayDetect >= 1) { Log.Log.WriteFile("Detecting Cards in {0} seconds", delayDetect); System.Threading.Thread.Sleep(delayDetect * 1000); } Log.Log.WriteFile("Detecting Cards"); _cards = new List<ITVCard>(); DetectCards(); }
protected ITvSubChannel _subchannel; // the active sub channel to record protected TimeShifterBase(ITvCardHandler cardHandler) { _eventAudio.Reset(); _eventVideo.Reset(); var layer = new TvBusinessLayer(); _waitForTimeshifting = Int32.Parse(layer.GetSetting("timeshiftWaitForTimeshifting", "15").Value); if (_cardHandler != null && _cardHandler.Tuner != null) { _cardHandler.Tuner.OnAfterCancelTuneEvent += Tuner_OnAfterCancelTuneEvent; } if (_cardHandler != null && _cardHandler.Tuner != null) { _cardHandler.Tuner.OnAfterCancelTuneEvent += new CardTuner.OnAfterCancelTuneDelegate(Tuner_OnAfterCancelTuneEvent); } }
/// <summary> /// This method checks the diskspace on each harddisk /// if the diskspace used by recordings exceeds the disk quota set on the drive /// then this method will delete recordings until the disk quota is not exceeded anymore /// </summary> /// <remarks>Note, this method will run once every 15 minutes /// </remarks> private static void CheckFreeDiskSpace() { //check diskspace every 15 minutes... TvBusinessLayer layer = new TvBusinessLayer(); if (!(layer.GetSetting("diskQuotaEnabled", "False").Value == "True")) { //Disk Quota Management disabled: quitting return; } Log.Write("DiskManagement: checking free disk space"); //first get all drives.. List<string> drives = GetDisks(); // next check diskspace on each drive. foreach (string drive in drives) { CheckDriveFreeDiskSpace(drive); } }
public override void OnSectionActivated() { TvBusinessLayer layer = new TvBusinessLayer(); comboBoxType.SelectedIndex = Convert.ToInt16(layer.GetSetting("SrvBlasterType", "0").Value); comboBoxSpeed.SelectedIndex = Convert.ToInt16(layer.GetSetting("SrvBlasterSpeed", "0").Value); comboBoxBlaster1.Items.Clear(); comboBoxBlaster2.Items.Clear(); comboBoxBlaster1.Items.Add("None"); comboBoxBlaster2.Items.Add("None"); for (int i = 0; i < layer.Cards.Count; ++i) { Card card = layer.Cards[i]; comboBoxBlaster1.Items.Add(card.Name); comboBoxBlaster2.Items.Add(card.Name); } Log.WriteFile("CB1Size {0}, CB2Size {1}, BT1 {2}, BT2 {3}", comboBoxBlaster1.Items.Count, comboBoxBlaster1.Items.Count, Convert.ToInt16(layer.GetSetting("SrvBlaster1Card", "0").Value), Convert.ToInt16(layer.GetSetting("SrvBlaster2Card", "0").Value)); comboBoxBlaster1.SelectedIndex = Convert.ToInt16(layer.GetSetting("SrvBlaster1Card", "0").Value); comboBoxBlaster2.SelectedIndex = Convert.ToInt16(layer.GetSetting("SrvBlaster2Card", "0").Value); checkBoxExtLog.Checked = (layer.GetSetting("SrvBlasterLog").Value == "True"); checkSendSelect.Checked = (layer.GetSetting("SrvBlasterSendSelect").Value == "True"); }