aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--xbmc/PlayListPlayer.cpp16
-rw-r--r--xbmc/PlayListPlayer.h7
-rw-r--r--xbmc/music/windows/GUIWindowMusicBase.cpp1
-rw-r--r--xbmc/video/ContextMenus.cpp1
-rw-r--r--xbmc/video/GUIViewStateVideo.cpp26
-rw-r--r--xbmc/video/GUIViewStateVideo.h9
-rw-r--r--xbmc/video/dialogs/GUIDialogVideoInfo.cpp2
-rw-r--r--xbmc/video/windows/GUIWindowVideoBase.cpp2
-rw-r--r--xbmc/view/GUIViewState.cpp8
9 files changed, 66 insertions, 6 deletions
diff --git a/xbmc/PlayListPlayer.cpp b/xbmc/PlayListPlayer.cpp
index 10d5083d5e..72f5b1b0a0 100644
--- a/xbmc/PlayListPlayer.cpp
+++ b/xbmc/PlayListPlayer.cpp
@@ -258,13 +258,23 @@ bool CPlayListPlayer::PlaySongId(int songId)
bool CPlayListPlayer::Play(const CFileItemPtr& pItem, const std::string& player)
{
int playlist;
- if (pItem->IsAudio())
+ bool isVideo{pItem->IsVideo()};
+ bool isAudio{pItem->IsAudio()};
+ if (isVideo && isAudio && pItem->HasProperty("playlist_type_hint"))
+ {
+ // If an extension is set in both audio / video lists (e.g. playlist .strm),
+ // is not possible detect the type of playlist then we rely on the hint
+ playlist = pItem->GetProperty("playlist_type_hint").asInteger32(PLAYLIST_NONE);
+ }
+ else if (isAudio)
playlist = PLAYLIST_MUSIC;
- else if (pItem->IsVideo())
+ else if (isVideo)
playlist = PLAYLIST_VIDEO;
else
{
- CLog::Log(LOGWARNING,"Playlist Player: ListItem type must be audio or video, use ListItem::setInfo to specify!");
+ CLog::Log(
+ LOGWARNING,
+ "Playlist Player: ListItem type must be audio or video, use ListItem::setInfo to specify!");
return false;
}
diff --git a/xbmc/PlayListPlayer.h b/xbmc/PlayListPlayer.h
index 4ab2de7753..4767e67e0d 100644
--- a/xbmc/PlayListPlayer.h
+++ b/xbmc/PlayListPlayer.h
@@ -60,8 +60,11 @@ public:
bool PlaySongId(int songId);
bool Play();
- /*! \brief Creates a new playlist for an item and starts playing it
- \param pItem The item to play.
+ /*!
+ * \brief Creates a new playlist for an item and starts playing it
+ * \param pItem The item to play.
+ * \param player The player name.
+ * \return True if has success, otherwise false.
*/
bool Play(const CFileItemPtr& pItem, const std::string& player);
diff --git a/xbmc/music/windows/GUIWindowMusicBase.cpp b/xbmc/music/windows/GUIWindowMusicBase.cpp
index 9478d66907..002c8c0024 100644
--- a/xbmc/music/windows/GUIWindowMusicBase.cpp
+++ b/xbmc/music/windows/GUIWindowMusicBase.cpp
@@ -876,6 +876,7 @@ bool CGUIWindowMusicBase::OnPlayMedia(int iItem, const std::string &player)
OnQueueItem(iItem);
return true;
}
+ pItem->SetProperty("playlist_type_hint", PLAYLIST_MUSIC);
CServiceBroker::GetPlaylistPlayer().Play(pItem, player);
return true;
}
diff --git a/xbmc/video/ContextMenus.cpp b/xbmc/video/ContextMenus.cpp
index 4f7c3f40cf..13c6fa4153 100644
--- a/xbmc/video/ContextMenus.cpp
+++ b/xbmc/video/ContextMenus.cpp
@@ -280,6 +280,7 @@ void SetPathAndPlay(CFileItem& item)
}
else
{
+ item.SetProperty("playlist_type_hint", PLAYLIST_VIDEO);
CServiceBroker::GetPlaylistPlayer().Play(std::make_shared<CFileItem>(item), "");
}
}
diff --git a/xbmc/video/GUIViewStateVideo.cpp b/xbmc/video/GUIViewStateVideo.cpp
index e49032401a..9d6a842f2f 100644
--- a/xbmc/video/GUIViewStateVideo.cpp
+++ b/xbmc/video/GUIViewStateVideo.cpp
@@ -590,3 +590,29 @@ void CGUIViewStateVideoEpisodes::SaveViewState()
SaveViewToDb(m_items.GetPath(), WINDOW_VIDEO_NAV, CViewStateSettings::GetInstance().Get("videonavepisodes"));
}
+CGUIViewStateVideoPlaylist::CGUIViewStateVideoPlaylist(const CFileItemList& items)
+ : CGUIViewStateWindowVideo(items)
+{
+ SortAttribute sortAttributes = SortAttributeNone;
+ if (CServiceBroker::GetSettingsComponent()->GetSettings()->GetBool(
+ CSettings::SETTING_FILELISTS_IGNORETHEWHENSORTING))
+ sortAttributes = SortAttributeIgnoreArticle;
+
+ AddSortMethod(SortByLabel, sortAttributes, 551,
+ LABEL_MASKS("%L", "%I", "%L", "")); // Label, Size | Label, empty
+ AddSortMethod(SortBySize, 553, LABEL_MASKS("%L", "%I", "%L", "%I")); // Label, Size | Label, Size
+ AddSortMethod(SortByDate, 552, LABEL_MASKS("%L", "%J", "%L", "%J")); // Label, Date | Label, Date
+ AddSortMethod(SortByFile, 561, LABEL_MASKS("%L", "%I", "%L", "")); // Label, Size | Label, empty
+
+ const CViewState* viewState = CViewStateSettings::GetInstance().Get("videofiles");
+ SetSortMethod(viewState->m_sortDescription);
+ SetViewAsControl(viewState->m_viewMode);
+ SetSortOrder(viewState->m_sortDescription.sortOrder);
+
+ LoadViewState(items.GetPath(), WINDOW_VIDEO_NAV);
+}
+
+void CGUIViewStateVideoPlaylist::SaveViewState()
+{
+ SaveViewToDb(m_items.GetPath(), WINDOW_VIDEO_NAV);
+}
diff --git a/xbmc/video/GUIViewStateVideo.h b/xbmc/video/GUIViewStateVideo.h
index 6cc0edc391..508116a48b 100644
--- a/xbmc/video/GUIViewStateVideo.h
+++ b/xbmc/video/GUIViewStateVideo.h
@@ -23,6 +23,15 @@ protected:
bool AutoPlayNextItem() override;
};
+class CGUIViewStateVideoPlaylist : public CGUIViewStateWindowVideo
+{
+public:
+ explicit CGUIViewStateVideoPlaylist(const CFileItemList& items);
+
+protected:
+ void SaveViewState() override;
+};
+
class CGUIViewStateWindowVideoNav : public CGUIViewStateWindowVideo
{
public:
diff --git a/xbmc/video/dialogs/GUIDialogVideoInfo.cpp b/xbmc/video/dialogs/GUIDialogVideoInfo.cpp
index 1803a70ec2..b9b6a49c00 100644
--- a/xbmc/video/dialogs/GUIDialogVideoInfo.cpp
+++ b/xbmc/video/dialogs/GUIDialogVideoInfo.cpp
@@ -737,6 +737,8 @@ void CGUIDialogVideoInfo::Play(bool resume)
Open();
return;
}
+ m_movieItem->SetProperty("playlist_type_hint", PLAYLIST_VIDEO);
+
pWindow->PlayMovie(m_movieItem.get());
}
}
diff --git a/xbmc/video/windows/GUIWindowVideoBase.cpp b/xbmc/video/windows/GUIWindowVideoBase.cpp
index b17039a7c8..ff00afda3c 100644
--- a/xbmc/video/windows/GUIWindowVideoBase.cpp
+++ b/xbmc/video/windows/GUIWindowVideoBase.cpp
@@ -1164,6 +1164,8 @@ bool CGUIWindowVideoBase::OnPlayMedia(int iItem, const std::string &player)
}
CLog::Log(LOGDEBUG, "%s %s", __FUNCTION__, CURL::GetRedacted(item.GetPath()).c_str());
+ item.SetProperty("playlist_type_hint", PLAYLIST_VIDEO);
+
PlayMovie(&item, player);
return true;
diff --git a/xbmc/view/GUIViewState.cpp b/xbmc/view/GUIViewState.cpp
index f54d5ff45f..a8428fe0ac 100644
--- a/xbmc/view/GUIViewState.cpp
+++ b/xbmc/view/GUIViewState.cpp
@@ -101,7 +101,13 @@ CGUIViewState* CGUIViewState::GetViewState(int windowId, const CFileItemList& it
return new CGUIViewStateLibrary(items);
if (items.IsPlayList())
- return new CGUIViewStateMusicPlaylist(items);
+ {
+ // Playlists (like .strm) can be music or video type
+ if (windowId == WINDOW_VIDEO_NAV)
+ return new CGUIViewStateVideoPlaylist(items);
+ else
+ return new CGUIViewStateMusicPlaylist(items);
+ }
if (items.GetPath() == "special://musicplaylists/")
return new CGUIViewStateWindowMusicNav(items);