bool CGUIWindowPVRBase::PlayFile(CFileItem *item, bool bPlayMinimized /* = false */, bool bCheckResume /* = true */) { if (item->m_bIsFolder) { return false; } CPVRChannelPtr channel = item->HasPVRChannelInfoTag() ? item->GetPVRChannelInfoTag() : CPVRChannelPtr(); if (item->GetPath() == g_application.CurrentFile() || (channel && channel->HasRecording() && channel->GetRecording()->GetPath() == g_application.CurrentFile())) { CGUIMessage msg(GUI_MSG_FULLSCREEN, 0, GetID()); g_windowManager.SendMessage(msg); return true; } CMediaSettings::GetInstance().SetVideoStartWindowed(bPlayMinimized); if (item->HasPVRRecordingInfoTag()) { return PlayRecording(item, bPlayMinimized, bCheckResume); } else { bool bSwitchSuccessful(false); CPVRChannelPtr channel(item->GetPVRChannelInfoTag()); if (channel && g_PVRManager.CheckParentalLock(channel)) { CPVRRecordingPtr recording = channel->GetRecording(); if (recording) { CGUIDialogYesNo* pDialog = (CGUIDialogYesNo*) g_windowManager.GetWindow(WINDOW_DIALOG_YES_NO); if (pDialog) { pDialog->SetHeading(CVariant{19687}); // Play recording pDialog->SetLine(0, CVariant{""}); pDialog->SetLine(1, CVariant{12021}); // Start from beginning pDialog->SetLine(2, CVariant{recording->m_strTitle}); pDialog->Open(); if (pDialog->IsConfirmed()) { CFileItem recordingItem(recording); return PlayRecording(&recordingItem, CSettings::GetInstance().GetBool(CSettings::SETTING_PVRPLAYBACK_PLAYMINIMIZED), bCheckResume); } } } /* try a fast switch */ if ((g_PVRManager.IsPlayingTV() || g_PVRManager.IsPlayingRadio()) && (channel->IsRadio() == g_PVRManager.IsPlayingRadio())) { if (channel->StreamURL().empty()) bSwitchSuccessful = g_application.m_pPlayer->SwitchChannel(channel); } if (!bSwitchSuccessful) { CApplicationMessenger::GetInstance().PostMsg(TMSG_MEDIA_PLAY, 0, 0, static_cast<void*>(new CFileItem(*item))); return true; } } if (!bSwitchSuccessful) { std::string channelName = g_localizeStrings.Get(19029); // Channel if (channel) channelName = channel->ChannelName(); std::string msg = StringUtils::Format(g_localizeStrings.Get(19035).c_str(), channelName.c_str()); // CHANNELNAME could not be played. Check the log for details. CGUIDialogKaiToast::QueueNotification(CGUIDialogKaiToast::Error, g_localizeStrings.Get(19166), // PVR information msg); return false; } } return true; }
bool CPVRGUIActions::SwitchToChannel(const CFileItemPtr &item, bool bPlayMinimized, bool bCheckResume) const { if (item->m_bIsFolder) return false; const CPVRChannelPtr channel(CPVRItem(item).GetChannel()); if ((channel && g_PVRManager.IsPlayingChannel(channel)) || (channel && channel->HasRecording() && g_PVRManager.IsPlayingRecording(channel->GetRecording()))) { CGUIMessage msg(GUI_MSG_FULLSCREEN, 0, g_windowManager.GetActiveWindow()); g_windowManager.SendMessage(msg); return true; } CMediaSettings::GetInstance().SetVideoStartWindowed(bPlayMinimized); // switch to channel or if recording present, ask whether to switch or play recording... bool bSwitchSuccessful(false); if (channel && g_PVRManager.CheckParentalLock(channel)) { const CPVRRecordingPtr recording(channel->GetRecording()); if (recording) { bool bCancel(false); bool bPlayRecording = CGUIDialogYesNo::ShowAndGetInput(CVariant{19687}, // "Play recording" CVariant{""}, CVariant{12021}, // "Play from beginning" CVariant{recording->m_strTitle}, bCancel, CVariant{19000}, // "Switch to channel" CVariant{19687}, // "Play recording" 0); // no autoclose if (bCancel) return false; if (bPlayRecording) { const CFileItemPtr recordingItem(new CFileItem(recording)); return PlayRecording(recordingItem, CServiceBroker::GetSettings().GetBool(CSettings::SETTING_PVRPLAYBACK_PLAYMINIMIZED), bCheckResume); } } /* try a fast switch */ if ((g_PVRManager.IsPlayingTV() || g_PVRManager.IsPlayingRadio()) && (channel->IsRadio() == g_PVRManager.IsPlayingRadio())) { if (channel->StreamURL().empty()) bSwitchSuccessful = g_application.m_pPlayer->SwitchChannel(channel); } if (!bSwitchSuccessful) { CApplicationMessenger::GetInstance().PostMsg(TMSG_MEDIA_PLAY, 0, 0, static_cast<void*>(new CFileItem(channel))); return true; } } if (!bSwitchSuccessful) { std::string channelName = g_localizeStrings.Get(19029); // Channel if (channel) channelName = channel->ChannelName(); std::string msg = StringUtils::Format(g_localizeStrings.Get(19035).c_str(), channelName.c_str()); // CHANNELNAME could not be played. Check the log for details. CGUIDialogKaiToast::QueueNotification(CGUIDialogKaiToast::Error, g_localizeStrings.Get(19166), msg); // PVR information return false; } return true; }