private void addChannelInNameOrder(Collection <Channel> sortedChannels, Channel newChannel) { TVStation newStation = TVStation.FindStation(newChannel.OriginalNetworkID, newChannel.TransportStreamID, newChannel.ServiceID); if (newStation == null) { newStation = new TVStation("No Name"); } foreach (Channel oldChannel in sortedChannels) { TVStation oldStation = TVStation.FindStation(oldChannel.OriginalNetworkID, oldChannel.TransportStreamID, oldChannel.ServiceID); if (oldStation == null) { oldStation = new TVStation("No Name"); } if (oldStation.Name.CompareTo(newStation.Name) > 0) { sortedChannels.Insert(sortedChannels.IndexOf(oldChannel), newChannel); return; } } sortedChannels.Add(newChannel); }
/// <summary> /// Create the EPG entries. /// </summary> public override void FinishFrequency() { if (RunParameters.Instance.ChannelBouquet != -1) { foreach (TVStation tvStation in TVStation.StationCollection) { bool process = checkChannelMapping(tvStation); if (!process) { tvStation.EPGCollection.Clear(); } } } else { foreach (Bouquet bouquet in Bouquet.Bouquets) { foreach (Region region in bouquet.Regions) { foreach (Channel channel in region.Channels) { TVStation station = TVStation.FindStation(channel.OriginalNetworkID, channel.TransportStreamID, channel.ServiceID); if (station != null && station.LogicalChannelNumber == -1) { station.LogicalChannelNumber = channel.UserChannel; } } } } } EITProgramContent.LogContentUsage(); LanguageCode.LogUsage(); logChannelInfo(); }
/// <summary> /// Get a description of this instance. /// </summary> /// <returns>A string describing this instance.</returns> public override string ToString() { TVStation station = TVStation.FindStation(OriginalNetworkID, TransportStreamID, ServiceID); string stationName; if (station != null) { stationName = station.Name; } else { stationName = "** No Station **"; } string unknownString; if (unknown == null) { unknownString = "n/a"; } else { unknownString = Utils.ConvertToHex(unknown); } return("ONID " + OriginalNetworkID + " TSID " + TransportStreamID + " SID " + ServiceID + " Channel ID: " + ChannelID + " Unknown: " + unknownString + " Name: " + channelName + " Station: " + stationName); }
/// <summary> /// Create the EPG entries. /// </summary> public override void FinishFrequency() { if (MediaHighwayChannel.Channels.Count == 0) { return; } Logger titleLogger = null; Logger descriptionLogger = null; if (RunParameters.Instance.DebugIDs.Contains("LOGTITLES")) { titleLogger = new Logger("EPG Titles.log"); } if (RunParameters.Instance.DebugIDs.Contains("LOGDESCRIPTIONS")) { descriptionLogger = new Logger("EPG Descriptions.log"); } foreach (MediaHighwayChannel channel in MediaHighwayChannel.Channels) { TVStation station = TVStation.FindStation(channel.OriginalNetworkID, channel.TransportStreamID, channel.ServiceID); if (station == null) { station = new TVStation(channel.ChannelName); station.OriginalNetworkID = channel.OriginalNetworkID; station.TransportStreamID = channel.TransportStreamID; station.ServiceID = channel.ServiceID; TVStation.AddStation(station); } station.Name = channel.ChannelName; if (station.LogicalChannelNumber == -1) { station.LogicalChannelNumber = channel.UserChannel; } if (station.EPGCollection.Count == 0) { channel.ProcessChannelForEPG(station, titleLogger, descriptionLogger, CollectionType.MediaHighway2); } } MediaHighwayProgramCategory.LogCategories(); Channel.LogChannelsInChannelOrder(); }
/// <summary> /// Get a description of this instance. /// </summary> /// <returns>A string describing this instance.</returns> public override string ToString() { TVStation station = TVStation.FindStation(originalNetworkID, transportStreamID, serviceID); string stationName; if (station != null) { stationName = station.Name; } else { stationName = "** No Station **"; } return("ONID " + OriginalNetworkID + " TSID " + TransportStreamID + " SID " + ServiceID + " Channel ID: " + ChannelID + " User Channel: " + UserChannel + " Bouquet: " + BouquetID + " Region: " + Region + " Station: " + stationName); }
/// <summary> /// Log all the channel mappings. /// </summary> /// <param name="logger">The logger instance to be used.</param> public void LogChannelMapping(Logger logger) { TVStation station = TVStation.FindStation(OriginalNetworkID, TransportStreamID, ServiceID); string stationName; if (station != null) { stationName = station.Name; } else { stationName = "** No Station **"; } logger.Write("Channel: ONID " + OriginalNetworkID + " TSID " + TransportStreamID + " SID " + ServiceID + " Channel ID: " + ChannelID + " User Channel: " + UserChannel + " Bouquet: " + BouquetID + " Region: " + Region + " Name: " + stationName); }
/// <summary> /// Create the EPG entries. /// </summary> public override void FinishFrequency() { if (MediaHighwayChannel.Channels.Count == 0) { return; } foreach (MediaHighwaySummary summary in MediaHighwaySummary.Summaries) { if (summary.Replays != null) { MediaHighwayChannelTitle title = MediaHighwayChannel.FindChannelTitle(summary.EventID); if (title != null) { foreach (MediaHighway1Replay replay in summary.Replays) { MediaHighwayTitle replayTitle = new MediaHighwayTitle(); replayTitle.EventID = title.Title.EventID; replayTitle.EventName = title.Title.EventName; replayTitle.CategoryID = title.Title.CategoryID; replayTitle.StartTime = replay.ReplayTime; replayTitle.Duration = title.Title.Duration; replayTitle.SummaryAvailable = true; replayTitle.PreviousPlayDate = title.Title.StartTime; ((MediaHighwayChannel)Channel.FindChannel(replay.Channel)).AddTitleData(replayTitle); if (RunParameters.Instance.DebugIDs.Contains("REPLAYS")) { Logger.Instance.Write("Replay: ch" + replay.Channel + " " + title.Title.EventName + " " + title.Title.StartTime + " " + title.Title.Duration + " " + replay.ReplayTime); } } } } } Logger titleLogger = null; Logger descriptionLogger = null; if (RunParameters.Instance.DebugIDs.Contains("LOGTITLES")) { titleLogger = new Logger("EPG Titles.log"); } if (RunParameters.Instance.DebugIDs.Contains("LOGDESCRIPTIONS")) { descriptionLogger = new Logger("EPG Descriptions.log"); } foreach (MediaHighwayChannel channel in MediaHighwayChannel.Channels) { TVStation station = TVStation.FindStation(channel.OriginalNetworkID, channel.TransportStreamID, channel.ServiceID); if (station == null) { station = new TVStation(channel.ChannelName); station.OriginalNetworkID = channel.OriginalNetworkID; station.TransportStreamID = channel.TransportStreamID; station.ServiceID = channel.ServiceID; TVStation.AddStation(station); } station.Name = channel.ChannelName; if (station.LogicalChannelNumber == -1) { station.LogicalChannelNumber = channel.UserChannel; } if (station.EPGCollection.Count == 0) { channel.ProcessChannelForEPG(station, titleLogger, descriptionLogger, CollectionType.MediaHighway1); } } MediaHighwayProgramCategory.LogCategories(); Channel.LogChannelsInChannelOrder(); }
/// <summary> /// Create the EPG entries. /// </summary> public override void FinishFrequency() { if (RunParameters.Instance.DebugIDs.Contains("LOGPSIPEXTENDEDTEXT")) { ExtendedTextTable.LogEntries(); } AtscPsipProgramCategory.LogCategoryUsage(); if (VirtualChannelTable.Channels.Count == 0) { return; } Logger titleLogger = null; Logger descriptionLogger = null; if (RunParameters.Instance.DebugIDs.Contains("LOGTITLES")) { titleLogger = new Logger("EPG Titles.log"); } if (RunParameters.Instance.DebugIDs.Contains("LOGDESCRIPTIONS")) { descriptionLogger = new Logger("EPG Descriptions.log"); } foreach (VirtualChannel channel in VirtualChannelTable.Channels) { TVStation station = TVStation.FindStation(channel.CollectionFrequency, channel.MajorChannelNumber, channel.MinorChannelNumber); if (station == null) { station = new TVStation(channel.ShortName); station.OriginalNetworkID = channel.CollectionFrequency; station.TransportStreamID = channel.MajorChannelNumber; station.ServiceID = channel.MinorChannelNumber; station.ChannelID = channel.MajorChannelNumber + ":" + channel.MinorChannelNumber + ":" + channel.ShortName; TVStation.AddStation(station); } station.Name = channel.ShortName; if (station.LogicalChannelNumber == -1) { station.LogicalChannelNumber = (channel.MajorChannelNumber * 100) + channel.MinorChannelNumber; } station.MinorChannelNumber = channel.MinorChannelNumber; if (station.EPGCollection.Count == 0) { foreach (EPGEntry epgEntry in channel.EPGCollection) { station.EPGCollection.Add(epgEntry); if (titleLogger != null) { titleLogger.Write(epgEntry.ServiceID + " " + epgEntry.StartTime.ToShortDateString() + " " + epgEntry.StartTime.ToString("HH:mm") + " - " + epgEntry.StartTime.Add(epgEntry.Duration).ToString("HH:mm") + " " + epgEntry.EventName); } if (descriptionLogger != null && epgEntry.ShortDescription != null) { descriptionLogger.Write(epgEntry.ServiceID + " " + " Evt ID " + epgEntry.EventID + epgEntry.StartTime.ToShortDateString() + " " + epgEntry.StartTime.ToString("HH:mm") + " - " + epgEntry.StartTime.Add(epgEntry.Duration).ToString("HH:mm") + " " + epgEntry.ShortDescription); } } } } }
/// <summary> /// Parse the section. /// </summary> /// <param name="byteData">The MPEG2 section containing the section.</param> /// <param name="mpeg2Header">The MPEG2 header that preceedes the section.</param> public void Process(byte[] byteData, Mpeg2ExtendedHeader mpeg2Header) { lastIndex = mpeg2Header.Index; serviceID = mpeg2Header.TableIDExtension; try { transportStreamID = Utils.Convert2BytesToInt(byteData, lastIndex); lastIndex += 2; originalNetworkID = Utils.Convert2BytesToInt(byteData, lastIndex); lastIndex += 2; segmentLastSectionNumber = (int)byteData[lastIndex]; lastIndex++; lastTableID = (int)byteData[lastIndex]; lastIndex++; } catch (IndexOutOfRangeException) { throw (new ArgumentOutOfRangeException("The Bell TV section is short")); } TVStation tvStation = TVStation.FindStation(originalNetworkID, transportStreamID, serviceID); if (tvStation == null) { if (!RunParameters.Instance.DebugIDs.Contains("CREATESTATIONS")) { return; } else { tvStation = new TVStation("Auto Generated Station: " + originalNetworkID + ":" + transportStreamID + ":" + serviceID); tvStation.OriginalNetworkID = originalNetworkID; tvStation.TransportStreamID = transportStreamID; tvStation.ServiceID = serviceID; TVStation.StationCollection.Add(tvStation); } } bool newSection = tvStation.AddMapEntry(mpeg2Header.TableID, mpeg2Header.SectionNumber, lastTableID, mpeg2Header.LastSectionNumber, segmentLastSectionNumber); if (!newSection) { return; } while (lastIndex < byteData.Length - 4) { BellTVEntry bellTVEntry = new BellTVEntry(); bellTVEntry.Process(byteData, lastIndex, mpeg2Header.TableID); EPGEntry epgEntry = new EPGEntry(); epgEntry.OriginalNetworkID = tvStation.OriginalNetworkID; epgEntry.TransportStreamID = tvStation.TransportStreamID; epgEntry.ServiceID = tvStation.ServiceID; epgEntry.EPGSource = EPGSource.BellTV; if (bellTVEntry.HighDefinition) { epgEntry.VideoQuality = "HDTV"; } if (bellTVEntry.ClosedCaptions) { epgEntry.SubTitles = "teletext"; } if (bellTVEntry.Stereo) { epgEntry.AudioQuality = "stereo"; } epgEntry.Duration = Utils.RoundTime(bellTVEntry.Duration); epgEntry.EventID = bellTVEntry.EventID; epgEntry.EventName = bellTVEntry.EventName; getParentalRating(epgEntry, bellTVEntry); epgEntry.RunningStatus = bellTVEntry.RunningStatus; epgEntry.Scrambled = bellTVEntry.Scrambled; epgEntry.ShortDescription = bellTVEntry.ShortDescription; if (bellTVEntry.SubTitle != bellTVEntry.EventName) { epgEntry.EventSubTitle = bellTVEntry.SubTitle; } epgEntry.StartTime = Utils.RoundTime(TimeOffsetEntry.GetOffsetTime(bellTVEntry.StartTime)); epgEntry.EventCategory = getEventCategory(epgEntry.EventName, epgEntry.ShortDescription, bellTVEntry.ContentType, bellTVEntry.ContentSubType); epgEntry.StarRating = getStarRating(bellTVEntry); epgEntry.Date = bellTVEntry.Date; epgEntry.Cast = bellTVEntry.Cast; getSeriesEpisode(epgEntry, bellTVEntry.Series, bellTVEntry.Episode); epgEntry.HasGraphicLanguage = bellTVEntry.HasStrongLanguage; epgEntry.HasStrongSexualContent = bellTVEntry.HasSexualContent; epgEntry.HasGraphicViolence = bellTVEntry.HasViolence; epgEntry.HasNudity = bellTVEntry.HasNudity; epgEntry.PreviousPlayDate = bellTVEntry.OriginalAirDate; tvStation.AddEPGEntry(epgEntry); if (titleLogger != null) { logTitle(bellTVEntry.EventName, epgEntry, titleLogger); } if (descriptionLogger != null) { if (!RunParameters.Instance.DebugIDs.Contains("LOGORIGINAL")) { logDescription(bellTVEntry.ShortDescription, epgEntry, descriptionLogger); } else { logDescription(bellTVEntry.OriginalDescription, epgEntry, descriptionLogger); } } lastIndex = bellTVEntry.Index; } }
/// <summary> /// Parse the section. /// </summary> /// <param name="byteData">The MPEG2 section containing the section.</param> /// <param name="mpeg2Header">The MPEG2 header that preceedes the section.</param> public void Process(byte[] byteData, Mpeg2ExtendedHeader mpeg2Header) { lastIndex = mpeg2Header.Index; serviceID = mpeg2Header.TableIDExtension; transportStreamID = Utils.Convert2BytesToInt(byteData, lastIndex); lastIndex += 2; originalNetworkID = Utils.Convert2BytesToInt(byteData, lastIndex); lastIndex += 2; segmentLastSectionNumber = (int)byteData[lastIndex]; lastIndex++; lastTableID = (int)byteData[lastIndex]; lastIndex++; TVStation tvStation = TVStation.FindStation(originalNetworkID, transportStreamID, serviceID); if (tvStation == null) { if (!RunParameters.Instance.DebugIDs.Contains("CREATESTATIONS")) { return; } else { tvStation = new TVStation("Auto Generated Station: " + originalNetworkID + ":" + transportStreamID + ":" + serviceID); tvStation.OriginalNetworkID = originalNetworkID; tvStation.TransportStreamID = transportStreamID; tvStation.ServiceID = serviceID; TVStation.StationCollection.Add(tvStation); } } bool newSection = tvStation.AddMapEntry(mpeg2Header.TableID, mpeg2Header.SectionNumber, lastTableID, mpeg2Header.LastSectionNumber, segmentLastSectionNumber); if (!newSection) { return; } while (lastIndex < byteData.Length - 4) { EITEntry eitEntry = new EITEntry(); eitEntry.Process(byteData, lastIndex); if (eitEntry.StartTime != DateTime.MinValue) { EPGEntry epgEntry = new EPGEntry(); epgEntry.OriginalNetworkID = tvStation.OriginalNetworkID; epgEntry.TransportStreamID = tvStation.TransportStreamID; epgEntry.ServiceID = tvStation.ServiceID; epgEntry.EPGSource = EPGSource.EIT; switch (eitEntry.ComponentTypeAudio) { case 3: epgEntry.AudioQuality = "stereo"; break; case 5: epgEntry.AudioQuality = "dolby digital"; break; default: break; } if (eitEntry.ComponentTypeVideo > 9) { epgEntry.VideoQuality = "HDTV"; } if (!RunParameters.Instance.Options.Contains("USEDESCASCATEGORY")) { epgEntry.EventCategory = getEventCategory(eitEntry.EventName, eitEntry.Description, eitEntry.ContentType, eitEntry.ContentSubType); } else { epgEntry.EventCategory = eitEntry.ShortDescription; } epgEntry.Duration = Utils.RoundTime(eitEntry.Duration); epgEntry.EventID = eitEntry.EventID; epgEntry.EventName = eitEntry.EventName; if (RunParameters.Instance.CountryCode != null) { epgEntry.ParentalRating = ParentalRating.FindRating(RunParameters.Instance.CountryCode, "EIT", (eitEntry.ParentalRating + 3).ToString()); epgEntry.MpaaParentalRating = ParentalRating.FindMpaaRating(RunParameters.Instance.CountryCode, "EIT", (eitEntry.ParentalRating + 3).ToString()); } else { if (eitEntry.ParentalRating > 11) { epgEntry.ParentalRating = "AO"; epgEntry.MpaaParentalRating = "AO"; } else { if (eitEntry.ParentalRating > 8) { epgEntry.ParentalRating = "PGR"; epgEntry.MpaaParentalRating = "PG"; } else { epgEntry.ParentalRating = "G"; epgEntry.MpaaParentalRating = "G"; } } } epgEntry.RunningStatus = eitEntry.RunningStatus; epgEntry.Scrambled = eitEntry.Scrambled; if (!RunParameters.Instance.Options.Contains("USEDESCASCATEGORY")) { epgEntry.ShortDescription = eitEntry.Description; } else { epgEntry.ShortDescription = eitEntry.ExtendedDescription; } epgEntry.StartTime = Utils.RoundTime(TimeOffsetEntry.GetOffsetTime(eitEntry.StartTime)); epgEntry.Cast = eitEntry.Cast; epgEntry.Directors = eitEntry.Directors; epgEntry.Date = eitEntry.Year; if (eitEntry.TVRating != null) { epgEntry.ParentalRating = eitEntry.TVRating; } epgEntry.StarRating = eitEntry.StarRating; if (eitEntry.TVRating != null) { epgEntry.ParentalRating = eitEntry.TVRating; } setSeriesEpisode(epgEntry, eitEntry); /*if (eitEntry.PreviousPlayDate != null) * { * try * { * TimeSpan offset = new TimeSpan(Int32.Parse(eitEntry.PreviousPlayDate) * TimeSpan.TicksPerSecond); * epgEntry.PreviousPlayDate = epgEntry.StartTime - offset; * } * catch (FormatException) { } * }*/ epgEntry.Country = eitEntry.Country; tvStation.AddEPGEntry(epgEntry); if (titleLogger != null) { logTitle(eitEntry.EventName, eitEntry, epgEntry, titleLogger); } if (descriptionLogger != null) { logTitle(eitEntry.Description, eitEntry, epgEntry, descriptionLogger); } if (RunParameters.Instance.DebugIDs.Contains("CATXREF")) { updateCategoryEntries(tvStation, eitEntry); } } lastIndex = eitEntry.Index; } }
/// <summary> /// Parse the section. /// </summary> /// <param name="byteData">The MPEG2 section containing the section.</param> /// <param name="mpeg2Header">The MPEG2 header that preceedes the section.</param> public void Process(byte[] byteData, Mpeg2ExtendedHeader mpeg2Header) { lastIndex = mpeg2Header.Index; serviceID = mpeg2Header.TableIDExtension; try { transportStreamID = Utils.Convert2BytesToInt(byteData, lastIndex); lastIndex += 2; originalNetworkID = Utils.Convert2BytesToInt(byteData, lastIndex); lastIndex += 2; segmentLastSectionNumber = (int)byteData[lastIndex]; lastIndex++; lastTableID = (int)byteData[lastIndex]; lastIndex++; } catch (IndexOutOfRangeException) { throw (new ArgumentOutOfRangeException("The FreeSat EIT section is short")); } TVStation tvStation = TVStation.FindStation(originalNetworkID, transportStreamID, serviceID); if (tvStation == null) { return; } bool newSection = tvStation.AddMapEntry(mpeg2Header.TableID, mpeg2Header.SectionNumber, lastTableID, mpeg2Header.LastSectionNumber, segmentLastSectionNumber); if (!newSection) { return; } while (lastIndex < byteData.Length - 4) { FreeSatEntry freeSatEntry = new FreeSatEntry(); freeSatEntry.Process(byteData, lastIndex); EPGEntry epgEntry = new EPGEntry(); epgEntry.OriginalNetworkID = tvStation.OriginalNetworkID; epgEntry.TransportStreamID = tvStation.TransportStreamID; epgEntry.ServiceID = tvStation.ServiceID; epgEntry.EPGSource = EPGSource.FreeSat; switch (freeSatEntry.ComponentTypeAudio) { case 3: epgEntry.AudioQuality = "stereo"; break; case 5: epgEntry.AudioQuality = "dolby digital"; break; default: break; } if (freeSatEntry.ComponentTypeVideo > 9) { epgEntry.VideoQuality = "HDTV"; } epgEntry.Duration = Utils.RoundTime(freeSatEntry.Duration); epgEntry.EventID = freeSatEntry.EventID; epgEntry.EventName = freeSatEntry.EventName; if (freeSatEntry.ParentalRating > 11) { epgEntry.ParentalRating = "AO"; } else { if (freeSatEntry.ParentalRating > 8) { epgEntry.ParentalRating = "PGR"; } else { epgEntry.ParentalRating = "G"; } } setSeriesEpisode(epgEntry, freeSatEntry); epgEntry.RunningStatus = freeSatEntry.RunningStatus; epgEntry.Scrambled = freeSatEntry.Scrambled; epgEntry.ShortDescription = freeSatEntry.ShortDescription; epgEntry.StartTime = Utils.RoundTime(TimeOffsetEntry.GetOffsetTime(freeSatEntry.StartTime)); epgEntry.EventCategory = getEventCategory(epgEntry.EventName, epgEntry.ShortDescription, freeSatEntry.ContentType, freeSatEntry.ContentSubType); tvStation.AddEPGEntry(epgEntry); if (titleLogger != null) { logTitle(freeSatEntry.EventName, epgEntry, titleLogger); } if (descriptionLogger != null) { logDescription(freeSatEntry.ShortDescription, epgEntry, descriptionLogger); } lastIndex = freeSatEntry.Index; } }
/// <summary> /// Carry out the processing after all data has been collected for a frequency. /// </summary> public override void FinishFrequency() { if (OpenTVChannel.Channels.Count == 0) { return; } Logger titleLogger = null; Logger descriptionLogger = null; Logger extendedDescriptionLogger = null; Logger undefinedRecordLogger = null; if (RunParameters.Instance.DebugIDs.Contains("LOGTITLES")) { titleLogger = new Logger("EPG Titles.log"); } if (RunParameters.Instance.DebugIDs.Contains("LOGDESCRIPTIONS")) { descriptionLogger = new Logger("EPG Descriptions.log"); } if (RunParameters.Instance.DebugIDs.Contains("LOGEXTENDEDDESCRIPTIONS")) { extendedDescriptionLogger = new Logger("EPG Extended Descriptions.log"); } if (RunParameters.Instance.DebugIDs.Contains("LOGUNDEFINEDRECORDS")) { undefinedRecordLogger = new Logger("EPG Undefined Records.log"); } foreach (OpenTVChannel channel in OpenTVChannel.Channels) { TVStation station = TVStation.FindStation(channel.OriginalNetworkID, channel.TransportStreamID, channel.ServiceID); if (station != null) { if (station.EPGCollection.Count == 0) { channel.ProcessChannelForEPG(station, titleLogger, descriptionLogger, extendedDescriptionLogger, undefinedRecordLogger); channel.CreateChannelMapping(station); } } } if (RunParameters.Instance.DebugIDs.Contains("LOGCHANNELS")) { Logger.Instance.WriteSeparator("Bouquet Usage"); bool firstBouquet = true; foreach (Bouquet bouquet in Bouquet.GetBouquetsInNameOrder()) { if (!firstBouquet) { Logger.Instance.Write(""); } firstBouquet = false; foreach (Region region in bouquet.Regions) { Logger.Instance.Write("Bouquet: " + bouquet.BouquetID + " - " + bouquet.Name + " Region: " + region.Code + " (channels = " + region.Channels.Count + ")"); foreach (Channel channel in region.GetChannelsInNameOrder()) { Logger.Instance.Write(" Channel: " + channel.ToString()); } } } } int count = 0; foreach (TuningFrequency frequency in TuningFrequency.FrequencyCollection) { if (frequency.CollectionType == CollectionType.OpenTV) { count++; } } if (count > 1) { bool frequencyFirst = true; foreach (TuningFrequency frequency in TuningFrequency.FrequencyCollection) { if (frequency.CollectionType == CollectionType.OpenTV) { if (frequencyFirst) { Logger.Instance.WriteSeparator("Frequency Usage"); frequencyFirst = false; } Logger.Instance.Write("Frequency " + frequency.Frequency + " usage count " + frequency.UsageCount); } } } OpenTVProgramCategory.LogCategoryUsage(); if (RunParameters.Instance.DebugIDs.Contains("LOGCHANNELDATA")) { if (OpenTVChannel.Channels.Count != 0) { Logger.Instance.WriteSeparator("Channel Data - ID Sequence"); foreach (OpenTVChannel channel in OpenTVChannel.Channels) { channel.LogChannelMapping(Logger.Instance); } Collection <OpenTVChannel> sortedChannels = new Collection <OpenTVChannel>(); foreach (OpenTVChannel channel in OpenTVChannel.Channels) { addByUserChannel(sortedChannels, channel); } Logger.Instance.WriteSeparator("Channel Data - User Channel Sequence"); foreach (OpenTVChannel channel in sortedChannels) { channel.LogChannelMapping(Logger.Instance); } sortedChannels = new Collection <OpenTVChannel>(); foreach (OpenTVChannel channel in OpenTVChannel.Channels) { addByFlags(sortedChannels, channel); } Logger.Instance.WriteSeparator("Channel Data - Flags Sequence"); foreach (OpenTVChannel channel in sortedChannels) { channel.LogChannelMapping(Logger.Instance); } } } }
/// <summary> /// Get the stations using specified pid's. /// </summary> /// <param name="dataProvider">The sample data provider.</param> /// <param name="worker">The BackgroundWorker instance running the collection.</param> /// <param name="pids">An array of pid's to search.</param> protected void GetStationData(ISampleDataProvider dataProvider, BackgroundWorker worker, int[] pids) { Collection <TVStation> stations; if (!RunParameters.Instance.Options.Contains("USESTOREDSTATIONINFO")) { FrequencyScanner frequencyScanner = new FrequencyScanner(dataProvider, pids, true, worker); frequencyScanner.UseActualFrequency = false; stations = frequencyScanner.FindTVStations(); if (worker.CancellationPending) { return; } } else { if (!stationCacheLoaded) { stations = TVStation.Load(Path.Combine(RunParameters.DataDirectory, "Station Cache.xml")); if (stations == null) { return; } setMHEG5Pid(dataProvider, stations); stationCacheLoaded = true; } else { setMHEG5Pid(dataProvider, TVStation.StationCollection); return; } } foreach (TVStation tvStation in stations) { bool include = checkChannelFilters(tvStation); if (include) { TVStation existingStation = TVStation.FindStation(tvStation.OriginalNetworkID, tvStation.TransportStreamID, tvStation.ServiceID); if (existingStation == null) { tvStation.CollectionType = dataProvider.Frequency.CollectionType; bool added = TVStation.AddStation(tvStation); if (added) { Logger.Instance.Write("Included station: " + getStationDescription(tvStation)); } } else { if (!existingStation.Excluded) { existingStation.Update(tvStation); Logger.Instance.Write("Included station: " + getStationDescription(tvStation)); } else { Logger.Instance.Write("Excluded station: " + getStationDescription(tvStation)); } } } else { Logger.Instance.Write("Excluded station: " + getStationDescription(tvStation)); } } Logger.Instance.Write("Station count now: " + TVStation.StationCollection.Count); }