private void processTitleSections(Collection <Mpeg2Section> sections)
        {
            foreach (Mpeg2Section section in sections)
            {
                if (RunParameters.Instance.TraceIDs.Contains("DUMPTITLESECTIONS"))
                {
                    Logger.Instance.Dump("Title Section", section.Data, section.Length);
                }

                MediaHighway1TitleSection titleSection = MediaHighway1TitleSection.ProcessMediaHighwayTitleTable(section.Data);
                if (titleSection != null && titleSection.TitleData != null)
                {
                    MediaHighwayChannel channel = (MediaHighwayChannel)MediaHighwayChannel.FindChannel(titleSection.TitleData.ChannelID);
                    if (channel != null)
                    {
                        MediaHighwayTitle title = new MediaHighwayTitle();
                        title.CategoryID       = titleSection.TitleData.CategoryID;
                        title.Duration         = titleSection.TitleData.Duration;
                        title.EventID          = titleSection.TitleData.EventID;
                        title.EventName        = titleSection.TitleData.EventName;
                        title.StartTime        = titleSection.TitleData.StartTime;
                        title.SummaryAvailable = titleSection.TitleData.SummaryAvailable;
                        title.Day          = titleSection.TitleData.Day;
                        title.Hours        = titleSection.TitleData.Hours;
                        title.Minutes      = titleSection.TitleData.Minutes;
                        title.LogDay       = titleSection.TitleData.LogDay;
                        title.LogHours     = titleSection.TitleData.LogHours;
                        title.LogYesterday = titleSection.TitleData.LogYesterday;
                        channel.AddTitleData(title);
                    }
                }
            }
        }
        private void processChannelSections(Collection <Mpeg2Section> sections)
        {
            foreach (Mpeg2Section section in sections)
            {
                if (RunParameters.Instance.TraceIDs.Contains("DUMPCHANNELSECTIONS"))
                {
                    Logger.Instance.Dump("Channel Section", section.Data, section.Length);
                }

                MediaHighway1ChannelSection channelSection = MediaHighway1ChannelSection.ProcessMediaHighwayChannelTable(section.Data);
                if (channelSection != null)
                {
                    if (channelSection.Channels != null)
                    {
                        foreach (MediaHighwayChannelInfoEntry channelInfoEntry in channelSection.Channels)
                        {
                            MediaHighwayChannel channel = new MediaHighwayChannel();
                            channel.ChannelID         = channelSection.Channels.IndexOf(channelInfoEntry) + 1;
                            channel.OriginalNetworkID = channelInfoEntry.OriginalNetworkID;
                            channel.TransportStreamID = channelInfoEntry.TransportStreamID;
                            channel.ServiceID         = channelInfoEntry.ServiceID;
                            channel.ChannelName       = channelInfoEntry.Name;
                            channel.UserChannel       = Channel.Channels.Count + 1;
                            Channel.AddChannel(channel);
                        }
                    }
                }
            }
        }
Esempio n. 3
0
 /// <summary>
 /// Initialize a new instance of the MediaHighwayChannleTitle class.
 /// </summary>
 /// <param name="channel">The channel.</param>
 /// <param name="title">The title.</param>
 public MediaHighwayChannelTitle(MediaHighwayChannel channel, MediaHighwayTitle title)
 {
     this.channel = channel;
     this.title   = title;
 }
        /// <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>
 /// Initialize a new instance of the MediaHighwayChannleTitle class.
 /// </summary>
 /// <param name="channel">The channel.</param>
 /// <param name="title">The title.</param>
 public MediaHighwayChannelTitle(MediaHighwayChannel channel, MediaHighwayTitle title)
 {
     this.channel = channel;
     this.title = title;
 }
        private void processChannelSections(Collection<Mpeg2Section> sections)
        {
            foreach (Mpeg2Section section in sections)
            {
                if (RunParameters.Instance.TraceIDs.Contains("DUMPCHANNELSECTIONS"))
                    Logger.Instance.Dump("Channel Section", section.Data, section.Length);

                MediaHighway2ChannelSection channelSection = MediaHighway2ChannelSection.ProcessMediaHighwayChannelTable(section.Data);
                if (channelSection != null)
                {
                    if (channelSection.Channels != null)
                    {
                        foreach (MediaHighwayChannelInfoEntry channelInfoEntry in channelSection.Channels)
                        {
                            MediaHighwayChannel channel = new MediaHighwayChannel();
                            channel.ChannelID = channelSection.Channels.IndexOf(channelInfoEntry) + 1;
                            channel.OriginalNetworkID = channelInfoEntry.OriginalNetworkID;
                            channel.TransportStreamID = channelInfoEntry.TransportStreamID;
                            channel.ServiceID = channelInfoEntry.ServiceID;
                            channel.ChannelName = channelInfoEntry.Name;
                            channel.UserChannel = Channel.Channels.Count + 1;
                            channel.Unknown = channelInfoEntry.Unknown;
                            Channel.AddChannel(channel);
                        }
                    }
                }
            }
        }