Ejemplo n.º 1
0
        /// <summary>
        /// Returns an XML'd epg for a date range, or a time range on a day, e.g. 2010-11-05 12:00 to 2010-11-05 15:00
        /// 
        /// </summary>
        /// <param name="startDaysAhead"></param>
        /// <param name="numberOfDays"></param>
        /// <param name="TVChannelIDs"></param>
        /// <param name="omitDescriptions"></param>
        /// <param name="matchType"></param>
        /// <returns></returns>
        public static string EPGForDateRange(DateTime startDateTime, DateTime endDateTime, List<string> TVChannelIDs, bool omitDescriptions, TVProgrammeType matchType)
        {
            DateTime utcStart = startDateTime.ToUniversalTime();
            DateTime utcEnd = endDateTime.ToUniversalTime();
            DateRange theRange = new DateRange(utcStart, utcEnd);
            List<TVProgramme> tvProgs = EPGManager.mcData.GetTVProgrammes(theRange, TVChannelIDs.ToArray(), omitDescriptions, matchType);

            return XMLHelper.Serialize<List<TVProgramme>>(tvProgs);
        }
Ejemplo n.º 2
0
        public static string EPGForLocalDate(DateTime localDate, List<string> TVChannelIDs, bool omitDescriptions, TVProgrammeType matchType)
        {
            DateTime startRange = localDate.Date.ToUniversalTime();
            int extraEPGOverspill = Convert.ToInt32( Settings.Default.SilverlightEPGOverspillHours );
            DateTime endRange = startRange.AddHours(24 + extraEPGOverspill);
            DateRange theRange = new DateRange(startRange, endRange);
            List<TVProgramme> tvProgs = EPGManager.mcData.GetTVProgrammes(theRange, TVChannelIDs.ToArray(), omitDescriptions, matchType);

            return XMLHelper.Serialize<List<TVProgramme>>(tvProgs);
        }
Ejemplo n.º 3
0
        public static string EPGForDaysRange(int startDaysAhead, int numberOfDays, List<string> TVChannelIDs, bool omitDescriptions, TVProgrammeType matchType)
        {
            DateTime startRange = DateTime.Now.Date.ToUniversalTime().AddDays(startDaysAhead);
            int extraEPGOverspill = Convert.ToInt32(Settings.Default.SilverlightEPGOverspillHours);
            DateTime endRange = startRange.AddDays(numberOfDays);
            endRange = endRange.AddHours(extraEPGOverspill);
            DateRange theRange = new DateRange(startRange, endRange);
            List<TVProgramme> tvProgs = EPGManager.mcData.GetTVProgrammes(theRange, TVChannelIDs.ToArray(), omitDescriptions, matchType);

            return XMLHelper.Serialize<List<TVProgramme>>(tvProgs);
        }
Ejemplo n.º 4
0
        public static string EPGwithEPGRequests(List <EPGRequest> requests, bool omitDescriptions, TVProgrammeType matchType)
        {
            List <TVProgramme> tvProgs = EPGManager.mcData.GetTVProgrammes(requests, omitDescriptions, matchType);

            return(XMLHelper.Serialize <List <TVProgramme> >(tvProgs));
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Returns an XML'd epg for a date range, or a time range on a day, e.g. 2010-11-05 12:00 to 2010-11-05 15:00
        ///
        /// </summary>
        /// <param name="startDaysAhead"></param>
        /// <param name="numberOfDays"></param>
        /// <param name="TVChannelIDs"></param>
        /// <param name="omitDescriptions"></param>
        /// <param name="matchType"></param>
        /// <returns></returns>
        public static string EPGForDateRange(DateTime startDateTime, DateTime endDateTime, List <string> TVChannelIDs, bool omitDescriptions, TVProgrammeType matchType)
        {
            DateTime           utcStart = startDateTime.ToUniversalTime();
            DateTime           utcEnd   = endDateTime.ToUniversalTime();
            DateRange          theRange = new DateRange(utcStart, utcEnd);
            List <TVProgramme> tvProgs  = EPGManager.mcData.GetTVProgrammes(theRange, TVChannelIDs.ToArray(), omitDescriptions, matchType);

            return(XMLHelper.Serialize <List <TVProgramme> >(tvProgs));
        }
Ejemplo n.º 6
0
        public static string EPGForDaysRange(int startDaysAhead, int numberOfDays, List <string> TVChannelIDs, bool omitDescriptions, TVProgrammeType matchType)
        {
            DateTime startRange        = DateTime.Now.Date.ToUniversalTime().AddDays(startDaysAhead);
            int      extraEPGOverspill = Convert.ToInt32(Settings.Default.SilverlightEPGOverspillHours);
            DateTime endRange          = startRange.AddDays(numberOfDays);

            endRange = endRange.AddHours(extraEPGOverspill);
            DateRange          theRange = new DateRange(startRange, endRange);
            List <TVProgramme> tvProgs  = EPGManager.mcData.GetTVProgrammes(theRange, TVChannelIDs.ToArray(), omitDescriptions, matchType);

            return(XMLHelper.Serialize <List <TVProgramme> >(tvProgs));
        }
Ejemplo n.º 7
0
        public static string EPGForLocalDate(DateTime localDate, List <string> TVChannelIDs, bool omitDescriptions, TVProgrammeType matchType)
        {
            DateTime           startRange        = localDate.Date.ToUniversalTime();
            int                extraEPGOverspill = Convert.ToInt32(Settings.Default.SilverlightEPGOverspillHours);
            DateTime           endRange          = startRange.AddHours(24 + extraEPGOverspill);
            DateRange          theRange          = new DateRange(startRange, endRange);
            List <TVProgramme> tvProgs           = EPGManager.mcData.GetTVProgrammes(theRange, TVChannelIDs.ToArray(), omitDescriptions, matchType);

            return(XMLHelper.Serialize <List <TVProgramme> >(tvProgs));
        }
        public List<TVProgramme> GetTVProgrammesUsingEPGRequests(List<EPGRequest> EPGrequests, bool omitDescriptions, TVProgrammeType matchType)
        {
            Stopwatch timePerformance = new Stopwatch();
            timePerformance.Start();

            List<TVProgramme> mainOutput = new List<TVProgramme>();

            ScheduleEntry[] schedEntries;
            Service service;
            foreach (EPGRequest epgRequest in EPGrequests)
            {
                // Get the service from the object store
                service = GetServiceByID(epgRequest.TVServiceID);
                if (service == null)
                {
                    DebugError("Could not find service with ID " + epgRequest.TVServiceID);
                    continue;  // break if service not found
                }

                List<TVProgramme> svcOutput = new List<TVProgramme>();

                // Get entries in time range using API function (about 8-95 times faster!)
                DateTime startTime = new DateTime(epgRequest.StartTime, DateTimeKind.Utc);
                DateTime stopTime = new DateTime(epgRequest.StopTime, DateTimeKind.Utc);
                schedEntries = service.GetScheduleEntriesBetween(startTime, stopTime);

                TVProgramme tvp;
                foreach (ScheduleEntry se in schedEntries)
                {
                    if (se == null) continue;

                    // Include programme?  (i.e. does it match the requested type)
                    bool includeMe;
                    if (matchType == TVProgrammeType.All)
                        includeMe = true;
                    else
                        includeMe = Conversion.isProgrammeType(se.Program, matchType);

                    if (includeMe)
                    {
                        tvp = Conversion.TVProgrammeFromScheduleEntry(se, omitDescriptions);
                        if (tvp != null)
                            svcOutput.Add(tvp);
                    }

                }

                // Sort each service's lineup by start time (prob not necessary)
                CommonEPG.Comparers.TVProgrammeStartTimeComparer comparer = new CommonEPG.Comparers.TVProgrammeStartTimeComparer();
                svcOutput.Sort(comparer);

                mainOutput.AddRange(svcOutput);

                svcOutput.Clear();
                svcOutput = null;
            }

            timePerformance.Stop();
            DebugNormal("Time to fetch EPG programmes on " + EPGrequests.Count.ToString() + " services: " + timePerformance.Elapsed.TotalMilliseconds.ToString() + "ms");

            return mainOutput;
        }
Ejemplo n.º 9
0
 public static bool isProgrammeType(Program p, TVProgrammeType matchType)
 {
     return(matchType == ProgrammeTypeForProgram(p));
 }
Ejemplo n.º 10
0
 public static bool isProgrammeType(Program p, TVProgrammeType matchType)
 {
     return (matchType == ProgrammeTypeForProgram(p));
 }
Ejemplo n.º 11
0
        public static string EPGwithEPGRequests(List<EPGRequest> requests, bool omitDescriptions, TVProgrammeType matchType)
        {
            List<TVProgramme> tvProgs = EPGManager.mcData.GetTVProgrammes(requests, omitDescriptions, matchType);

            return XMLHelper.Serialize<List<TVProgramme>>(tvProgs);
        }