public void Run() { SatelliteDatabase satelliteDatabase = new SatelliteDatabase(); satelliteDatabase.Load(); TVDatabase tvDatabase = new TVDatabase(); tvDatabase.Load(); epgDatabase = new EPGDatabase(); epgDatabase.Load(); Collection<TuningSpec> tuningCollection = new Collection<TuningSpec>(); foreach (TVStation tvStation in tvDatabase.StationCollection) { TuningSpec tuningSpec = findTuningSpec(tuningCollection, tvStation); if (tuningSpec == null) { TuningSpec newTuningSpec = new TuningSpec(); newTuningSpec.Satellite = tvStation.Satellite; newTuningSpec.OriginalNetworkID = tvStation.OriginalNetworkID; newTuningSpec.TransportStreamID = tvStation.TransportStreamID; newTuningSpec.Frequency = tvStation.Frequency; newTuningSpec.SymbolRate = tvStation.SymbolRate; newTuningSpec.Tag = new EPGGraph(satelliteDatabase[tvStation.Satellite], newTuningSpec); tuningCollection.Add(newTuningSpec); } } bool end = false; DateTime lastUpdateTime = DateTime.Now; TimeSpan interval = new TimeSpan(0, 1, 0); while (!end) { foreach (TuningSpec tuningSpec in tuningCollection) { EPGGraph currentGraph = tuningSpec.Tag as EPGGraph; currentGraph.Play(); EITController eitController = new EITController(); while (!eitController.Finished && !end) { Collection<EITEntry> eitCollection = eitController.ProcessEITSections(currentGraph); updateSchedule(eitCollection); if (lastUpdateTime + interval < DateTime.Now) { epgDatabase.UpdateDatabase(); lastUpdateTime = DateTime.Now; } } currentGraph.Stop(); } Thread.Sleep(2000); } }
private void ExternalChannels_Load(object sender, EventArgs e) { ArrayList cards = new ArrayList(); TVDatabase.GetCards(ref cards); if (cards.Count == 0) { cards.Add(0); } _tvCardTabs = new TabPage[cards.Count]; _tvCardStbSetups = new StbSetup[cards.Count]; comboBoxCopyFrom.Items.Clear(); int index = 0; foreach (int cardId in cards) { string cardName = String.Format("TV Card {0}", cardId); comboBoxCopyFrom.Items.Add(cardName); _tvCardStbSetups[index] = new StbSetup(cardId); _tvCardStbSetups[index].Name = "StbSetup" + index; _tvCardStbSetups[index].Dock = DockStyle.Fill; _tvCardTabs[index] = new TabPage(cardName); _tvCardTabs[index].Controls.Add(_tvCardStbSetups[index]); tabControlTVCards.TabPages.Add(_tvCardTabs[index]); index++; } comboBoxCopyFrom.SelectedIndex = 0; // Setup quick setup combo box string[] quickSetupFiles = Directory.GetFiles(Common.FolderSTB, "*.xml", SearchOption.TopDirectoryOnly); foreach (string file in quickSetupFiles) { comboBoxQuickSetup.Items.Add(Path.GetFileNameWithoutExtension(file)); } comboBoxQuickSetup.Items.Add("Clear all"); }
/// <summary> /// Load external channel configurations. /// </summary> private static void LoadExternalConfigs() { ArrayList cards = new ArrayList(); TVDatabase.GetCards(ref cards); if (cards.Count == 0) { Log.Warn("TV2BlasterPlugin: Cannot load external channel configurations, there are no TV cards registered"); cards.Add(0); } _externalChannelConfigs = new ExternalChannelConfig[cards.Count]; int index = 0; foreach (int cardId in cards) { string fileName = Path.Combine(ExtCfgFolder, String.Format("ExternalChannelConfig{0}.xml", cardId)); try { _externalChannelConfigs[index] = ExternalChannelConfig.Load(fileName); } catch (Exception ex) { Log.Error(ex); _externalChannelConfigs[index] = new ExternalChannelConfig(fileName); } _externalChannelConfigs[index].CardId = cardId; index++; } }
public void Run() { SatelliteDatabase satelliteDatabase = new SatelliteDatabase(); satelliteDatabase.Load(); TVDatabase tvDatabase = new TVDatabase(); tvDatabase.Load(); epgDatabase = new EPGDatabase(); epgDatabase.Load(); Collection <TuningSpec> tuningCollection = new Collection <TuningSpec>(); foreach (TVStation tvStation in tvDatabase.StationCollection) { TuningSpec tuningSpec = findTuningSpec(tuningCollection, tvStation); if (tuningSpec == null) { TuningSpec newTuningSpec = new TuningSpec(); newTuningSpec.Satellite = tvStation.Satellite; newTuningSpec.OriginalNetworkID = tvStation.OriginalNetworkID; newTuningSpec.TransportStreamID = tvStation.TransportStreamID; newTuningSpec.Frequency = tvStation.Frequency; newTuningSpec.SymbolRate = tvStation.SymbolRate; newTuningSpec.Tag = new EPGGraph(satelliteDatabase[tvStation.Satellite], newTuningSpec); tuningCollection.Add(newTuningSpec); } } bool end = false; DateTime lastUpdateTime = DateTime.Now; TimeSpan interval = new TimeSpan(0, 1, 0); while (!end) { foreach (TuningSpec tuningSpec in tuningCollection) { EPGGraph currentGraph = tuningSpec.Tag as EPGGraph; currentGraph.Play(); EITController eitController = new EITController(); while (!eitController.Finished && !end) { Collection <EITEntry> eitCollection = eitController.ProcessEITSections(currentGraph); updateSchedule(eitCollection); if (lastUpdateTime + interval < DateTime.Now) { epgDatabase.UpdateDatabase(); lastUpdateTime = DateTime.Now; } } currentGraph.Stop(); } Thread.Sleep(2000); } }