public void SaveGuideDataInArgusTV(ImportGuideChannel channel, ChannelType channelType, GuideProgram[] guideProgramData, bool updateChannelName) { if (guideProgramData.Length > 0) { using (GuideServiceAgent guideServiceAgent = new GuideServiceAgent()) { using (SchedulerServiceAgent schedulerServiceAgent = new SchedulerServiceAgent()) { Guid guideChannelId = EnsureDefaultChannel(channel, channelType, updateChannelName); foreach (GuideProgram guideProgram in guideProgramData) { guideProgram.GuideChannelId = guideChannelId; try { guideServiceAgent.ImportProgram(guideProgram, GuideSource.XmlTv); } catch { } } } } } }
public void SaveGuideDataInArgusTV(ImportGuideChannel channel, ChannelType channelType, GuideProgram[] guideProgramData, bool updateChannelName ) { if (guideProgramData.Length > 0) { using (GuideServiceAgent guideServiceAgent = new GuideServiceAgent()) { using (SchedulerServiceAgent schedulerServiceAgent = new SchedulerServiceAgent()) { Guid guideChannelId = EnsureDefaultChannel(channel, channelType, updateChannelName); foreach (GuideProgram guideProgram in guideProgramData) { guideProgram.GuideChannelId = guideChannelId; try { guideServiceAgent.ImportProgram(guideProgram, GuideSource.XmlTv); } catch { } } } } } }
protected override void Run() { Thread.Sleep(5 * 1000); lock (_guideProgramsToImportLock) { _newProgramsToImportEvent = new AutoResetEvent(false); } try { int interval = 1 * 60 * 1000; #if DEBUG interval = 5000; #endif bool aborted = false; while (!aborted) { try { List <GuideProgram> guidePrograms = GetProgramsToImport(); while (guidePrograms != null) { using (GuideServiceAgent tvGuideAgent = new GuideServiceAgent()) { Log.Debug("ArgusTV.Recorder.MediaPortalTvServer: ArgusTVDvbEpg: importing {0} programs into ARGUS TV", guidePrograms.Count); foreach (GuideProgram guideProgram in guidePrograms) { tvGuideAgent.ImportProgram(guideProgram, GuideSource.DvbEpg); aborted = this.StopThreadEvent.WaitOne(0, false); if (aborted) { break; } } } aborted = this.StopThreadEvent.WaitOne(0); if (aborted) { break; } guidePrograms = GetProgramsToImport(); } if (!aborted) { aborted = (0 == WaitHandle.WaitAny(new WaitHandle[] { this.StopThreadEvent, _newProgramsToImportEvent }, interval, false)); } } catch (Exception ex) { Log.Error("ArgusTVDvbEpg error: {0}", ex.Message); // Delay for a short while and then restart. aborted = this.StopThreadEvent.WaitOne(30 * 1000, false); } } } finally { lock (_guideProgramsToImportLock) { _newProgramsToImportEvent.Close(); _newProgramsToImportEvent = null; } } }
protected override void Run() { Thread.Sleep(5 * 1000); lock (_guideProgramsToImportLock) { _newProgramsToImportEvent = new AutoResetEvent(false); } try { int interval = 1 * 60 * 1000; #if DEBUG interval = 5000; #endif bool aborted = false; while (!aborted) { try { List<GuideProgram> guidePrograms = GetProgramsToImport(); while (guidePrograms != null) { using (GuideServiceAgent tvGuideAgent = new GuideServiceAgent()) { Log.Debug("ArgusTV.Recorder.MediaPortalTvServer: ArgusTVDvbEpg: importing {0} programs into ARGUS TV", guidePrograms.Count); foreach (GuideProgram guideProgram in guidePrograms) { tvGuideAgent.ImportProgram(guideProgram, GuideSource.DvbEpg); aborted = this.StopThreadEvent.WaitOne(0, false); if (aborted) { break; } } } aborted = this.StopThreadEvent.WaitOne(0); if (aborted) { break; } guidePrograms = GetProgramsToImport(); } if (!aborted) { aborted = (0 == WaitHandle.WaitAny(new WaitHandle[] { this.StopThreadEvent, _newProgramsToImportEvent }, interval, false)); } } catch (Exception ex) { Log.Error("ArgusTVDvbEpg error: {0}", ex.Message); // Delay for a short while and then restart. aborted = this.StopThreadEvent.WaitOne(30 * 1000, false); } } } finally { lock (_guideProgramsToImportLock) { _newProgramsToImportEvent.Close(); _newProgramsToImportEvent = null; } } }