Exemple #1
0
        private string getStarRating(BellTVEntry entry)
        {
            switch (entry.StarRating)
            {
            case 0:
                return(null);

            case 1:
                return("*");

            case 2:
                return("*+");

            case 3:
                return("**");

            case 4:
                return("**+");

            case 5:
                return("***");

            case 6:
                return("***+");

            case 7:
                return("****");

            default:
                return(null);
            }
        }
Exemple #2
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);
             * }*/
        }
Exemple #3
0
 private string getStarRating(BellTVEntry entry)
 {
     switch (entry.StarRating)
     {
         case 0:
             return (null);
         case 1:
             return ("*");
         case 2:
             return ("*+");
         case 3:
             return ("**");
         case 4:
             return ("**+");
         case 5:
             return ("***");
         case 6:
             return ("***+");
         case 7:
             return ("****");
         default:
             return (null);
     }
 }
Exemple #4
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);
            }*/
        }
Exemple #5
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;
            }
        }
Exemple #6
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;
            }
        }