예제 #1
0
        private void getParentalRating(EPGEntry epgEntry, BellTVEntry entry)
        {
            epgEntry.ParentalRating       = ParentalRating.FindRating("USA", "DISHNETWORK", entry.ParentalRating.ToString());
            epgEntry.MpaaParentalRating   = ParentalRating.FindMpaaRating("USA", "DISHNETWORK", entry.ParentalRating.ToString());
            epgEntry.ParentalRatingSystem = ParentalRating.FindSystem("USA", "DISHNETWORK", entry.ParentalRating.ToString());

            /*switch (entry.ParentalRating)
             * {
             *  case 0:
             *      return (null);
             *  case 1:
             *      return ("G");
             *  case 2:
             *      return ("PG");
             *  case 3:
             *      return ("PG-13");
             *  case 4:
             *      return ("R");
             *  case 5:
             *      return ("NR/AO");
             *  case 6:
             *      return (null);
             *  case 7:
             *      return ("NC-17");
             *  default:
             *      return (null);
             * }*/
        }
예제 #2
0
        internal bool AddEPGEntry(EPGEntry newEntry)
        {
            foreach (EPGEntry oldEntry in EPGCollection)
            {
                if (newEntry.StartTime == oldEntry.StartTime)
                {
                    EPGCollection.Insert(EPGCollection.IndexOf(oldEntry), newEntry);
                    EPGCollection.Remove(oldEntry);
                    return(false);
                }
                else
                {
                    if (newEntry.StartTime > oldEntry.StartTime && (newEntry.StartTime + newEntry.Duration) <= (oldEntry.StartTime + oldEntry.Duration))
                    {
                        return(false);
                    }

                    if (newEntry.StartTime < oldEntry.StartTime)
                    {
                        EPGCollection.Insert(EPGCollection.IndexOf(oldEntry), newEntry);
                        return(true);
                    }
                }
            }

            EPGCollection.Add(newEntry);

            return(true);
        }
예제 #3
0
        private void logTitle(string title, EPGEntry epgEntry, Logger logger)
        {
            string episodeInfo;

            if (RunParameters.Instance.DebugIDs.Contains("LOGEPISODEINFO"))
            {
                if (epgEntry.EpisodeSystemType != null)
                {
                    episodeInfo = epgEntry.Series + ":" + epgEntry.Episode + ":" + epgEntry.PartNumber;
                }
                else
                {
                    episodeInfo = string.Empty;
                }
            }
            else
            {
                episodeInfo = string.Empty;
            }

            logger.Write(epgEntry.OriginalNetworkID + ":" + epgEntry.TransportStreamID + ":" + epgEntry.ServiceID + " " +
                         epgEntry.StartTime.ToShortDateString() + " " +
                         epgEntry.StartTime.ToString("HH:mm") + " - " +
                         epgEntry.StartTime.Add(epgEntry.Duration).ToString("HH:mm") + " " +
                         title + " " +
                         episodeInfo);
        }
예제 #4
0
        private void processShortDescription(EPGEntry epgEntry, string description)
        {
            epgEntry.ShortDescription = description;

            epgEntry.Directors = getDirectors(description);
            epgEntry.Cast      = getCast(description);
        }
예제 #5
0
        private void processProgramTitle(string epgText, Logger titleLogger)
        {
            if (station == null)
            {
                return;
            }

            epgEntry = new EPGEntry();
            epgEntry.OriginalNetworkID = station.OriginalNetworkID;
            epgEntry.TransportStreamID = station.TransportStreamID;
            epgEntry.ServiceID         = station.ServiceID;
            epgEntry.EPGSource         = EPGSource.SiehfernInfo;

            string time    = epgText.Substring(3, 5);
            int    hours   = Int32.Parse(time.Substring(0, 2));
            int    minutes = Int32.Parse(time.Substring(3, 2));

            TimeSpan startTime = new TimeSpan(hours, minutes, 0);

            if (startDate + startTime < lastStartTime)
            {
                startTime = startTime.Add(new TimeSpan(24, 0, 0));
            }

            epgEntry.StartTime = Utils.RoundTime(startDate + startTime);

            int separatorIndex = epgText.IndexOf('|');

            if (separatorIndex == -1)
            {
                epgEntry.EventName = epgText.Substring(9);
            }
            else
            {
                epgEntry.EventName = epgText.Substring(9, separatorIndex - 9);
            }

            station.EPGCollection.Add(epgEntry);
            lastStartTime = epgEntry.StartTime;

            if (station.EPGCollection.Count > 1)
            {
                int count = station.EPGCollection.Count;
                if (station.EPGCollection[count - 2].Duration.TotalSeconds == 0)
                {
                    station.EPGCollection[count - 2].Duration = Utils.RoundTime(station.EPGCollection[count - 1].StartTime - station.EPGCollection[count - 2].StartTime);
                }
            }

            if (titleLogger != null)
            {
                titleLogger.Write(epgEntry.OriginalNetworkID + ":" + epgEntry.TransportStreamID + ":" + epgEntry.ServiceID + " " +
                                  epgEntry.StartTime.ToShortDateString() + " " +
                                  epgEntry.StartTime.ToString("HH:mm") + " - " +
                                  epgEntry.StartTime.Add(epgEntry.Duration).ToString("HH:mm") + " " +
                                  epgEntry.EventName + " " +
                                  epgText);
            }
        }
예제 #6
0
 private void logDescription(string description, EPGEntry epgEntry, Logger logger)
 {
     logger.Write(epgEntry.OriginalNetworkID + ":" + epgEntry.TransportStreamID + ":" + epgEntry.ServiceID + " " +
                  epgEntry.StartTime.ToShortDateString() + " " +
                  epgEntry.StartTime.ToString("HH:mm") + " - " +
                  epgEntry.StartTime.Add(epgEntry.Duration).ToString("HH:mm") + " " +
                  description);
 }
예제 #7
0
        private void processCRIDBSEPG(EPGEntry epgEntry, string seriesID, string seasonID, string episodeID)
        {
            epgEntry.EpisodeSystemType  = "bsepg-epid";
            epgEntry.EpisodeSystemParts = 2;

            string series  = "SE-";
            string episode = "EP-";

            if (seriesID != null && seasonID != null && episodeID != null)
            {
                epgEntry.Series  = series + ((uint)seasonID.GetHashCode()).ToString();
                epgEntry.Episode = episode + ((uint)episodeID.GetHashCode()).ToString();
                return;
            }

            if (seriesID != null && seasonID != null)
            {
                epgEntry.Series  = series + ((uint)seriesID.GetHashCode()).ToString();
                epgEntry.Episode = episode + ((uint)seasonID.GetHashCode()).ToString();
                return;
            }

            if (seriesID != null)
            {
                if (episodeID != null)
                {
                    epgEntry.Series  = series + ((uint)seriesID.GetHashCode()).ToString();
                    epgEntry.Episode = episode + ((uint)episodeID.GetHashCode()).ToString();
                }
                else
                {
                    epgEntry.Series  = series + ((uint)seriesID.GetHashCode()).ToString();
                    epgEntry.Episode = episode;
                }

                return;
            }

            if (seasonID != null)
            {
                if (episodeID != null)
                {
                    epgEntry.Series  = series + ((uint)seasonID.GetHashCode()).ToString();
                    epgEntry.Episode = episode + ((uint)episodeID.GetHashCode()).ToString();
                }
                else
                {
                    epgEntry.Series  = series + ((uint)seasonID.GetHashCode()).ToString();
                    epgEntry.Episode = episode;
                }

                return;
            }

            epgEntry.Series  = series;
            epgEntry.Episode = episode + ((uint)episodeID.GetHashCode()).ToString();
        }
예제 #8
0
 private void logTitle(string title, EITEntry eitEntry, EPGEntry epgEntry, Logger logger)
 {
     logger.Write(epgEntry.OriginalNetworkID + ":" + epgEntry.TransportStreamID + ":" + epgEntry.ServiceID + " " +
                  epgEntry.StartTime.ToShortDateString() + " " +
                  epgEntry.StartTime.ToString("HH:mm") + " - " +
                  epgEntry.StartTime.Add(epgEntry.Duration).ToString("HH:mm") + " " +
                  "Content: " + eitEntry.ContentType + "/" + eitEntry.ContentSubType + " " +
                  title);
 }
예제 #9
0
        private void processCRIDNumeric(EPGEntry epgEntry, string seriesID, string seasonID, string episodeID)
        {
            epgEntry.EpisodeSystemType  = "xmltv_ns";
            epgEntry.EpisodeSystemParts = 3;

            if (seriesID != null && seasonID != null && episodeID != null)
            {
                epgEntry.Series     = ((uint)seriesID.GetHashCode()).ToString();
                epgEntry.Episode    = ((uint)seasonID.GetHashCode()).ToString();
                epgEntry.PartNumber = ((uint)episodeID.GetHashCode()).ToString();
                return;
            }

            if (seriesID != null && seasonID != null)
            {
                epgEntry.Series  = ((uint)seriesID.GetHashCode()).ToString();
                epgEntry.Episode = ((uint)seasonID.GetHashCode()).ToString();
                return;
            }

            if (seriesID != null)
            {
                if (episodeID != null)
                {
                    epgEntry.Series  = ((uint)seriesID.GetHashCode()).ToString();
                    epgEntry.Episode = ((uint)episodeID.GetHashCode()).ToString();
                }
                else
                {
                    epgEntry.Series = ((uint)seriesID.GetHashCode()).ToString();
                }

                return;
            }

            if (seasonID != null)
            {
                if (episodeID != null)
                {
                    epgEntry.Series  = ((uint)seasonID.GetHashCode()).ToString();
                    epgEntry.Episode = ((uint)episodeID.GetHashCode()).ToString();
                }
                else
                {
                    epgEntry.Series = ((uint)seasonID.GetHashCode()).ToString();
                }

                return;
            }

            epgEntry.Episode = ((uint)episodeID.GetHashCode()).ToString();
        }
예제 #10
0
 private void updateSchedule(Collection <EITEntry> eitCollection)
 {
     foreach (EITEntry eitEntry in eitCollection)
     {
         EPGEntry epgEntry = findEPGEntry(eitEntry);
         if (epgEntry == null)
         {
             addEPGEntry(eitEntry);
         }
         else
         {
             updateEPGEntry(epgEntry, eitEntry);
         }
     }
 }
예제 #11
0
 private void updateEPGEntry(EPGEntry epgEntry, EITEntry eitEntry)
 {
     epgEntry.ComponentTypeAudio  = eitEntry.ComponentTypeAudio;
     epgEntry.ComponentTypeVideo  = eitEntry.ComponentTypeVideo;
     epgEntry.ContentSubType      = eitEntry.ContentSubType;
     epgEntry.ContentType         = eitEntry.ContentType;
     epgEntry.Duration            = eitEntry.Duration;
     epgEntry.EventID             = eitEntry.EventID;
     epgEntry.EventName           = eitEntry.EventName;
     epgEntry.ExtendedDescription = eitEntry.ExtendedDescription;
     epgEntry.ParentalRating      = eitEntry.ParentalRating;
     epgEntry.RunningStatus       = eitEntry.RunningStatus;
     epgEntry.Scrambled           = eitEntry.Scrambled;
     epgEntry.ShortDescription    = eitEntry.ShortDescription;
     epgEntry.VersionNumber       = eitEntry.VersionNumber;
 }
예제 #12
0
        private void getSeriesEpisode(EPGEntry epgEntry, int series, int episode)
        {
            if (series < 1 && episode < 1)
            {
                return;
            }

            epgEntry.EpisodeSystemType = "xmltv_ns";

            if (series > 0)
            {
                epgEntry.Series = series.ToString();
            }

            if (episode > 0)
            {
                epgEntry.Episode = episode.ToString();
            }
        }
예제 #13
0
        private void setSeriesEpisode(EPGEntry epgEntry, FreeSatEntry freeSatEntry)
        {
            if (freeSatEntry.SeriesID == null && freeSatEntry.SeasonID == null && freeSatEntry.EpisodeID == null)
            {
                return;
            }

            if (RunParameters.Instance.Options.Contains("USENUMERICCRID"))
            {
                processCRIDNumeric(epgEntry, freeSatEntry.SeriesID, freeSatEntry.SeasonID, freeSatEntry.EpisodeID);
                return;
            }

            if (RunParameters.Instance.Options.Contains("USEBSEPG"))
            {
                processCRIDBSEPG(epgEntry, freeSatEntry.SeriesID, freeSatEntry.SeasonID, freeSatEntry.EpisodeID);
                return;
            }
        }
예제 #14
0
        private void processEvent(int frequency, int sourceID, EventInformationTableEntry eventEntry)
        {
            VirtualChannel channel = VirtualChannelTable.FindChannel(frequency, sourceID);

            if (channel == null)
            {
                return;
            }

            EPGEntry epgEntry = new EPGEntry();

            epgEntry.EventID = eventEntry.EventID;

            if (eventEntry.EventName != null)
            {
                epgEntry.EventName = eventEntry.EventName.ToString().Replace("\0", "");
            }
            else
            {
                epgEntry.EventName = "No Event Name";
            }

            if (eventEntry.ETMLocation == 1 || eventEntry.ETMLocation == 2)
            {
                ExtendedTextTableEntry textEntry = ExtendedTextTable.FindEntry(sourceID, eventEntry.EventID);
                if (textEntry != null)
                {
                    epgEntry.ShortDescription = textEntry.Text.ToString().Replace("\0", "");
                }
            }

            epgEntry.StartTime            = Utils.RoundTime(TimeOffsetEntry.GetAdjustedTime(eventEntry.StartTime));
            epgEntry.Duration             = Utils.RoundTime(eventEntry.Duration);
            epgEntry.EventCategory        = getEventCategory(epgEntry.EventName, epgEntry.ShortDescription, eventEntry);
            epgEntry.ParentalRating       = eventEntry.ParentalRating;
            epgEntry.ParentalRatingSystem = "VCHIP";
            epgEntry.AudioQuality         = eventEntry.AudioQuality;
            epgEntry.EPGSource            = EPGSource.PSIP;

            channel.AddEPGEntry(epgEntry);
        }
예제 #15
0
        private void addEPGEntry(EITEntry eitEntry)
        {
            EPGEntry epgEntry = new EPGEntry();

            epgEntry.ComponentTypeAudio  = eitEntry.ComponentTypeAudio;
            epgEntry.ComponentTypeVideo  = eitEntry.ComponentTypeVideo;
            epgEntry.ContentSubType      = eitEntry.ContentSubType;
            epgEntry.ContentType         = eitEntry.ContentType;
            epgEntry.Duration            = eitEntry.Duration;
            epgEntry.EventID             = eitEntry.EventID;
            epgEntry.EventName           = eitEntry.EventName;
            epgEntry.ExtendedDescription = eitEntry.ExtendedDescription;
            epgEntry.OriginalNetworkID   = eitEntry.OriginalNetworkID;
            epgEntry.ParentalRating      = eitEntry.ParentalRating;
            epgEntry.RunningStatus       = eitEntry.RunningStatus;
            epgEntry.Scrambled           = eitEntry.Scrambled;
            epgEntry.ServiceID           = eitEntry.ServiceID;
            epgEntry.ShortDescription    = eitEntry.ShortDescription;
            epgEntry.StartTime           = eitEntry.StartTime;
            epgEntry.TransportStreamID   = eitEntry.TransportStreamID;
            epgEntry.VersionNumber       = eitEntry.VersionNumber;

            epgDatabase.AddEPGEntry(epgEntry);
        }
예제 #16
0
        /// <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;
            }
        }
예제 #17
0
        /// <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 **");
                        }
                    }
                }
            }
        }
예제 #18
0
        private void setSeriesEpisode(EPGEntry epgEntry, EITEntry eitEntry)
        {
            if (eitEntry.SeriesID == null && eitEntry.SeasonID == null && eitEntry.EpisodeID == null)
            {
                return;
            }

            epgEntry.EpisodeSystemType = "xmltv_ns";

            if (eitEntry.SeriesID != null && eitEntry.SeasonID != null && eitEntry.EpisodeID != null)
            {
                epgEntry.Series     = eitEntry.SeriesID;
                epgEntry.Episode    = eitEntry.SeasonID;
                epgEntry.PartNumber = eitEntry.EpisodeID;
                return;
            }

            if (eitEntry.SeriesID != null && eitEntry.SeasonID != null)
            {
                epgEntry.Series     = eitEntry.SeriesID;
                epgEntry.Episode    = eitEntry.SeasonID;
                epgEntry.PartNumber = "0";
                return;
            }

            if (eitEntry.SeriesID != null)
            {
                if (eitEntry.EpisodeID != null)
                {
                    epgEntry.Series  = eitEntry.SeriesID;
                    epgEntry.Episode = eitEntry.EpisodeID;
                }
                else
                {
                    epgEntry.Series  = eitEntry.SeriesID;
                    epgEntry.Episode = "0";
                }

                epgEntry.PartNumber = "0";
                return;
            }

            if (eitEntry.SeasonID != null)
            {
                if (eitEntry.EpisodeID != null)
                {
                    epgEntry.Series  = eitEntry.SeasonID;
                    epgEntry.Episode = eitEntry.EpisodeID;
                }
                else
                {
                    epgEntry.Series  = eitEntry.SeasonID;
                    epgEntry.Episode = "0";
                }

                epgEntry.PartNumber = "0";
                return;
            }

            epgEntry.Series     = "0";
            epgEntry.Episode    = eitEntry.EpisodeID;
            epgEntry.PartNumber = "0";
        }
예제 #19
0
        /// <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;
            }
        }
예제 #20
0
 private void processEventName(EPGEntry epgEntry, string eventName)
 {
     epgEntry.EventName = eventName;
 }
예제 #21
0
        /// <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;
            }
        }