public TVProgrammeInfoBlob GetInfoBlobForTVProgrammeUID(string progUID, List<string> considerServiceIDs)
        {
            ScheduleEntry se;
            if (!GetScheduleEntryWithID(progUID, out se)) return null;
            Program p = se.Program;
            if (p == null) return null;

            TVProgrammeInfoBlob infoblob = new TVProgrammeInfoBlob();
            infoblob.Description = p.Description;  // Also grab programme description - if client is running in turbo mode it will not have this
            infoblob.TVProgrammeId = p.Id.ToString();
            infoblob.Crew = Conversion.TVProgrammeCrewFromProgram(p);

            // Other showings in this series
            SeriesInfo series = p.Series;
            if (series != null)
            {
                List<TVProgramme> seriesTVProgrammes = new List<TVProgramme>();
                Programs seriesPrograms = series.Programs;
                if (seriesPrograms != null)
                {
                    TVProgramme seriesProg;
                    foreach (Program seriesProgram in seriesPrograms)
                    {
                        foreach (ScheduleEntry seriesProgramScheduleEntry in seriesProgram.ScheduleEntries)
                        {
                            if (seriesProgramScheduleEntry == null) continue;

                            if (!seriesProgramScheduleEntry.IsLatestVersion) continue;
                            seriesProg = Conversion.TVProgrammeFromScheduleEntry(seriesProgramScheduleEntry);
                            if (seriesProg != null) seriesTVProgrammes.Add(seriesProg);
                        }
                    }
                }

                infoblob.OtherShowingsInSeries = FilterTVProgrammeListByServices(seriesTVProgrammes, considerServiceIDs);
            }

            // Other showings of this program
            if (p.ScheduleEntries != null)
            {
                List<TVProgramme> programShowings = new List<TVProgramme>();
                TVProgramme otherProg;
                foreach (ScheduleEntry programScheduleEntry in p.ScheduleEntries)
                {
                    if (programScheduleEntry == null) continue;

                    if (!programScheduleEntry.IsLatestVersion) continue;
                    otherProg = Conversion.TVProgrammeFromScheduleEntry(programScheduleEntry);
                    if (otherProg != null) programShowings.Add(otherProg);
                }
                infoblob.OtherShowingsOfThis = FilterTVProgrammeListByServices(programShowings, considerServiceIDs);
            }

            return infoblob;
        }
Exemple #2
0
        public static string TVProgrammeInfoBlobForProgID(string progUID)
        {
            // TODO:  Move this up the chain so it's generated by the client
            List<string> ConsiderIDs = EPGManager.EPGDisplayedTVChannelsServiceIDs;
            if (Settings.Default.DebugAdvanced) Functions.WriteLineToLogFile("Fetching Infoblob and filtering to consider " + ConsiderIDs.Count.ToString() + " channels");

            TVProgrammeInfoBlob blob = EPGManager.mcData.GetInfoBlobForTVProgrammeUID(progUID, ConsiderIDs);
            if (blob == null)
            {
                // Return empty blob
                if (Settings.Default.DebugAdvanced) Functions.WriteLineToLogFile("MCData Infoblob was NULL - returning new blank blob");
                blob = new TVProgrammeInfoBlob();
                blob.Crew = null;  // no crew
                blob.OtherShowingsInSeries = new List<TVProgramme>();
                blob.OtherShowingsOfThis = new List<TVProgramme>();
                blob.TVProgrammeId = progUID;
            }
            else
                if (Settings.Default.DebugAdvanced) Functions.WriteLineToLogFile("MCData Infoblob returned OK.");

            return XMLHelper.Serialize<TVProgrammeInfoBlob>(blob);
        }