示例#1
0
        /// <summary>
        /// Add a summary to the collection.
        /// </summary>
        /// <param name="newSummary">The summary to be added.</param>
        public static void AddSummary(MediaHighwaySummary newSummary)
        {
            foreach (MediaHighwaySummary oldSummary in Summaries)
            {
                if (oldSummary.EventID == newSummary.EventID && oldSummary.ShortDescription == newSummary.ShortDescription)
                {
                    return;
                }

                if (oldSummary.EventID > newSummary.EventID)
                {
                    Summaries.Insert(Summaries.IndexOf(oldSummary), newSummary);
                    return;
                }
            }

            Summaries.Add(newSummary);
        }
        private void processSummarySections(Collection <Mpeg2Section> sections)
        {
            foreach (Mpeg2Section section in sections)
            {
                if (RunParameters.Instance.TraceIDs.Contains("DUMPSUMMARYSECTIONS"))
                {
                    Logger.Instance.Dump("Summary Section", section.Data, section.Length);
                }

                MediaHighway2SummarySection summarySection = MediaHighway2SummarySection.ProcessMediaHighwaySummaryTable(section.Data);
                if (summarySection != null && summarySection.SummaryData != null)
                {
                    MediaHighwaySummary summary = new MediaHighwaySummary();
                    summary.EventID          = summarySection.SummaryData.EventID;
                    summary.ShortDescription = summarySection.SummaryData.ShortDescription;
                    summary.Unknown          = summarySection.SummaryData.Unknown;
                    MediaHighwaySummary.AddSummary(summary);
                }
            }
        }
示例#3
0
        /// <summary>
        /// Add a summary to the collection.
        /// </summary>
        /// <param name="newSummary">The summary to be added.</param>
        public static void AddSummary(MediaHighwaySummary newSummary)
        {
            foreach (MediaHighwaySummary oldSummary in Summaries)
            {
                if (oldSummary.EventID == newSummary.EventID && oldSummary.ShortDescription == newSummary.ShortDescription)
                    return;

                if (oldSummary.EventID > newSummary.EventID)
                {
                    Summaries.Insert(Summaries.IndexOf(oldSummary), newSummary);
                    return;
                }
            }

            Summaries.Add(newSummary);
        }
        /// <summary>
        /// Create the EPG entries from the stored title and summary data.
        /// </summary>
        /// <param name="station">The station that the EPG records are for.</param>
        /// <param name="titleLogger">A Logger instance for the program titles.</param>
        /// <param name="descriptionLogger">A Logger instance for the program descriptions.</param>
        /// <param name="collectionType">The type of collection, MHW1 or MHW2.</param>
        public void ProcessChannelForEPG(TVStation station, Logger titleLogger, Logger descriptionLogger, CollectionType collectionType)
        {
            bool     first             = true;
            DateTime expectedStartTime = new DateTime();

            foreach (MediaHighwayTitle title in Titles)
            {
                EPGEntry epgEntry = new EPGEntry();
                epgEntry.OriginalNetworkID = OriginalNetworkID;
                epgEntry.TransportStreamID = TransportStreamID;
                epgEntry.ServiceID         = ServiceID;
                epgEntry.EventID           = title.EventID;

                processEventName(epgEntry, title.EventName);

                MediaHighwaySummary summary = null;

                if (title.SummaryAvailable)
                {
                    summary = findSummary(title.EventID);
                    if (summary != null)
                    {
                        processShortDescription(epgEntry, summary.ShortDescription);
                    }
                    else
                    {
                        if (RunParameters.Instance.DebugIDs.Contains("MHW2SUMMARYMISSING"))
                        {
                            Logger.Instance.Write("Summary missing for event ID " + title.EventID);
                        }
                    }
                }
                if (summary == null)
                {
                    epgEntry.ShortDescription = "No Synopsis Available";
                }

                if (collectionType == CollectionType.MediaHighway1)
                {
                    epgEntry.StartTime = Utils.RoundTime(TimeOffsetEntry.GetOffsetTime(title.StartTime));
                }
                else
                {
                    epgEntry.StartTime = Utils.RoundTime(TimeOffsetEntry.GetAdjustedTime(title.StartTime));
                }
                epgEntry.Duration = Utils.RoundTime(title.Duration);

                epgEntry.EventCategory = getEventCategory(epgEntry.EventName, epgEntry.ShortDescription, title.CategoryID);

                if (collectionType == CollectionType.MediaHighway1)
                {
                    epgEntry.EPGSource = EPGSource.MediaHighway1;
                }
                else
                {
                    epgEntry.EPGSource = EPGSource.MediaHighway2;
                }

                epgEntry.VideoQuality = getVideoQuality(epgEntry.EventName);

                epgEntry.PreviousPlayDate = title.PreviousPlayDate;

                station.AddEPGEntry(epgEntry);

                if (first)
                {
                    expectedStartTime = new DateTime();
                    first             = false;
                }
                else
                {
                    if (epgEntry.StartTime < expectedStartTime)
                    {
                        if (titleLogger != null)
                        {
                            titleLogger.Write(" ** Overlap In Schedule **");
                        }
                    }
                    else
                    {
                        if (RunParameters.Instance.Options.Contains("ACCEPTBREAKS"))
                        {
                            if (epgEntry.StartTime > expectedStartTime + new TimeSpan(0, 5, 0))
                            {
                                if (titleLogger != null)
                                {
                                    titleLogger.Write(" ** Gap In Schedule **");
                                }
                            }
                        }
                        else
                        {
                            if (epgEntry.StartTime > expectedStartTime)
                            {
                                if (titleLogger != null)
                                {
                                    titleLogger.Write(" ** Gap In Schedule **");
                                }
                            }
                        }
                    }
                }

                expectedStartTime = epgEntry.StartTime + epgEntry.Duration;

                if (titleLogger != null)
                {
                    if (collectionType == CollectionType.MediaHighway1)
                    {
                        titleLogger.Write(epgEntry.OriginalNetworkID + ":" + epgEntry.TransportStreamID + ":" + epgEntry.ServiceID + " " +
                                          " Evt ID " + title.EventID +
                                          " Cat ID " + title.CategoryID.ToString("00") +
                                          " Summary " + title.SummaryAvailable + ":" + (summary != null) + " " +
                                          " Orig Day " + title.LogDay +
                                          " Orig Hours " + title.LogHours +
                                          " YDay " + title.LogYesterday +
                                          " Day " + title.Day +
                                          " Hours " + title.Hours +
                                          " Mins " + title.Minutes + " " +
                                          epgEntry.StartTime.ToShortDateString() + " " +
                                          epgEntry.StartTime.ToString("HH:mm") + " - " +
                                          epgEntry.StartTime.Add(epgEntry.Duration).ToString("HH:mm") + " " +
                                          title.EventName);
                    }
                    else
                    {
                        titleLogger.Write(epgEntry.OriginalNetworkID + ":" + epgEntry.TransportStreamID + ":" + epgEntry.ServiceID + " " +
                                          " Evt ID " + title.EventID +
                                          " Cat ID " + title.CategoryID.ToString("000") +
                                          " Main cat " + title.MainCategory +
                                          " Sub cat " + title.SubCategory +
                                          " Summary " + title.SummaryAvailable + ":" + (summary != null) +
                                          " Unknown " + Utils.ConvertToHex(title.Unknown) + " " +
                                          epgEntry.StartTime.ToShortDateString() + " " +
                                          epgEntry.StartTime.ToString("HH:mm") + " - " +
                                          epgEntry.StartTime.Add(epgEntry.Duration).ToString("HH:mm") + " " +
                                          title.EventName);
                    }
                }

                if (descriptionLogger != null && summary != null)
                {
                    if (collectionType == CollectionType.MediaHighway1)
                    {
                        descriptionLogger.Write(epgEntry.OriginalNetworkID + ":" + epgEntry.TransportStreamID + ":" + epgEntry.ServiceID + " " +
                                                " Evt ID " + title.EventID +
                                                " Rpts: " + summary.ReplayCount + " " +
                                                epgEntry.StartTime.ToShortDateString() + " " +
                                                epgEntry.StartTime.ToString("HH:mm") + " - " +
                                                epgEntry.StartTime.Add(epgEntry.Duration).ToString("HH:mm") + " " +
                                                summary.ShortDescription);
                    }
                    else
                    {
                        descriptionLogger.Write(epgEntry.OriginalNetworkID + ":" + epgEntry.TransportStreamID + ":" + epgEntry.ServiceID + " " +
                                                " Evt ID " + title.EventID + " " +
                                                " Unknown " + Utils.ConvertToHex(summary.Unknown) + " " +
                                                epgEntry.StartTime.ToShortDateString() + " " +
                                                epgEntry.StartTime.ToString("HH:mm") + " - " +
                                                epgEntry.StartTime.Add(epgEntry.Duration).ToString("HH:mm") + " " +
                                                summary.ShortDescription);
                    }
                }

                if (!RunParameters.Instance.Options.Contains("ACCEPTBREAKS"))
                {
                    if (epgEntry.StartTime.Second != 0)
                    {
                        if (titleLogger != null)
                        {
                            titleLogger.Write("** Suspect Start Time **");
                        }
                    }
                }
            }
        }
        private void processSummarySections(Collection<Mpeg2Section> sections)
        {
            foreach (Mpeg2Section section in sections)
            {
                if (RunParameters.Instance.TraceIDs.Contains("DUMPSUMMARYSECTIONS"))
                    Logger.Instance.Dump("Summary Section", section.Data, section.Length);

                MediaHighway2SummarySection summarySection = MediaHighway2SummarySection.ProcessMediaHighwaySummaryTable(section.Data);
                if (summarySection != null && summarySection.SummaryData != null)
                {
                    MediaHighwaySummary summary = new MediaHighwaySummary();
                    summary.EventID = summarySection.SummaryData.EventID;
                    summary.ShortDescription = summarySection.SummaryData.ShortDescription;
                    summary.Unknown = summarySection.SummaryData.Unknown;
                    MediaHighwaySummary.AddSummary(summary);
                }
            }
        }