Example #1
0
        /// <summary>
        /// Create the EPG entries.
        /// </summary>
        public override void FinishFrequency()
        {
            if (RunParameters.Instance.ChannelBouquet != -1)
            {
                foreach (TVStation tvStation in TVStation.StationCollection)
                {
                    bool process = checkChannelMapping(tvStation);
                    if (!process)
                    {
                        tvStation.EPGCollection.Clear();
                    }
                }
            }
            else
            {
                foreach (Bouquet bouquet in Bouquet.Bouquets)
                {
                    foreach (Region region in bouquet.Regions)
                    {
                        foreach (Channel channel in region.Channels)
                        {
                            TVStation station = TVStation.FindStation(channel.OriginalNetworkID, channel.TransportStreamID, channel.ServiceID);
                            if (station != null && station.LogicalChannelNumber == -1)
                            {
                                station.LogicalChannelNumber = channel.UserChannel;
                            }
                        }
                    }
                }
            }

            EITProgramContent.LogContentUsage();
            LanguageCode.LogUsage();
            logChannelInfo();
        }
        /// <summary>
        /// Acquire and process EIT data.
        /// </summary>
        /// <param name="dataProvider">A sample data provider.</param>
        /// <param name="worker">The background worker that is running this collection.</param>
        /// <returns>A CollectorReply code.</returns>
        public override CollectorReply Process(ISampleDataProvider dataProvider, BackgroundWorker worker)
        {
            EITProgramContent.Load();
            CustomProgramCategory.Load();

            MultiTreeDictionaryEntry.Load(Path.Combine(RunParameters.ConfigDirectory, "Huffman Dictionary FreeSat T1.cfg"), Path.Combine(RunParameters.ConfigDirectory, "Huffman Dictionary FreeSat T2.cfg"));

            /*GetStationData(dataProvider, worker, new int[] { 0xbba, 0xc1e, 0xf01 });*/
            GetStationData(dataProvider, worker, new int[] { 0xbba });
            if (worker.CancellationPending)
            {
                return(CollectorReply.Cancelled);
            }

            if (RunParameters.Instance.ChannelBouquet != -1 ||
                RunParameters.Instance.Options.Contains("USECHANNELID") ||
                RunParameters.Instance.Options.Contains("USELCN") ||
                RunParameters.Instance.Options.Contains("CREATEBRCHANNELS") ||
                RunParameters.Instance.Options.Contains("CREATEARCHANNELS"))
            {
                /*GetBouquetSections(dataProvider, worker, new int[] { 0xbba, oxc1e, oxf01 } );*/
                GetBouquetSections(dataProvider, worker, new int[] { 0xbba });
                if (worker.CancellationPending)
                {
                    return(CollectorReply.Cancelled);
                }
            }

            getFreeSatSections(dataProvider, worker);

            return(CollectorReply.OK);
        }
Example #3
0
        private string getEventCategory(string title, string description, int contentType, int contentSubType)
        {
            if (contentType == -1 || contentSubType == -1)
            {
                return(getCustomCategory(title, description));
            }

            if (RunParameters.Instance.Options.Contains("CUSTOMCATEGORYOVERRIDE"))
            {
                string customCategory = getCustomCategory(title, description);
                if (customCategory != null)
                {
                    return(customCategory);
                }
            }

            EITProgramContent contentEntry;

            if (RunParameters.Instance.Options.Contains("USECONTENTSUBTYPE"))
            {
                contentEntry = EITProgramContent.FindContent(contentType, contentSubType);
                if (contentEntry != null)
                {
                    if (contentEntry.SampleEvent == null)
                    {
                        contentEntry.SampleEvent = title;
                    }
                    contentEntry.UsedCount++;
                    return(contentEntry.Description);
                }
            }

            contentEntry = EITProgramContent.FindContent(contentType, 0);
            if (contentEntry != null)
            {
                if (contentEntry.SampleEvent == null)
                {
                    contentEntry.SampleEvent = title;
                }
                contentEntry.UsedCount++;
                return(contentEntry.Description);
            }

            EITProgramContent.AddUndefinedContent(contentType, contentSubType, "", title);

            if (RunParameters.Instance.Options.Contains("CUSTOMCATEGORYOVERRIDE"))
            {
                return(null);
            }

            return(getCustomCategory(title, description));
        }
Example #4
0
        /// <summary>
        /// Acquire and process EIT data.
        /// </summary>
        /// <param name="dataProvider">A sample data provider.</param>
        /// <param name="worker">The background worker that is running this collection.</param>
        /// <returns>A CollectorReply code.</returns>
        public override CollectorReply Process(ISampleDataProvider dataProvider, BackgroundWorker worker)
        {
            EITProgramContent.Load();
            CustomProgramCategory.Load();
            ParentalRating.Load();

            if (RunParameters.Instance.Options.Contains("USEFREESATTABLES"))
            {
                MultiTreeDictionaryEntry.Load(Path.Combine(RunParameters.ConfigDirectory, "Huffman Dictionary FreeSat T1.cfg"), Path.Combine(RunParameters.ConfigDirectory, "Huffman Dictionary FreeSat T2.cfg"));
            }

            GetStationData(dataProvider, worker);
            if (worker.CancellationPending)
            {
                return(CollectorReply.Cancelled);
            }

            bool bouquetNeeded = checkBouquetNeeded();

            if (RunParameters.Instance.ChannelBouquet != -1 ||
                RunParameters.Instance.Options.Contains("USECHANNELID") ||
                RunParameters.Instance.Options.Contains("USELCN") ||
                RunParameters.Instance.Options.Contains("CREATEBRCHANNELS") ||
                RunParameters.Instance.Options.Contains("CREATEARCHANNELS"))
            {
                GetBouquetSections(dataProvider, worker);

                string bouquetType;

                if (eitChannels > 0)
                {
                    bouquetType = "Freeview";
                }
                else
                {
                    bouquetType = "OpenTV";
                }

                Logger.Instance.Write("Used " + bouquetType + " channel descriptors");

                if (worker.CancellationPending)
                {
                    return(CollectorReply.Cancelled);
                }
            }

            getEITSections(dataProvider, worker);

            return(CollectorReply.OK);
        }
Example #5
0
        /// <summary>
        /// Compare this instance with another for sorting purposes.
        /// </summary>
        /// <param name="content">The other instance.</param>
        /// <param name="keyName">The name of the key to compare on.</param>
        /// <returns>Zero if the instances are equal, Greater than 0 if this instance is greater; less than zero otherwise.</returns>
        public int CompareForSorting(EITProgramContent content, string keyName)
        {
            switch (keyName)
            {
                case "ContentID":
                    if (contentID == content.ContentID)
                    {
                        if (subContentID == content.SubContentID)
                            return (EITDescription.CompareTo(content.EITDescription));
                        else
                            return (subContentID.CompareTo(content.SubContentID));
                    }
                    else
                        return (contentID.CompareTo(content.ContentID));
                case "SubContentID":
                    if (subContentID == content.SubContentID)
                    {
                        if (contentID == content.ContentID)
                            return (EITDescription.CompareTo(content.EITDescription));
                        else
                            return (contentID.CompareTo(content.ContentID));
                    }
                    else
                        return (subContentID.CompareTo(content.SubContentID));
                case "Description":
                    if (EITDescription == content.EITDescription)
                    {
                        if (contentID == content.ContentID)
                            return (subContentID.CompareTo(content.SubContentID));
                        else
                            return (contentID.CompareTo(content.ContentID));
                    }
                    else
                        return (EITDescription.CompareTo(content.EITDescription));
                case "WMCDescription":
                    string thisWMCDescription;
                    string otherWMCDescription;

                    if (WMCDescription != null)
                        thisWMCDescription = WMCDescription;
                    else
                        thisWMCDescription = string.Empty;

                    if (content.WMCDescription != null)
                        otherWMCDescription = content.WMCDescription;
                    else
                        otherWMCDescription = string.Empty;

                    if (thisWMCDescription == otherWMCDescription)
                    {
                        if (contentID == content.ContentID)
                            return (subContentID.CompareTo(content.SubContentID));
                        else
                            return (contentID.CompareTo(content.ContentID));
                    }
                    else
                        return (thisWMCDescription.CompareTo(otherWMCDescription));
                case "DVBLogicDescription":
                    string thisDVBLogicDescription;
                    string otherDVBLogicDescription;

                    if (DVBLogicDescription != null)
                        thisDVBLogicDescription = DVBLogicDescription;
                    else
                        thisDVBLogicDescription = string.Empty;

                    if (content.DVBLogicDescription != null)
                        otherDVBLogicDescription = content.DVBLogicDescription;
                    else
                        otherDVBLogicDescription = string.Empty;

                    if (thisDVBLogicDescription == otherDVBLogicDescription)
                    {
                        if (contentID == content.ContentID)
                            return (subContentID.CompareTo(content.SubContentID));
                        else
                            return (contentID.CompareTo(content.ContentID));
                    }
                    else
                        return (thisDVBLogicDescription.CompareTo(otherDVBLogicDescription));
                default:
                    return (0);
            }
        }
        /// <summary>
        /// Compare this instance with another for sorting purposes.
        /// </summary>
        /// <param name="content">The other instance.</param>
        /// <param name="keyName">The name of the key to compare on.</param>
        /// <returns>Zero if the instances are equal, Greater than 0 if this instance is greater; less than zero otherwise.</returns>
        public int CompareForSorting(EITProgramContent content, string keyName)
        {
            switch (keyName)
            {
            case "ContentID":
                if (contentID == content.ContentID)
                {
                    if (subContentID == content.SubContentID)
                    {
                        return(EITDescription.CompareTo(content.EITDescription));
                    }
                    else
                    {
                        return(subContentID.CompareTo(content.SubContentID));
                    }
                }
                else
                {
                    return(contentID.CompareTo(content.ContentID));
                }

            case "SubContentID":
                if (subContentID == content.SubContentID)
                {
                    if (contentID == content.ContentID)
                    {
                        return(EITDescription.CompareTo(content.EITDescription));
                    }
                    else
                    {
                        return(contentID.CompareTo(content.ContentID));
                    }
                }
                else
                {
                    return(subContentID.CompareTo(content.SubContentID));
                }

            case "Description":
                if (EITDescription == content.EITDescription)
                {
                    if (contentID == content.ContentID)
                    {
                        return(subContentID.CompareTo(content.SubContentID));
                    }
                    else
                    {
                        return(contentID.CompareTo(content.ContentID));
                    }
                }
                else
                {
                    return(EITDescription.CompareTo(content.EITDescription));
                }

            case "WMCDescription":
                string thisWMCDescription;
                string otherWMCDescription;

                if (WMCDescription != null)
                {
                    thisWMCDescription = WMCDescription;
                }
                else
                {
                    thisWMCDescription = string.Empty;
                }

                if (content.WMCDescription != null)
                {
                    otherWMCDescription = content.WMCDescription;
                }
                else
                {
                    otherWMCDescription = string.Empty;
                }

                if (thisWMCDescription == otherWMCDescription)
                {
                    if (contentID == content.ContentID)
                    {
                        return(subContentID.CompareTo(content.SubContentID));
                    }
                    else
                    {
                        return(contentID.CompareTo(content.ContentID));
                    }
                }
                else
                {
                    return(thisWMCDescription.CompareTo(otherWMCDescription));
                }

            case "DVBLogicDescription":
                string thisDVBLogicDescription;
                string otherDVBLogicDescription;

                if (DVBLogicDescription != null)
                {
                    thisDVBLogicDescription = DVBLogicDescription;
                }
                else
                {
                    thisDVBLogicDescription = string.Empty;
                }

                if (content.DVBLogicDescription != null)
                {
                    otherDVBLogicDescription = content.DVBLogicDescription;
                }
                else
                {
                    otherDVBLogicDescription = string.Empty;
                }

                if (thisDVBLogicDescription == otherDVBLogicDescription)
                {
                    if (contentID == content.ContentID)
                    {
                        return(subContentID.CompareTo(content.SubContentID));
                    }
                    else
                    {
                        return(contentID.CompareTo(content.ContentID));
                    }
                }
                else
                {
                    return(thisDVBLogicDescription.CompareTo(otherDVBLogicDescription));
                }

            default:
                return(0);
            }
        }