示例#1
0
        /// <summary>
        /// Acquire and process Bell TV 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)
        {
            BellTVProgramCategory.Load();
            CustomProgramCategory.Load();
            ParentalRating.Load();

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

            getBellTVData(dataProvider, worker);

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

            if (contentType == 0 && contentSubType == 0)
            {
                return(getCustomCategory(title, description));
            }

            if (contentType == 0 && contentSubType == 255)
            {
                return(getCustomCategory(title, description));
            }

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

            BellTVProgramCategory mainCategoryEntry = BellTVProgramCategory.FindCategory(contentType, 0);

            if (mainCategoryEntry == null)
            {
                BellTVProgramCategory.AddUndefinedCategory(contentType, 0, "", title);

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

                return(getCustomCategory(title, description));
            }

            if (mainCategoryEntry.SampleEvent == null)
            {
                mainCategoryEntry.SampleEvent = title;
            }
            mainCategoryEntry.UsedCount++;
            return(mainCategoryEntry.Description);
        }
示例#3
0
        /// <summary>
        /// Create the EPG entries.
        /// </summary>
        public override void FinishFrequency()
        {
            foreach (TVStation station in TVStation.StationCollection)
            {
                if (station.Name != null)
                {
                    station.ChannelID = station.OriginalNetworkID + ":" +
                                        station.TransportStreamID + ":" +
                                        station.ServiceID + ":" +
                                        station.Name;
                }
                else
                {
                    station.ChannelID = station.OriginalNetworkID + ":" +
                                        station.TransportStreamID + ":" +
                                        station.ServiceID;
                }
            }

            BellTVProgramCategory.LogCategoryUsage();
            LanguageCode.LogUsage();
        }
        /// <summary>
        /// Compare this instance with another for sorting purposes.
        /// </summary>
        /// <param name="category">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(BellTVProgramCategory category, string keyName)
        {
            switch (keyName)
            {
            case "CategoryID":
                if (categoryID == category.CategoryID)
                {
                    if (subCategoryID == category.SubCategoryID)
                    {
                        return(BellTVDescription.CompareTo(category.BellTVDescription));
                    }
                    else
                    {
                        return(subCategoryID.CompareTo(category.SubCategoryID));
                    }
                }
                else
                {
                    return(categoryID.CompareTo(category.CategoryID));
                }

            case "SubCategoryID":
                if (subCategoryID == category.SubCategoryID)
                {
                    if (categoryID == category.CategoryID)
                    {
                        return(BellTVDescription.CompareTo(category.BellTVDescription));
                    }
                    else
                    {
                        return(categoryID.CompareTo(category.CategoryID));
                    }
                }
                else
                {
                    return(subCategoryID.CompareTo(category.SubCategoryID));
                }

            case "Description":
                if (BellTVDescription == category.BellTVDescription)
                {
                    if (categoryID == category.CategoryID)
                    {
                        return(subCategoryID.CompareTo(category.SubCategoryID));
                    }
                    else
                    {
                        return(categoryID.CompareTo(category.CategoryID));
                    }
                }
                else
                {
                    return(BellTVDescription.CompareTo(category.BellTVDescription));
                }

            case "WMCDescription":
                string thisWMCDescription;
                string otherWMCDescription;

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

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

                if (thisWMCDescription == otherWMCDescription)
                {
                    if (categoryID == category.CategoryID)
                    {
                        return(subCategoryID.CompareTo(category.SubCategoryID));
                    }
                    else
                    {
                        return(categoryID.CompareTo(category.CategoryID));
                    }
                }
                else
                {
                    return(thisWMCDescription.CompareTo(otherWMCDescription));
                }

            case "DVBLogicDescription":
                string thisDVBLogicDescription;
                string otherDVBLogicDescription;

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

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

                if (thisDVBLogicDescription == otherDVBLogicDescription)
                {
                    if (categoryID == category.CategoryID)
                    {
                        return(subCategoryID.CompareTo(category.SubCategoryID));
                    }
                    else
                    {
                        return(categoryID.CompareTo(category.CategoryID));
                    }
                }
                else
                {
                    return(thisDVBLogicDescription.CompareTo(otherDVBLogicDescription));
                }

            default:
                return(0);
            }
        }
        /// <summary>
        /// Compare this instance with another for sorting purposes.
        /// </summary>
        /// <param name="category">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(BellTVProgramCategory category, string keyName)
        {
            switch (keyName)
            {
                case "CategoryID":
                    if (categoryID == category.CategoryID)
                    {
                        if (subCategoryID == category.SubCategoryID)
                            return (BellTVDescription.CompareTo(category.BellTVDescription));
                        else
                            return (subCategoryID.CompareTo(category.SubCategoryID));
                    }
                    else
                        return (categoryID.CompareTo(category.CategoryID));
                case "SubCategoryID":
                    if (subCategoryID == category.SubCategoryID)
                    {
                        if (categoryID == category.CategoryID)
                            return (BellTVDescription.CompareTo(category.BellTVDescription));
                        else
                            return (categoryID.CompareTo(category.CategoryID));
                    }
                    else
                        return (subCategoryID.CompareTo(category.SubCategoryID));
                case "Description":
                    if (BellTVDescription == category.BellTVDescription)
                    {
                        if (categoryID == category.CategoryID)
                            return (subCategoryID.CompareTo(category.SubCategoryID));
                        else
                            return (categoryID.CompareTo(category.CategoryID));
                    }
                    else
                        return (BellTVDescription.CompareTo(category.BellTVDescription));
                case "WMCDescription":
                    string thisWMCDescription;
                    string otherWMCDescription;

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

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

                    if (thisWMCDescription == otherWMCDescription)
                    {
                        if (categoryID == category.CategoryID)
                            return (subCategoryID.CompareTo(category.SubCategoryID));
                        else
                            return (categoryID.CompareTo(category.CategoryID));
                    }
                    else
                        return (thisWMCDescription.CompareTo(otherWMCDescription));
                case "DVBLogicDescription":
                    string thisDVBLogicDescription;
                    string otherDVBLogicDescription;

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

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

                    if (thisDVBLogicDescription == otherDVBLogicDescription)
                    {
                        if (categoryID == category.CategoryID)
                            return (subCategoryID.CompareTo(category.SubCategoryID));
                        else
                            return (categoryID.CompareTo(category.CategoryID));
                    }
                    else
                        return (thisDVBLogicDescription.CompareTo(otherDVBLogicDescription));
                default:
                    return (0);
            }
        }