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 ShowPrograms() { if (lblOnTvNow != null) { lblOnTvNow.EnableUpDown = false; lblOnTvNow.Clear(); } if (lblOnTvNext != null) { lblOnTvNext.EnableUpDown = false; lblOnTvNext.Clear(); } // Set recorder status if (imgRecIcon != null) { VirtualCard card; TvServer server = new TvServer(); imgRecIcon.IsVisible = server.IsRecording(idChannel, out card); } if (lblZapToCannelNo != null) { lblZapToCannelNo.Label = channelNr; lblZapToCannelNo.Visible = !string.IsNullOrEmpty(channelNr); } if (LastError != null) { lblStartTime.Label = ""; lblEndTime.Label = ""; if (LastError.FailingChannel != null) { lblCurrentChannel.Label = LastError.FailingChannel.DisplayName; } if (LastError.Messages.Count > 0) { lblOnTvNow.Label = LastError.Messages[0]; // first line in "NOW" if (LastError.Messages.Count > 1) { lblOnTvNext.Label = String.Join(", ", LastError.Messages.ToArray(), 1, LastError.Messages.Count - 1); // 2nd and later in "NEXT" } } m_lastError = null; // reset member only, not the failing channel info in Navigator } else { if (lblCurrentChannel != null) { lblCurrentChannel.Label = channelName; } Channel chan = TVHome.Navigator.GetChannel(idChannel, true); Program prog = chan.GetProgramAt(m_dateTime); if (prog != null) { string strTime = String.Format("{0}-{1}", prog.StartTime.ToString("t", CultureInfo.CurrentCulture.DateTimeFormat), prog.EndTime.ToString("t", CultureInfo.CurrentCulture.DateTimeFormat)); if (lblCurrentTime != null) { lblCurrentTime.Label = strTime; } if (lblOnTvNow != null) { lblOnTvNow.Label = prog.Title; } if (lblStartTime != null) { strTime = String.Format("{0}", prog.StartTime.ToString("t", CultureInfo.CurrentCulture.DateTimeFormat)); lblStartTime.Label = strTime; } if (lblEndTime != null) { strTime = String.Format("{0} ", prog.EndTime.ToString("t", CultureInfo.CurrentCulture.DateTimeFormat)); lblEndTime.Label = strTime; } // next program prog = chan.GetProgramAt(prog.EndTime.AddMinutes(1)); //prog = TVHome.Navigator.GetChannel(channelName).GetProgramAt(prog.EndTime.AddMinutes(1)); if (prog != null) { if (lblOnTvNext != null) { lblOnTvNext.Label = prog.Title; } } } else { lblOnTvNow.Label = GUILocalizeStrings.Get(736); // no epg for this channel if (lblStartTime != null) { lblStartTime.Label = String.Empty; } if (lblEndTime != null) { lblEndTime.Label = String.Empty; } if (lblCurrentTime != null) { lblCurrentTime.Label = String.Empty; } } } UpdateProgressBar(); }