diff options
author | DaveTBlake <oak99sky@yahoo.co.uk> | 2020-11-28 13:44:46 +0000 |
---|---|---|
committer | DaveTBlake <oak99sky@yahoo.co.uk> | 2020-11-28 13:45:40 +0000 |
commit | 67246aac5a1762e0945a8fdead07be3fd2cd2554 (patch) | |
tree | 200c24327fa30d12ff359991c52ce62866fe4f00 | |
parent | 327f8a4aefd1a374080d2094220744375d05aafe (diff) |
Fix actions and context menu button visibility for "Party mode playlist" item on music playlists node.
Playing, add to queue and browse etc. not allowed when PartyMode.xsp file does not exist.
-rw-r--r-- | addons/resource.language.en_gb/resources/strings.po | 2 | ||||
-rw-r--r-- | xbmc/music/windows/GUIWindowMusicBase.cpp | 31 |
2 files changed, 33 insertions, 0 deletions
diff --git a/addons/resource.language.en_gb/resources/strings.po b/addons/resource.language.en_gb/resources/strings.po index 0b3a3d72f1..01f1e2fe8a 100644 --- a/addons/resource.language.en_gb/resources/strings.po +++ b/addons/resource.language.en_gb/resources/strings.po @@ -8766,6 +8766,8 @@ msgctxt "#16034" msgid "Couldn't get songs from database." msgstr "" +#: xbmc/music/windows/GUIWindowMusicBase.cpp +#: xbmc/video/windows/GUIWindowVideoBase.cpp #: xbmc/dialogs/GUIDialogSmartPlaylistEditor.cpp msgctxt "#16035" msgid "Party mode playlist" diff --git a/xbmc/music/windows/GUIWindowMusicBase.cpp b/xbmc/music/windows/GUIWindowMusicBase.cpp index 84c6ecf0de..7ff40056d3 100644 --- a/xbmc/music/windows/GUIWindowMusicBase.cpp +++ b/xbmc/music/windows/GUIWindowMusicBase.cpp @@ -35,6 +35,7 @@ #include "dialogs/GUIDialogSmartPlaylistEditor.h" #include "dialogs/GUIDialogYesNo.h" #include "filesystem/Directory.h" +#include "filesystem/File.h" #include "filesystem/MusicDatabaseDirectory.h" #include "guilib/GUIComponent.h" #include "guilib/GUIWindowManager.h" @@ -381,6 +382,16 @@ void CGUIWindowMusicBase::OnQueueItem(int iItem, bool first) if (item->IsRAR() || item->IsZIP()) return; + + // Check for the partymode playlist item, do nothing when "PartyMode.xsp" not exist + if (item->IsSmartPlayList()) + { + const std::shared_ptr<CProfileManager> profileManager = + CServiceBroker::GetSettingsComponent()->GetProfileManager(); + if ((item->GetPath() == profileManager->GetUserDataItem("PartyMode.xsp")) && + !XFILE::CFile::Exists(item->GetPath())) + return; + } // Allow queuing of unqueueable items // when we try to queue them directly @@ -532,6 +543,16 @@ void CGUIWindowMusicBase::GetContextButtons(int itemNumber, CContextButtons &but { const std::shared_ptr<CProfileManager> profileManager = CServiceBroker::GetSettingsComponent()->GetProfileManager(); + // Check for the partymode playlist item. + // When "PartyMode.xsp" not exist, only context menu button is edit + if (item->IsSmartPlayList() && + (item->GetPath() == profileManager->GetUserDataItem("PartyMode.xsp")) && + !XFILE::CFile::Exists(item->GetPath())) + { + buttons.Add(CONTEXT_BUTTON_EDIT_SMART_PLAYLIST, 586); + return; + } + if (item && !item->IsParentFolder()) { if (item->CanQueue() && !item->IsAddonsPath() && !item->IsScript()) @@ -742,6 +763,16 @@ void CGUIWindowMusicBase::PlayItem(int iItem) } #endif + // Check for the partymode playlist item, do nothing when "PartyMode.xsp" not exist + if (pItem->IsSmartPlayList()) + { + const std::shared_ptr<CProfileManager> profileManager = + CServiceBroker::GetSettingsComponent()->GetProfileManager(); + if ((pItem->GetPath() == profileManager->GetUserDataItem("PartyMode.xsp")) && + !XFILE::CFile::Exists(pItem->GetPath())) + return; + } + // if its a folder, build a playlist if (pItem->m_bIsFolder && !pItem->IsPlugin()) { |