Skip to content

Commit

Permalink
Merge pull request xbmc#25099 from 78andyp/playlist_fix
Browse files Browse the repository at this point in the history
[Video] Fix for xbmc#25097 and requested updates from xbmc#24720
  • Loading branch information
enen92 committed May 4, 2024
2 parents 0894898 + 7a69d0d commit db1f89b
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 25 deletions.
3 changes: 3 additions & 0 deletions addons/resource.language.en_gb/resources/strings.po
Expand Up @@ -7289,6 +7289,9 @@ msgctxt "#13423"
msgid "Remember for this path"
msgstr ""

#. Shown on context menu when a bluray:// or dvd:// playlist has already been saved
#. Giving the user a chance to select a new one via the simple menu dialog
#: xbmc/video/windows/GUIWindowVideoBase.cpp
msgctxt "#13424"
msgid "Choose playlist"
msgstr ""
Expand Down
2 changes: 1 addition & 1 deletion xbmc/application/Application.cpp
Expand Up @@ -2429,7 +2429,7 @@ bool CApplication::PlayFile(CFileItem item,
// a disc image might be Blu-Ray disc
if (!(options.startpercent > 0.0 || options.starttime > 0.0) &&
(VIDEO::IsBDFile(item) || item.IsDiscImage() ||
(VIDEO::IsBlurayPlaylist(item) && forceSelection)))
(forceSelection && VIDEO::IsBlurayPlaylist(item))))
{
// No video selection when using external or remote players (they handle it if supported)
const bool isSimpleMenuAllowed = [&]()
Expand Down
16 changes: 8 additions & 8 deletions xbmc/dialogs/GUIDialogSimpleMenu.cpp
Expand Up @@ -29,8 +29,6 @@
#include "video/VideoFileItemClassify.h"
#include "video/VideoInfoTag.h"

std::string m_savePath;

using namespace KODI;

namespace
Expand Down Expand Up @@ -59,10 +57,9 @@ bool CGUIDialogSimpleMenu::ShowPlaySelection(CFileItem& item, bool forceSelectio
if (CServiceBroker::GetSettingsComponent()->GetSettings()->GetInt(CSettings::SETTING_DISC_PLAYBACK) != BD_PLAYBACK_SIMPLE_MENU)
return true;

m_savePath = "";
if (VIDEO::IsBlurayPlaylist(item) && forceSelection)
if (forceSelection && VIDEO::IsBlurayPlaylist(item))
{
m_savePath = item.GetDynPath(); // save for screen refresh later
item.SetProperty("save_dyn_path", item.GetDynPath()); // save for screen refresh later
item.SetDynPath(item.GetBlurayPath());
}

Expand Down Expand Up @@ -135,11 +132,14 @@ bool CGUIDialogSimpleMenu::ShowPlaySelection(CFileItem& item, const std::string&

if (item_new->m_bIsFolder == false)
{
if (m_savePath.empty()) // If not set above (choose playlist selected)
m_savePath = item.GetDynPath();
std::string path;
if (item.HasProperty("save_dyn_path"))
path = item.GetProperty("save_dyn_path").asString();
else
path = item.GetDynPath(); // If not set above (choose playlist selected)
item.SetDynPath(item_new->GetDynPath());
item.SetProperty("get_stream_details_from_player", true);
item.SetProperty("original_listitem_url", m_savePath);
item.SetProperty("original_listitem_url", path);
return true;
}

Expand Down
18 changes: 2 additions & 16 deletions xbmc/windows/GUIMediaWindow.cpp
Expand Up @@ -60,12 +60,8 @@
#include "utils/URIUtils.h"
#include "utils/Variant.h"
#include "utils/log.h"
#include "video/VideoFileItemClassify.h"
#include "video/VideoInfoTag.h"
#include "view/GUIViewState.h"

#include <inttypes.h>

#define CONTROL_BTNVIEWASICONS 2
#define CONTROL_BTNSORTBY 3
#define CONTROL_BTNSORTASC 4
Expand Down Expand Up @@ -1537,21 +1533,11 @@ bool CGUIMediaWindow::OnPlayAndQueueMedia(const CFileItemPtr& item, const std::s
{ return i->IsZIP() || i->IsRAR() || i->m_bIsFolder; }),
playlist.end());

// Remove duplicates (eg. ISO/VIDEO_TS)
playlist.erase(
std::unique(playlist.begin(), playlist.end(),
[](const std::shared_ptr<CFileItem>& i, const std::shared_ptr<CFileItem>& j) {
return i->GetVideoInfoTag()->m_basePath == j->GetVideoInfoTag()->m_basePath;
}),
playlist.end());

// Chosen item
int mediaToPlay =
std::distance(playlist.begin(), std::find_if(playlist.begin(), playlist.end(),
[&item](const std::shared_ptr<CFileItem>& i) {
return i->GetVideoInfoTag()->m_basePath ==
item->GetVideoInfoTag()->m_basePath;
}));
[&item](const std::shared_ptr<CFileItem>& i)
{ return i->GetPath() == item->GetPath(); }));

// Add to playlist
CServiceBroker::GetPlaylistPlayer().ClearPlaylist(playlistId);
Expand Down

0 comments on commit db1f89b

Please sign in to comment.