Example #1
0
        private void SetProperties(UpcomingProgram upcoming, ScheduleSummary schedule)
        {
            string guiPropertyPrefix = this._channelType == ChannelType.Television ? "#TV" : "#Radio";

            if (schedule != null)
            {
                GUIPropertyManager.SetProperty(guiPropertyPrefix + ".Upcoming.Channel", String.Empty);
                GUIPropertyManager.SetProperty(guiPropertyPrefix + ".Upcoming.Title", schedule.Name);
                GUIPropertyManager.SetProperty(guiPropertyPrefix + ".Upcoming.Genre", String.Empty);
                GUIPropertyManager.SetProperty(guiPropertyPrefix + ".Upcoming.Time", String.Empty);
                GUIPropertyManager.SetProperty(guiPropertyPrefix + ".Upcoming.Description", " ");
                GUIPropertyManager.SetProperty(guiPropertyPrefix + ".Upcoming.thumb", "defaultFolderBig.png");
            }
            else if (upcoming != null)
            {
                GuideProgram guideProgram = upcoming.GuideProgramId.HasValue ?
                                            Proxies.GuideService.GetProgramById(upcoming.GuideProgramId.Value).Result : null;

                string strTime = string.Format("{0} {1} - {2}",
                                               Utility.GetShortDayDateString(upcoming.StartTime),
                                               upcoming.StartTime.ToString("t", CultureInfo.CurrentCulture.DateTimeFormat),
                                               upcoming.StopTime.ToString("t", CultureInfo.CurrentCulture.DateTimeFormat));

                GUIPropertyManager.SetProperty(guiPropertyPrefix + ".Upcoming.Channel", upcoming.Channel.DisplayName);
                GUIPropertyManager.SetProperty(guiPropertyPrefix + ".Upcoming.Title", upcoming.Title);
                GUIPropertyManager.SetProperty(guiPropertyPrefix + ".Upcoming.Genre", upcoming.Category);
                GUIPropertyManager.SetProperty(guiPropertyPrefix + ".Upcoming.Time", strTime);

                string description = String.Empty;
                if (guideProgram != null)
                {
                    description = guideProgram.CreateCombinedDescription(true);
                }
                GUIPropertyManager.SetProperty(guiPropertyPrefix + ".Upcoming.Description", description);

                string logo = Utility.GetLogoImage(upcoming.Channel.ChannelId, upcoming.Channel.DisplayName);
                if (!string.IsNullOrEmpty(logo))
                {
                    GUIPropertyManager.SetProperty(guiPropertyPrefix + ".Upcoming.thumb", logo);
                }
                else
                {
                    GUIPropertyManager.SetProperty(guiPropertyPrefix + ".Upcoming.thumb", "defaultVideoBig.png");
                }
            }
            else
            {
                GUIPropertyManager.SetProperty(guiPropertyPrefix + ".Upcoming.Channel", String.Empty);
                GUIPropertyManager.SetProperty(guiPropertyPrefix + ".Upcoming.Title", String.Empty);
                GUIPropertyManager.SetProperty(guiPropertyPrefix + ".Upcoming.Genre", String.Empty);
                GUIPropertyManager.SetProperty(guiPropertyPrefix + ".Upcoming.Time", String.Empty);
                GUIPropertyManager.SetProperty(guiPropertyPrefix + ".Upcoming.Description", " ");
                GUIPropertyManager.SetProperty(guiPropertyPrefix + ".Upcoming.thumb", String.Empty);
            }
        }
Example #2
0
        private void SetProperties(UpcomingProgram program)
        {
            string guiPropertyPrefix = _channelType == ChannelType.Television ? "#TV" : "#Radio";

            if (program == null)
            {
                Utility.ClearProperty(guiPropertyPrefix + ".Search.Channel");
                Utility.ClearProperty(guiPropertyPrefix + ".Search.Title");
                Utility.ClearProperty(guiPropertyPrefix + ".Search.Genre");
                Utility.ClearProperty(guiPropertyPrefix + ".Search.Time");
                Utility.ClearProperty(guiPropertyPrefix + ".Search.Description");
                Utility.ClearProperty(guiPropertyPrefix + ".Search.thumb");
            }
            else
            {
                string strTime = string.Format("{0} {1} - {2}",
                                               Utility.GetShortDayDateString(program.StartTime),
                                               program.StartTime.ToString("t", CultureInfo.CurrentCulture.DateTimeFormat),
                                               program.StopTime.ToString("t", CultureInfo.CurrentCulture.DateTimeFormat));

                GUIPropertyManager.SetProperty(guiPropertyPrefix + ".Search.Channel", program.Channel.DisplayName);
                GUIPropertyManager.SetProperty(guiPropertyPrefix + ".Search.Title", program.Title);
                GUIPropertyManager.SetProperty(guiPropertyPrefix + ".Search.Genre", program.Category);
                GUIPropertyManager.SetProperty(guiPropertyPrefix + ".Search.Time", strTime);
                string logo = Utility.GetLogoImage(program.Channel.ChannelId, program.Channel.DisplayName, _tvSchedulerAgent);
                if (System.IO.File.Exists(logo))
                {
                    GUIPropertyManager.SetProperty(guiPropertyPrefix + ".Search.thumb", logo);
                }
                else
                {
                    GUIPropertyManager.SetProperty(guiPropertyPrefix + ".Search.thumb", "defaultVideoBig.png");
                }

                GuideProgram guideProgram = GuideAgent.GetProgramById(program.GuideProgramId.Value);
                GUIPropertyManager.SetProperty(guiPropertyPrefix + ".Search.Description", guideProgram.CreateCombinedDescription(true));
            }
        }
Example #3
0
        private GUIListItem CreateListItem(UpcomingProgram upcomingProgram, UpcomingRecording recording, ScheduleSummary schedule)
        {
            GUIListItem item = new GUIListItem();

            if (schedule != null)
            {
                //create list with schedules
                item.Label    = schedule.Name;
                item.IsFolder = true;
                Utils.SetDefaultIcons(item);
                item.PinImage = Utility.GetLogoForSchedule(schedule.ScheduleType, schedule.IsOneTime, schedule.IsActive);
                item.TVTag    = schedule;
                item.IsPlayed = !schedule.IsActive;
            }
            else
            {
                //create list with Upcoming Programs
                string title = upcomingProgram.CreateProgramTitle();
                item.Label = title;
                string logoImagePath = Utility.GetLogoImage(upcomingProgram.Channel);
                if (!Utils.FileExistsInCache(logoImagePath))
                {
                    item.Label    = String.Format("[{0}] {1}", upcomingProgram.Channel.DisplayName, title);
                    logoImagePath = "defaultVideoBig.png";
                }
                item.PinImage = Utility.GetIconImageFileName(_currentProgramType, upcomingProgram.IsPartOfSeries,
                                                             upcomingProgram.CancellationReason, recording);
                item.TVTag          = upcomingProgram;
                item.ThumbnailImage = logoImagePath;
                item.IconImageBig   = logoImagePath;
                item.IconImage      = logoImagePath;
                item.Label2         = String.Format("{0} {1} - {2}", Utility.GetShortDayDateString(upcomingProgram.StartTime),
                                                    upcomingProgram.StartTime.ToString("t", CultureInfo.CurrentCulture.DateTimeFormat),
                                                    upcomingProgram.StopTime.ToString("t", CultureInfo.CurrentCulture.DateTimeFormat));
                item.IsPlayed = upcomingProgram.IsCancelled;
            }
            return(item);
        }
Example #4
0
        private void Update(Schedule _schedule)
        {
            _upcomingEpsiodesList.Clear();
            if (_programTimeLabel != null && _programTitleFadeLabel != null)
            {
                if (_upcomingProgram != null)
                {
                    string strTime = String.Format("{0} {1} - {2}",
                                                   Utility.GetShortDayDateString(_upcomingProgram.StartTime),
                                                   _upcomingProgram.StartTime.ToString("t", CultureInfo.CurrentCulture.DateTimeFormat),
                                                   _upcomingProgram.StopTime.ToString("t", CultureInfo.CurrentCulture.DateTimeFormat));

                    _programTimeLabel.Label      = strTime;
                    _programTitleFadeLabel.Label = _upcomingProgram.Title;
                }
                else
                {
                    _programTimeLabel.Label      = string.Empty;
                    _programTitleFadeLabel.Label = string.Empty;
                }
            }

            if (_schedule != null)
            {
                if (_schedule.ScheduleType == ScheduleType.Recording)
                {
                    var recordings = Proxies.ControlService.GetUpcomingRecordings(_schedule.ScheduleId, true).Result;
                    foreach (UpcomingRecording recording in recordings)
                    {
                        GUIListItem item  = new GUIListItem();
                        string      title = recording.Title;
                        item.Label = title;
                        string logoImagePath = Utility.GetLogoImage(recording.Program.Channel);
                        if (logoImagePath == null ||
                            !System.IO.File.Exists(logoImagePath))
                        {
                            item.Label    = String.Format("[{0}] {1}", recording.Program.Channel.DisplayName, title);
                            logoImagePath = "defaultVideoBig.png";
                        }

                        item.PinImage = Utility.GetIconImageFileName(ScheduleType.Recording, recording.Program.IsPartOfSeries,
                                                                     recording.Program.CancellationReason, recording);

                        item.TVTag          = recording;
                        item.ThumbnailImage = logoImagePath;
                        item.IconImageBig   = logoImagePath;
                        item.IconImage      = logoImagePath;
                        item.Label2         = String.Format("{0} {1} - {2}",
                                                            Utility.GetShortDayDateString(recording.StartTime),
                                                            recording.StartTime.ToString("t", CultureInfo.CurrentCulture.DateTimeFormat),
                                                            recording.StopTime.ToString("t", CultureInfo.CurrentCulture.DateTimeFormat));

                        _upcomingEpsiodesList.Add(item);
                    }
                }
                else
                {
                    var _progs = Proxies.SchedulerService.GetUpcomingPrograms(_schedule, true).Result;
                    foreach (UpcomingProgram program in _progs)
                    {
                        GUIListItem item  = new GUIListItem();
                        string      title = program.Title;
                        item.Label = title;
                        //item.OnItemSelected += new global::MediaPortal.GUI.Library.GUIListItem.ItemSelectedHandler(item_OnItemSelected);
                        string logoImagePath = Utility.GetLogoImage(program.Channel);
                        if (logoImagePath == null ||
                            !System.IO.File.Exists(logoImagePath))
                        {
                            item.Label    = String.Format("[{0}] {1}", program.Channel.DisplayName, title);
                            logoImagePath = "defaultVideoBig.png";
                        }

                        if (_schedule.ScheduleType == ScheduleType.Alert)
                        {
                            item.PinImage = item.PinImage = Utility.GetIconImageFileName(ScheduleType.Alert, program.IsPartOfSeries,
                                                                                         program.CancellationReason, null);
                        }
                        item.TVTag          = program;
                        item.ThumbnailImage = logoImagePath;
                        item.IconImageBig   = logoImagePath;
                        item.IconImage      = logoImagePath;
                        item.Label2         = String.Format("{0} {1} - {2}",
                                                            Utility.GetShortDayDateString(program.StartTime),
                                                            program.StartTime.ToString("t", CultureInfo.CurrentCulture.DateTimeFormat),
                                                            program.StopTime.ToString("t", CultureInfo.CurrentCulture.DateTimeFormat));

                        _upcomingEpsiodesList.Add(item);
                    }
                }
            }
            _upcomingEpisodesLabel.IsVisible = (_upcomingEpsiodesList != null && _upcomingEpsiodesList.Count > 0);
        }
Example #5
0
        private void SetLabels()
        {
            UpcomingRecording[]             upcomingRecordings       = ControlAgent.GetAllUpcomingRecordings(UpcomingRecordingsFilter.All, true);
            UpcomingGuideProgram[]          upcomingAlerts           = SchedulerAgent.GetUpcomingGuidePrograms(ScheduleType.Alert, true);
            UpcomingGuideProgram[]          upcomingSuggestions      = SchedulerAgent.GetUpcomingGuidePrograms(ScheduleType.Suggestion, true);
            UpcomingGuideProgramsDictionary AllUpcomingGuidePrograms = new UpcomingGuideProgramsDictionary(upcomingRecordings, upcomingAlerts, upcomingSuggestions);

            foreach (GUIListItem item in _viewsList.ListItems)
            {
                if (item.Label != _parentDirectoryLabel)
                {
                    UpcomingProgram program = item.TVTag as UpcomingProgram;
                    if (program != null)
                    {
                        if (!item.IsFolder)
                        {
                            item.PinImage = null;
                            Guid upcomingProgramId = program.UpcomingProgramId;
                            if (AllUpcomingGuidePrograms.ContainsKey(upcomingProgramId))
                            {
                                GuideUpcomingProgram programInfo = AllUpcomingGuidePrograms[upcomingProgramId];
                                item.PinImage = Utility.GetIconImageFileName(programInfo.Type, programInfo.IsPartOfSeries,
                                                                             programInfo.CancellationReason, programInfo.UpcomingRecording);
                            }

                            string title = GuideProgram.CreateProgramTitle(program.Title, program.SubTitle, program.EpisodeNumberDisplay);
                            item.Label = title;
                            string logoImagePath = Utility.GetLogoImage(program.Channel, _tvSchedulerAgent);
                            if (logoImagePath == null ||
                                !System.IO.File.Exists(logoImagePath))
                            {
                                item.Label    = String.Format("[{0}] {1}", program.Channel.DisplayName, title);
                                logoImagePath = "defaultVideoBig.png";
                            }

                            item.ThumbnailImage = logoImagePath;
                            item.IconImageBig   = logoImagePath;
                            item.IconImage      = logoImagePath;

                            item.Label2 = String.Format("{0} {1} - {2}", Utility.GetShortDayDateString(program.StartTime),
                                                        program.StartTime.ToString("t", CultureInfo.CurrentCulture.DateTimeFormat),
                                                        program.StopTime.ToString("t", CultureInfo.CurrentCulture.DateTimeFormat));

                            if (_currentSortMethod == SortMethod.Channel)
                            {
                                item.Label3 = program.Channel.DisplayName;
                            }
                            else
                            {
                                item.Label3 = program.Category;
                            }
                        }
                        else
                        {
                            Utils.SetDefaultIcons(item);
                            item.Label = program.Title;
                        }
                    }
                }
            }
            AllUpcomingGuidePrograms.Clear();
            AllUpcomingGuidePrograms = null;
        }