public void SetProperties(Schedule schedule, Program prog) { GUIPropertyManager.SetProperty("#TV.Scheduled.Title", String.Empty); GUIPropertyManager.SetProperty("#TV.Scheduled.Genre", String.Empty); GUIPropertyManager.SetProperty("#TV.Scheduled.Time", String.Empty); GUIPropertyManager.SetProperty("#TV.Scheduled.Description", String.Empty); GUIPropertyManager.SetProperty("#TV.Scheduled.thumb", String.Empty); GUIPropertyManager.SetProperty("#TV.Scheduled.Channel", String.Empty); GUIPropertyManager.SetProperty("#TV.Scheduled.Title", prog.Title); GUIPropertyManager.SetProperty("#TV.Scheduled.Time", TVUtil.GetRecordingDateStringFull(schedule)); if (prog != null) { GUIPropertyManager.SetProperty("#TV.Scheduled.Channel", prog.ReferencedChannel().DisplayName); GUIPropertyManager.SetProperty("#TV.Scheduled.Description", prog.Description); GUIPropertyManager.SetProperty("#TV.Scheduled.Genre", prog.Genre); } else { GUIPropertyManager.SetProperty("#TV.Scheduled.Description", String.Empty); GUIPropertyManager.SetProperty("#TV.Scheduled.Genre", String.Empty); } string logo = Utils.GetCoverArt(Thumbs.TVChannel, schedule.ReferencedChannel().DisplayName); if (string.IsNullOrEmpty(logo)) { GUIPropertyManager.SetProperty("#TV.Scheduled.thumb", "defaultVideoBig.png"); } else { GUIPropertyManager.SetProperty("#TV.Scheduled.thumb", logo); } }
private void SetCurrentChannelLogo() { string strLogo = null; if (LastError != null) { strLogo = TVUtil.GetChannelLogo(LastError.FailingChannel); } else { strLogo = TVUtil.GetChannelLogo(TVHome.Navigator.ZapChannel); } if (string.IsNullOrEmpty(strLogo)) { if (imgTvChannelLogo != null) { imgTvChannelLogo.IsVisible = false; } } else { if (imgTvChannelLogo != null) { imgTvChannelLogo.SetFileName(strLogo); //img.SetPosition(GUIGraphicsContext.OverScanLeft, GUIGraphicsContext.OverScanTop); m_bNeedRefresh = true; imgTvChannelLogo.IsVisible = true; } } ShowPrograms(); }
private void Update() { if (currentProgram == null) { return; } lblProgramGenre.Label = currentProgram.Genre; lblProgramTime.Label = TVUtil.GetRecordingDateStringFull(currentProgram); lblProgramDescription.Label = currentProgram.Description; lblProgramTitle.Label = currentProgram.Title; }
protected override void OnPageLoad() { base.OnPageLoad(); if (util == null) { util = new TVUtil(31); } LoadDirectory(); while (m_iSelectedItem >= GetItemCount() && m_iSelectedItem > 0) { m_iSelectedItem--; } GUIControl.SelectItemControl(GetID, listPriorities.GetID, m_iSelectedItem); }
private void Search() { Log.Info("newsearch Search:{0} {1}", _searchKeyword, SearchFor); GUIControl.ClearControl(GetID, listResults.GetID); TvBusinessLayer layer = new TvBusinessLayer(); IList <Program> listPrograms = null; switch (SearchFor) { case SearchType.Genres: listPrograms = layer.SearchProgramsPerGenre("%" + _searchKeyword + "%", ""); break; case SearchType.KeyWord: listPrograms = layer.SearchProgramsByDescription("%" + _searchKeyword); break; case SearchType.Title: listPrograms = layer.SearchPrograms("%" + _searchKeyword); break; } if (listPrograms == null) { return; } if (listPrograms.Count == 0) { return; } Log.Info("newsearch found:{0} progs", listPrograms.Count); foreach (Program program in listPrograms) { GUIListItem item = new GUIListItem(); item.Label = TVUtil.GetDisplayTitle(program); string logo = Utils.GetCoverArt(Thumbs.TVChannel, program.ReferencedChannel().DisplayName); if (string.IsNullOrEmpty(logo)) { logo = "defaultVideoBig.png"; } item.ThumbnailImage = logo; item.IconImageBig = logo; item.IconImage = logo; item.TVTag = program; listResults.Add(item); } }
public static string GetDisplayTitle(Schedule schedule) { string displayname = ""; Program program = Program.RetrieveByTitleTimesAndChannel(schedule.ProgramName, schedule.StartTime, schedule.EndTime, schedule.IdChannel); //if we have found program details then use nicely formatted name if (program != null) { displayname = TVUtil.GetDisplayTitle(program); } else { displayname = schedule.ProgramName; } return(displayname); }
private void SetProperties(Schedule rec) { GUIPropertyManager.SetProperty("#TV.RecordedTV.Title", rec.ProgramName); GUIPropertyManager.SetProperty("#TV.RecordedTV.Genre", ""); GUIPropertyManager.SetProperty("#TV.RecordedTV.Time", TVUtil.GetRecordingDateStringFull(rec)); GUIPropertyManager.SetProperty("#TV.RecordedTV.Description", ""); string strLogo = Utils.GetCoverArt(Thumbs.TVChannel, rec.ReferencedChannel().DisplayName); if (string.IsNullOrEmpty(strLogo)) { GUIPropertyManager.SetProperty("#TV.RecordedTV.thumb", "defaultVideoBig.png"); } else { GUIPropertyManager.SetProperty("#TV.RecordedTV.thumb", strLogo); } }
public void SetProperties(Schedule schedule, Program prog) { GUIPropertyManager.SetProperty("#TV.Scheduled.Title", String.Empty); GUIPropertyManager.SetProperty("#TV.Scheduled.Genre", String.Empty); GUIPropertyManager.SetProperty("#TV.Scheduled.Time", String.Empty); GUIPropertyManager.SetProperty("#TV.Scheduled.Description", String.Empty); GUIPropertyManager.SetProperty("#TV.Scheduled.thumb", String.Empty); GUIPropertyManager.SetProperty("#TV.Scheduled.Channel", String.Empty); if (prog != null) { GUIPropertyManager.SetProperty("#TV.Scheduled.Title", TVUtil.GetDisplayTitle(prog)); GUIPropertyManager.SetProperty("#TV.Scheduled.Description", prog.Description); GUIPropertyManager.SetProperty("#TV.Scheduled.Genre", prog.Genre); } if (schedule != null) { string strTime = String.Format("{0} {1} - {2}", Utils.GetShortDayString(schedule.StartTime), schedule.StartTime.ToString("t", CultureInfo.CurrentCulture.DateTimeFormat), schedule.EndTime.ToString("t", CultureInfo.CurrentCulture.DateTimeFormat)); GUIPropertyManager.SetProperty("#TV.Scheduled.Time", strTime); if (schedule.IdChannel < 0) { GUIPropertyManager.SetProperty("#TV.Scheduled.thumb", "defaultVideoBig.png"); } else { GUIPropertyManager.SetProperty("#TV.Scheduled.Channel", schedule.ReferencedChannel().DisplayName); string logo = Utils.GetCoverArt(Thumbs.TVChannel, schedule.ReferencedChannel().DisplayName); if (string.IsNullOrEmpty(logo)) { GUIPropertyManager.SetProperty("#TV.Scheduled.thumb", "defaultVideoBig.png"); } else { GUIPropertyManager.SetProperty("#TV.Scheduled.thumb", logo); } } } }
private static string GetRecordingTitle(int IdSchedule) { string recordingTitle = ""; Schedule schedule = Schedule.Retrieve(IdSchedule); if (schedule != null) { Schedule spawnedSchedule = Schedule.RetrieveSpawnedSchedule(IdSchedule, schedule.StartTime); if (spawnedSchedule != null) { recordingTitle = TVUtil.GetDisplayTitle(Recording.ActiveRecording(spawnedSchedule.IdSchedule)); } else { recordingTitle = TVUtil.GetDisplayTitle(Recording.ActiveRecording(IdSchedule)); } } return(recordingTitle); }
private void OnShowContextMenu(int iItem, bool clicked) { m_iSelectedItem = iItem; GUIListItem item = GetItem(iItem); if (item == null) { return; } if (item.IsFolder && clicked) { bool noitems = false; if (item.Label == "..") { if (selectedItem != null) { selectedItem = null; } LoadDirectory(); return; } if (selectedItem == null) { IList <Schedule> seriesList = TVHome.Util.GetRecordingTimes(item.TVTag as Schedule); if (seriesList.Count < 1) { noitems = true; // no items existing } else { selectedItem = item.TVTag as Schedule; } } if (noitems == false) { LoadDirectory(); return; } } bool showSeries = btnSeries.Selected; Schedule rec = item.TVTag as Schedule; if (rec == null) { return; } Log.Info("OnShowContextMenu: Rec = {0}", rec.ToString()); GUIDialogMenu dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_MENU); if (dlg == null) { return; } dlg.Reset(); dlg.SetHeading(rec.ProgramName); if (showSeries && item.IsFolder) { dlg.AddLocalizedString(982); //Cancel this show (618=delete) dlg.AddLocalizedString(888); //Episodes management } else if (rec.Series == false) { dlg.AddLocalizedString(618); //delete } else { dlg.AddLocalizedString(981); //Cancel this show dlg.AddLocalizedString(982); //Delete this entire recording dlg.AddLocalizedString(888); //Episodes management } VirtualCard card; TvServer server = new TvServer(); bool isRec = Schedule.IsScheduleRecording(rec.IdSchedule); //TVHome.IsRecordingSchedule(rec, null, out card); if (isRec) { dlg.AddLocalizedString(979); //Play recording from beginning dlg.AddLocalizedString(980); //Play recording from live point } //Schedule schedDB = Schedule.Retrieve(rec.IdSchedule); //if (schedDB.ScheduleType != (int)ScheduleRecordingType.Once) //{ dlg.AddLocalizedString(1048); // settings //} dlg.DoModal(GetID); if (dlg.SelectedLabel == -1) { return; } bool isSchedRec = TvDatabase.Schedule.IsScheduleRecording(rec.IdSchedule); //TVHome.IsRecordingSchedule(rec, null, out card); string fileName = ""; if (isSchedRec) { bool isCardRec = server.IsRecording(rec.ReferencedChannel().IdChannel, out card); if (isCardRec && card != null) { fileName = card.RecordingFileName; } } Log.Info("recording fname:{0}", fileName); switch (dlg.SelectedId) { case 888: ////Episodes management TvPriorities.OnSetEpisodesToKeep(rec); break; case 1048: ////settings Schedule schedule = item.MusicTag as Schedule; if (schedule == null) { schedule = item.TVTag as Schedule; } if (schedule != null) { TVProgramInfo.CurrentRecording = schedule; GUIWindowManager.ActivateWindow((int)Window.WINDOW_TV_PROGRAM_INFO); } return; case 882: ////Quality settings TvPriorities.OnSetQuality(rec); break; case 981: //Cancel this show { var layer = new TvBusinessLayer(); // get the program that this episode is for var progs = layer.GetPrograms(rec.ReferencedChannel(), rec.StartTime, rec.EndTime); // pick up the schedule that is actually used for recording // see TVUtil.GetRecordingTimes where schedules are all spawend as one off types // and this is what rec is (ie. it does not actually exist in the database) var realSchedule = Schedule.Retrieve(rec.IdParentSchedule) ?? rec; bool res = TVUtil.DeleteRecAndSchedWithPrompt(realSchedule, progs[0]); if (res) { LoadDirectory(); } } break; case 982: //Delete series recording goto case 618; case 618: // delete entire recording { bool res = TVUtil.DeleteRecAndEntireSchedWithPrompt(rec, rec.StartTime); if (res) { if (showSeries && !item.IsFolder) { OnShowContextMenu(0, true); return; } else { LoadDirectory(); } } } break; case 979: // Play recording from beginning { Recording recDB = Recording.Retrieve(fileName); if (recDB != null) { TVUtil.PlayRecording(recDB); } } return; case 980: // Play recording from live point { TVHome.ViewChannelAndCheck(rec.ReferencedChannel()); if (g_Player.Playing) { g_Player.ShowFullScreenWindow(); } /* * g_Player.Stop(); * if (System.IO.File.Exists(fileName)) * { * g_Player.Play(fileName, g_Player.MediaType.Recording); * g_Player.SeekAbsolute(g_Player.Duration); * g_Player.ShowFullScreenWindow(); * return; * } * else * { * string url = server.GetRtspUrlForFile(fileName); * Log.Info("recording url:{0}", url); * if (url.Length > 0) * { * g_Player.Play(url, g_Player.MediaType.Recording); * * if (g_Player.Playing) * { * g_Player.SeekAbsolute(g_Player.Duration); * g_Player.SeekAbsolute(g_Player.Duration); * g_Player.ShowFullScreenWindow(); * return; * } * } * }*/ } break; } while (m_iSelectedItem >= GetItemCount() && m_iSelectedItem > 0) { m_iSelectedItem--; } GUIControl.SelectItemControl(GetID, listSchedules.GetID, m_iSelectedItem); }
private void SetLabels() { bool showSeries = btnSeries.Selected; for (int i = 0; i < GetItemCount(); ++i) { GUIListItem item = GetItem(i); if (item.IsFolder && item.Label.Equals("..")) { continue; } Schedule rec = (Schedule)item.TVTag; item.Label = TVUtil.GetDisplayTitle(rec); if (showSeries) { string strTime; string strType; string day; switch (rec.ScheduleType) { case (int)ScheduleRecordingType.Once: item.Label2 = String.Format("{0} {1} - {2}", Utils.GetShortDayString(rec.StartTime), rec.StartTime.ToString("t", CultureInfo.CurrentCulture.DateTimeFormat), rec.EndTime.ToString("t", CultureInfo.CurrentCulture.DateTimeFormat)); ; break; case (int)ScheduleRecordingType.Daily: strTime = String.Format("{0}-{1}", rec.StartTime.ToString("t", CultureInfo.CurrentCulture.DateTimeFormat), rec.EndTime.ToString("t", CultureInfo.CurrentCulture.DateTimeFormat)); strType = GUILocalizeStrings.Get(648); item.Label2 = String.Format("{0} {1}", strType, strTime); break; case (int)ScheduleRecordingType.WorkingDays: strTime = String.Format("{0}-{1} {2}-{3}", GUILocalizeStrings.Get(WeekEndTool.GetText(DayType.FirstWorkingDay)), GUILocalizeStrings.Get(WeekEndTool.GetText(DayType.LastWorkingDay)), rec.StartTime.ToString("t", CultureInfo.CurrentCulture.DateTimeFormat), rec.EndTime.ToString("t", CultureInfo.CurrentCulture.DateTimeFormat)); strType = GUILocalizeStrings.Get(648); item.Label2 = String.Format("{0} {1}", strType, strTime); break; case (int)ScheduleRecordingType.Weekends: strTime = String.Format("{0}-{1} {2}-{3}", GUILocalizeStrings.Get(WeekEndTool.GetText(DayType.FirstWeekendDay)), GUILocalizeStrings.Get(WeekEndTool.GetText(DayType.LastWeekendDay)), rec.StartTime.ToString("t", CultureInfo.CurrentCulture.DateTimeFormat), rec.EndTime.ToString("t", CultureInfo.CurrentCulture.DateTimeFormat)); strType = GUILocalizeStrings.Get(649); item.Label2 = String.Format("{0} {1}", strType, strTime); break; case (int)ScheduleRecordingType.Weekly: switch (rec.StartTime.DayOfWeek) { case DayOfWeek.Monday: day = GUILocalizeStrings.Get(11); break; case DayOfWeek.Tuesday: day = GUILocalizeStrings.Get(12); break; case DayOfWeek.Wednesday: day = GUILocalizeStrings.Get(13); break; case DayOfWeek.Thursday: day = GUILocalizeStrings.Get(14); break; case DayOfWeek.Friday: day = GUILocalizeStrings.Get(15); break; case DayOfWeek.Saturday: day = GUILocalizeStrings.Get(16); break; default: day = GUILocalizeStrings.Get(17); break; } strTime = String.Format("{0}-{1}", rec.StartTime.ToString("t", CultureInfo.CurrentCulture.DateTimeFormat), rec.EndTime.ToString("t", CultureInfo.CurrentCulture.DateTimeFormat)); strType = GUILocalizeStrings.Get(649); item.Label2 = String.Format("{0} {1} {2}", strType, day, strTime); break; case (int)ScheduleRecordingType.EveryTimeOnThisChannel: item.Label2 = GUILocalizeStrings.Get(650, new object[] { rec.ReferencedChannel().DisplayName }); break; case (int)ScheduleRecordingType.EveryTimeOnEveryChannel: item.Label2 = GUILocalizeStrings.Get(651); break; case (int)ScheduleRecordingType.WeeklyEveryTimeOnThisChannel: switch (rec.StartTime.DayOfWeek) { case DayOfWeek.Monday: day = GUILocalizeStrings.Get(11); break; case DayOfWeek.Tuesday: day = GUILocalizeStrings.Get(12); break; case DayOfWeek.Wednesday: day = GUILocalizeStrings.Get(13); break; case DayOfWeek.Thursday: day = GUILocalizeStrings.Get(14); break; case DayOfWeek.Friday: day = GUILocalizeStrings.Get(15); break; case DayOfWeek.Saturday: day = GUILocalizeStrings.Get(16); break; default: day = GUILocalizeStrings.Get(17); break; } item.Label2 = GUILocalizeStrings.Get(990001, new object[] { day, rec.ReferencedChannel().DisplayName }); break; } } else { Program program = Program.RetrieveByTitleTimesAndChannel(rec.ProgramName, rec.StartTime, rec.EndTime, rec.IdChannel); if (program != null) { item.Label2 = Utils.GetNamedDateStartEnd(rec.StartTime, rec.EndTime); } else { item.Label2 = String.Empty; } } } }
public Radio() { TVUtil.SetGentleConfigFile(); GetID = (int)Window.WINDOW_RADIO; }
/// <summary> /// Fill the list with channels /// </summary> public void FillChannelList() { List <Channel> tvChannelList = GetChannelListByGroup(); benchClock = Stopwatch.StartNew(); DateTime nextEPGupdate = GetNextEpgUpdate(); Dictionary <int, NowAndNext> listNowNext = GetNowAndNext(tvChannelList, nextEPGupdate); benchClock.Stop(); Log.Debug("TvMiniGuide: FillChannelList retrieved {0} programs for {1} channels in {2} ms", listNowNext.Count, tvChannelList.Count, benchClock.ElapsedMilliseconds.ToString()); GUIListItem item = null; string ChannelLogo = ""; //List<int> RecChannels = null; //List<int> TSChannels = null; int SelectedID = 0; int channelID = 0; bool DisplayStatusInfo = true; Dictionary <int, ChannelState> tvChannelStatesList = null; if (TVHome.ShowChannelStateIcons()) { benchClock.Reset(); benchClock.Start(); if (TVHome.Navigator.CurrentGroup.GroupName.Equals(TvConstants.TvGroupNames.AllChannels) || (!g_Player.IsTV && !g_Player.Playing)) { //we have no way of using the cached channelstates on the server in the following situations. // 1) when the "all channels" group is selected - too many channels. // 2) when user is not timeshifting - no user object on the server. User currentUser = new User(); tvChannelStatesList = TVHome.TvServer.GetAllChannelStatesForGroup(TVHome.Navigator.CurrentGroup.IdGroup, currentUser); } else { // use the more speedy approach // ask the server of the cached list of channel states corresponding to the user. tvChannelStatesList = TVHome.TvServer.GetAllChannelStatesCached(TVHome.Card.User); if (tvChannelStatesList == null) { //slow approach. tvChannelStatesList = TVHome.TvServer.GetAllChannelStatesForGroup(TVHome.Navigator.CurrentGroup.IdGroup, TVHome.Card.User); } } benchClock.Stop(); if (tvChannelStatesList != null) { Log.Debug("TvMiniGuide: FillChannelList - {0} channel states for group retrieved in {1} ms", Convert.ToString(tvChannelStatesList.Count), benchClock.ElapsedMilliseconds.ToString()); } } for (int i = 0; i < tvChannelList.Count; i++) { Channel CurrentChan = tvChannelList[i]; if (CurrentChan.VisibleInGuide) { ChannelState CurrentChanState = ChannelState.tunable; channelID = CurrentChan.IdChannel; if (TVHome.ShowChannelStateIcons()) { if (!tvChannelStatesList.TryGetValue(channelID, out CurrentChanState)) { CurrentChanState = ChannelState.tunable; } } //StringBuilder sb = new StringBuilder(); sb.Length = 0; item = new GUIListItem(""); // store here as it is not needed right now - please beat me later.. item.TVTag = CurrentChan; sb.Append(CurrentChan.DisplayName); ChannelLogo = Utils.GetCoverArt(Thumbs.TVChannel, CurrentChan.DisplayName); // if we are watching this channel mark it if (TVHome.Navigator != null && TVHome.Navigator.Channel != null && TVHome.Navigator.Channel.IdChannel == channelID) { item.IsRemote = true; SelectedID = lstChannels.Count; } if (!string.IsNullOrEmpty(ChannelLogo)) { item.IconImageBig = ChannelLogo; item.IconImage = ChannelLogo; } else { item.IconImageBig = string.Empty; item.IconImage = string.Empty; } if (DisplayStatusInfo) { bool showChannelStateIcons = (TVHome.ShowChannelStateIcons() && lstChannelsWithStateIcons != null); switch (CurrentChanState) { case ChannelState.nottunable: item.IsPlayed = true; if (showChannelStateIcons) { item.PinImage = Thumbs.TvIsUnavailableIcon; } else { sb.Append(" "); sb.Append(local1056); } break; case ChannelState.timeshifting: if (showChannelStateIcons) { item.PinImage = Thumbs.TvIsTimeshiftingIcon; } else { sb.Append(" "); sb.Append(local1055); } break; case ChannelState.recording: if (showChannelStateIcons) { item.PinImage = Thumbs.TvIsRecordingIcon; } else { sb.Append(" "); sb.Append(local1054); } break; default: item.IsPlayed = false; if (showChannelStateIcons) { item.PinImage = Thumbs.TvIsAvailableIcon; } break; } } //StringBuilder sbTmp = new StringBuilder(); sbTmp.Length = 0; NowAndNext currentNowAndNext = null; bool hasNowNext = listNowNext.TryGetValue(channelID, out currentNowAndNext); if (hasNowNext) { if (!string.IsNullOrEmpty(currentNowAndNext.TitleNow)) { TVUtil.TitleDisplay(sbTmp, currentNowAndNext.TitleNow, currentNowAndNext.EpisodeName, currentNowAndNext.SeriesNum, currentNowAndNext.EpisodeNum, currentNowAndNext.EpisodePart); } else { sbTmp.Append(local736); } } else { sbTmp.Append(local736); } item.Label2 = sbTmp.ToString(); sbTmp.Insert(0, local789); item.Label3 = sbTmp.ToString(); sbTmp.Length = 0; if (_showChannelNumber == true) { sb.Append(" - "); if (!_byIndex) { sb.Append(tvChannelList[i].ChannelNumber); } else { sb.Append(i + 1); } } if (hasNowNext) { // if the "Now" DB entry is in the future we set MinValue intentionally to avoid wrong percentage calculations DateTime startTime = currentNowAndNext.NowStartTime; if (startTime != SqlDateTime.MinValue.Value) { DateTime endTime = currentNowAndNext.NowEndTime; sb.Append(" - "); sb.Append( CalculateProgress(startTime, endTime).ToString()); sb.Append("%"); if (endTime < nextEPGupdate || nextEPGupdate == DateTime.MinValue) { nextEPGupdate = endTime; SetNextEpgUpdate(endTime); } } } if (hasNowNext && listNowNext[channelID].IdProgramNext != -1) { TVUtil.TitleDisplay(sbTmp, currentNowAndNext.TitleNext, currentNowAndNext.EpisodeNameNext, currentNowAndNext.SeriesNumNext, currentNowAndNext.EpisodeNumNext, currentNowAndNext.EpisodePartNext); } else { sbTmp.Append(local736); } item.Label2 = sb.ToString(); sbTmp.Insert(0, local790); item.Label = sbTmp.ToString(); lstChannels.Add(item); } } benchClock.Stop(); Log.Debug("TvMiniGuide: State check + filling completed after {0} ms", benchClock.ElapsedMilliseconds.ToString()); lstChannels.SelectedListItemIndex = SelectedID; if (lstChannels.GetID == 37) { GUIMessage msg = new GUIMessage(GUIMessage.MessageType.GUI_MSG_SETFOCUS, GetID, 0, 37, 0, 0, null); OnMessage(msg); } sb.Length = 0; sbTmp.Length = 0; }