diff options
author | Dave Blake <oak99sky@yahoo.co.uk> | 2018-09-25 08:40:39 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-09-25 08:40:39 +0100 |
commit | 5ff20e64e82ff57a8dd23a7763442c913793b8eb (patch) | |
tree | a02e87ba36b722ff863461ee5d8f32bf4fc69c42 | |
parent | 77ca350adba41f83f6b9f108d09f8b2bdf62b5c6 (diff) | |
parent | 16601218e01283d3817720d40ca8e4e3f2997106 (diff) |
Merge pull request #14454 from DaveTBlake/JSONPlayerGetItemFix
[JSON]Fix Player.GetItem during track change seg fault
-rw-r--r-- | xbmc/interfaces/json-rpc/PlayerOperations.cpp | 18 | ||||
-rw-r--r-- | xbmc/interfaces/json-rpc/schema/version.txt | 2 |
2 files changed, 15 insertions, 5 deletions
diff --git a/xbmc/interfaces/json-rpc/PlayerOperations.cpp b/xbmc/interfaces/json-rpc/PlayerOperations.cpp index 619d7a107c..816d4fd120 100644 --- a/xbmc/interfaces/json-rpc/PlayerOperations.cpp +++ b/xbmc/interfaces/json-rpc/PlayerOperations.cpp @@ -153,32 +153,42 @@ JSONRPC_STATUS CPlayerOperations::GetItem(const std::string &method, ITransportL } else if (player == Video) { - if (!CVideoLibrary::FillFileItem(g_application.CurrentFile(), fileItem, parameterObject)) + if (!CVideoLibrary::FillFileItem(fileItem->GetPath(), fileItem, parameterObject)) { + // Fallback to item details held by GUI but ensure path unchanged + //! @todo remove this once there is no route to playback that updates + // GUI item without also updating app item e.g. start playback of a + // non-library item via JSON const CVideoInfoTag *currentVideoTag = CServiceBroker::GetGUI()->GetInfoManager().GetCurrentMovieTag(); if (currentVideoTag != NULL) { std::string originalLabel = fileItem->GetLabel(); + std::string originalPath = fileItem->GetPath(); fileItem->SetFromVideoInfoTag(*currentVideoTag); if (fileItem->GetLabel().empty()) fileItem->SetLabel(originalLabel); + fileItem->SetPath(originalPath); // Ensure path unchanged } - fileItem->SetPath(g_application.CurrentFileItem().GetPath()); } } else { - if (!CAudioLibrary::FillFileItem(g_application.CurrentFile(), fileItem, parameterObject)) + if (!CAudioLibrary::FillFileItem(fileItem->GetPath(), fileItem, parameterObject)) { + // Fallback to item details held by GUI but ensure path unchanged + //! @todo remove this once there is no route to playback that updates + // GUI item without also updating app item e.g. start playback of a + // non-library item via JSON const MUSIC_INFO::CMusicInfoTag *currentMusicTag = CServiceBroker::GetGUI()->GetInfoManager().GetCurrentSongTag(); if (currentMusicTag != NULL) { std::string originalLabel = fileItem->GetLabel(); + std::string originalPath = fileItem->GetPath(); fileItem->SetFromMusicInfoTag(*currentMusicTag); if (fileItem->GetLabel().empty()) fileItem->SetLabel(originalLabel); + fileItem->SetPath(originalPath); // Ensure path unchanged } - fileItem->SetPath(g_application.CurrentFileItem().GetPath()); } } diff --git a/xbmc/interfaces/json-rpc/schema/version.txt b/xbmc/interfaces/json-rpc/schema/version.txt index 94db005adc..e32fb7aaff 100644 --- a/xbmc/interfaces/json-rpc/schema/version.txt +++ b/xbmc/interfaces/json-rpc/schema/version.txt @@ -1 +1 @@ -JSONRPC_VERSION 9.6.0 +JSONRPC_VERSION 9.6.1 |