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);
                    }
                }
            }
        }
        internal static MediaHighwayChannelTitle FindChannelTitle(int eventID)
        {
            foreach (MediaHighwayChannel channel in MediaHighwayChannel.Channels)
            {
                MediaHighwayTitle title = channel.findTitle(eventID);
                if (title != null)
                {
                    return(new MediaHighwayChannelTitle(channel, title));
                }
            }

            return(null);
        }
        /// <summary>
        /// Add title data to the channel.
        /// </summary>
        /// <param name="newTitle">The title to be added.</param>
        public void AddTitleData(MediaHighwayTitle newTitle)
        {
            foreach (MediaHighwayTitle oldTitle in Titles)
            {
                if (oldTitle.StartTime == newTitle.StartTime)
                {
                    return;
                }

                if (oldTitle.StartTime > newTitle.StartTime)
                {
                    Titles.Insert(Titles.IndexOf(oldTitle), newTitle);
                    return;
                }
            }

            Titles.Add(newTitle);
        }
示例#4
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();
        }
示例#6
0
        /// <summary>
        /// Add title data to the channel.
        /// </summary>
        /// <param name="newTitle">The title to be added.</param>
        public void AddTitleData(MediaHighwayTitle newTitle)
        {
            foreach (MediaHighwayTitle oldTitle in Titles)
            {
                if (oldTitle.StartTime == newTitle.StartTime)
                    return;

                if (oldTitle.StartTime > newTitle.StartTime)
                {
                    Titles.Insert(Titles.IndexOf(oldTitle), newTitle);
                    return;
                }
            }

            Titles.Add(newTitle);
        }
 /// <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 processTitleSections(Collection<Mpeg2Section> sections)
        {
            foreach (Mpeg2Section section in sections)
            {
                if (RunParameters.Instance.TraceIDs.Contains("DUMPTITLESECTIONS"))
                    Logger.Instance.Dump("Title Section", section.Data, section.Length);

                MediaHighway2TitleSection titleSection = MediaHighway2TitleSection.ProcessMediaHighwayTitleTable(section.Data);
                if (titleSection != null && titleSection.Titles != null)
                {
                    foreach (MediaHighway2TitleData titleData in titleSection.Titles)
                    {
                        MediaHighwayChannel channel = (MediaHighwayChannel)MediaHighwayChannel.FindChannel(titleData.ChannelID);
                        if (channel != null)
                        {
                            MediaHighwayTitle title = new MediaHighwayTitle();
                            title.CategoryID = titleData.CategoryID;
                            title.Duration = titleData.Duration;
                            title.EventID = titleData.EventID;
                            title.EventName = titleData.EventName;
                            title.StartTime = titleData.StartTime;
                            title.SummaryAvailable = (title.EventID != 0xffff);
                            title.Unknown = titleData.Unknown;
                            title.MainCategory = titleData.MainCategory;
                            title.SubCategory = titleData.SubCategory;
                            channel.AddTitleData(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();
        }