Skip to content

Commit

Permalink
[pvr] fixed: always ask to resume recordings, not just when played fr…
Browse files Browse the repository at this point in the history
…om the recordings window
  • Loading branch information
opdenkamp committed Mar 5, 2015
1 parent 61e0b53 commit 989c853
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 19 deletions.
29 changes: 24 additions & 5 deletions xbmc/pvr/windows/GUIWindowPVRBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
#include "input/Key.h"
#include "guilib/GUIMessage.h"
#include "guilib/GUIWindowManager.h"
#include "GUIWindowPVRRecordings.h"
#include "pvr/PVRManager.h"
#include "pvr/addons/PVRClients.h"
#include "pvr/dialogs/GUIDialogPVRGuideInfo.h"
Expand Down Expand Up @@ -266,14 +267,14 @@ void CGUIWindowPVRBase::SetGroup(CPVRChannelGroupPtr group)
}
}

bool CGUIWindowPVRBase::PlayFile(CFileItem *item, bool bPlayMinimized /* = false */)
bool CGUIWindowPVRBase::PlayFile(CFileItem *item, bool bPlayMinimized /* = false */, bool bCheckResume /* = true */)
{
if (item->m_bIsFolder)
{
return false;
}

CPVRChannel *channel = item->HasPVRChannelInfoTag() ? item->GetPVRChannelInfoTag() : NULL;
CPVRChannelPtr channel = item->HasPVRChannelInfoTag() ? item->GetPVRChannelInfoTag() : CPVRChannelPtr();
if (item->GetPath() == g_application.CurrentFile() ||
(channel && channel->HasRecording() && channel->GetRecording()->GetPath() == g_application.CurrentFile()))
{
Expand All @@ -286,7 +287,7 @@ bool CGUIWindowPVRBase::PlayFile(CFileItem *item, bool bPlayMinimized /* = false

if (item->HasPVRRecordingInfoTag())
{
return PlayRecording(item, bPlayMinimized);
return PlayRecording(item, bPlayMinimized, bCheckResume);
}
else
{
Expand All @@ -310,7 +311,7 @@ bool CGUIWindowPVRBase::PlayFile(CFileItem *item, bool bPlayMinimized /* = false
if (pDialog->IsConfirmed())
{
CFileItem recordingItem(recording);
return PlayRecording(&recordingItem, CSettings::Get().GetBool("pvrplayback.playminimized"));
return PlayRecording(&recordingItem, CSettings::Get().GetBool("pvrplayback.playminimized"), bCheckResume);
}
}
}
Expand Down Expand Up @@ -403,14 +404,30 @@ bool CGUIWindowPVRBase::StopRecordFile(const CFileItem &item)
return g_PVRTimers->DeleteTimer(*timer);
}

bool CGUIWindowPVRBase::PlayRecording(CFileItem *item, bool bPlayMinimized /* = false */)
void CGUIWindowPVRBase::CheckResumeRecording(CFileItem *item)
{
std::string resumeString = CGUIWindowPVRRecordings::GetResumeString(*item);
if (!resumeString.empty())
{
CContextButtons choices;
choices.Add(CONTEXT_BUTTON_RESUME_ITEM, resumeString);
choices.Add(CONTEXT_BUTTON_PLAY_ITEM, 12021); // Start from beginning
int choice = CGUIDialogContextMenu::ShowAndGetChoice(choices);
if (choice > 0)
item->m_lStartOffset = choice == CONTEXT_BUTTON_RESUME_ITEM ? STARTOFFSET_RESUME : 0;
}
}

bool CGUIWindowPVRBase::PlayRecording(CFileItem *item, bool bPlayMinimized /* = false */, bool bCheckResume /* = true */)
{
if (!item->HasPVRRecordingInfoTag())
return false;

std::string stream = item->GetPVRRecordingInfoTag()->m_strStreamURL;
if (stream.empty())
{
if (bCheckResume)
CheckResumeRecording(item);
CApplicationMessenger::Get().PlayFile(*item, false);
return true;
}
Expand Down Expand Up @@ -461,6 +478,8 @@ bool CGUIWindowPVRBase::PlayRecording(CFileItem *item, bool bPlayMinimized /* =
return false;
}

if (bCheckResume)
CheckResumeRecording(item);
CApplicationMessenger::Get().PlayFile(*item, false);

return true;
Expand Down
5 changes: 3 additions & 2 deletions xbmc/pvr/windows/GUIWindowPVRBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,14 +87,15 @@ namespace PVR
virtual bool ActionDeleteChannel(CFileItem *item);
virtual bool ActionInputChannelNumber(int input);

virtual bool PlayRecording(CFileItem *item, bool bPlayMinimized = false);
virtual bool PlayFile(CFileItem *item, bool bPlayMinimized = false);
virtual bool PlayRecording(CFileItem *item, bool bPlayMinimized = false, bool bCheckResume = true);
virtual bool PlayFile(CFileItem *item, bool bPlayMinimized = false, bool bCheckResume = true);
virtual bool StartRecordFile(const CFileItem &item);
virtual bool StopRecordFile(const CFileItem &item);
virtual void ShowEPGInfo(CFileItem *item);
virtual void ShowRecordingInfo(CFileItem *item);
virtual bool UpdateEpgForChannel(CFileItem *item);
virtual void UpdateSelectedItemPath();
void CheckResumeRecording(CFileItem *item);

static std::map<bool, std::string> m_selectedItemPaths;

Expand Down
14 changes: 2 additions & 12 deletions xbmc/pvr/windows/GUIWindowPVRRecordings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -251,18 +251,8 @@ bool CGUIWindowPVRRecordings::OnMessage(CGUIMessage &message)
case ACTION_MOUSE_LEFT_CLICK:
case ACTION_PLAY:
{
CFileItemPtr pItem = m_vecItems->Get(iItem);
std::string resumeString = GetResumeString(*pItem);
if (!resumeString.empty())
{
CContextButtons choices;
choices.Add(CONTEXT_BUTTON_RESUME_ITEM, resumeString);
choices.Add(CONTEXT_BUTTON_PLAY_ITEM, 12021);
int choice = CGUIDialogContextMenu::ShowAndGetChoice(choices);
if (choice > 0)
OnContextButtonPlay(pItem.get(), (CONTEXT_BUTTON)choice);
bReturn = true;
}
PlayFile(m_vecItems->Get(iItem).get());
bReturn = true;
break;
}
case ACTION_CONTEXT_MENU:
Expand Down

0 comments on commit 989c853

Please sign in to comment.