diff options
author | Kai Sommerfeld <kai.sommerfeld@gmx.com> | 2022-11-07 11:22:51 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-07 11:22:51 +0100 |
commit | 43002bb84ddf0e7ccadea2ec60107f4a6f170c65 (patch) | |
tree | 4fe3bea17260a2786b6ab05a5e158a572c9d5a74 | |
parent | 880e7acac4fd626ac0fdd3524c0cce673d96c5bb (diff) | |
parent | 02d44a42e90ba823bf9c544f0b2f262371e9199f (diff) |
Merge pull request #22105 from ksooo/video-fix-merge-accident
[video] Fix merge mistake for #22097
-rw-r--r-- | addons/resource.language.en_gb/resources/strings.po | 8 | ||||
-rw-r--r-- | xbmc/FileItem.cpp | 74 | ||||
-rw-r--r-- | xbmc/FileItem.h | 11 | ||||
-rw-r--r-- | xbmc/interfaces/builtins/PlayerBuiltins.cpp | 15 | ||||
-rw-r--r-- | xbmc/music/MusicUtils.cpp | 20 | ||||
-rw-r--r-- | xbmc/pvr/windows/GUIWindowPVRRecordings.cpp | 24 | ||||
-rw-r--r-- | xbmc/video/ContextMenus.cpp | 4 | ||||
-rw-r--r-- | xbmc/video/VideoDatabase.cpp | 38 | ||||
-rw-r--r-- | xbmc/video/VideoDatabase.h | 4 | ||||
-rw-r--r-- | xbmc/video/windows/GUIWindowVideoBase.cpp | 205 |
10 files changed, 67 insertions, 336 deletions
diff --git a/addons/resource.language.en_gb/resources/strings.po b/addons/resource.language.en_gb/resources/strings.po index 6ed4ecdcd8..2d8a2bc4a0 100644 --- a/addons/resource.language.en_gb/resources/strings.po +++ b/addons/resource.language.en_gb/resources/strings.po @@ -6993,13 +6993,7 @@ msgctxt "#13361" msgid "Enable voice" msgstr "" -#. label for resume context menu item for video folders (like a TV show or a single season of a TV show) -#: xbmc/video/windows/GUIWindowVideoBase.cpp -msgctxt "#13362" -msgid "Continue watching" -msgstr "" - -#empty strings from id 13363 to 13374 +#empty strings from id 13362 to 13374 msgctxt "#13375" msgid "Enable device" diff --git a/xbmc/FileItem.cpp b/xbmc/FileItem.cpp index 9d711d1d83..27821aefc8 100644 --- a/xbmc/FileItem.cpp +++ b/xbmc/FileItem.cpp @@ -3684,80 +3684,6 @@ bool CFileItem::LoadGameTag() return false; } -bool CFileItem::LoadDetails() -{ - if (IsVideoDb()) - { - if (HasVideoInfoTag()) - return true; - - CVideoDatabase db; - if (!db.Open()) - return false; - - VIDEODATABASEDIRECTORY::CQueryParams params; - VIDEODATABASEDIRECTORY::CDirectoryNode::GetDatabaseInfo(GetPath(), params); - - if (params.GetMovieId() >= 0) - db.GetMovieInfo(GetPath(), *GetVideoInfoTag(), static_cast<int>(params.GetMovieId())); - else if (params.GetMVideoId() >= 0) - db.GetMusicVideoInfo(GetPath(), *GetVideoInfoTag(), static_cast<int>(params.GetMVideoId())); - else if (params.GetEpisodeId() >= 0) - db.GetEpisodeInfo(GetPath(), *GetVideoInfoTag(), static_cast<int>(params.GetEpisodeId())); - else if (params.GetSetId() >= 0) // movie set - db.GetSetInfo(static_cast<int>(params.GetSetId()), *GetVideoInfoTag(), this); - else if (params.GetTvShowId() >= 0) - { - if (params.GetSeason() >= 0) - { - const int idSeason = db.GetSeasonId(static_cast<int>(params.GetTvShowId()), - static_cast<int>(params.GetSeason())); - if (idSeason >= 0) - db.GetSeasonInfo(idSeason, *GetVideoInfoTag(), this); - } - else - db.GetTvShowInfo(GetPath(), *GetVideoInfoTag(), static_cast<int>(params.GetTvShowId()), - this); - } - else - { - db.Close(); - return false; - } - db.Close(); - return true; - } - - if (m_bIsFolder && URIUtils::IsPVRRecordingFileOrFolder(GetPath())) - { - if (HasProperty("watchedepisodes") || HasProperty("watched")) - return true; - - const std::string parentPath = URIUtils::GetParentPath(GetPath()); - - //! @todo optimize, find a way to set the details of the directory without loading its content. - CFileItemList items; - if (CDirectory::GetDirectory(parentPath, items, "", XFILE::DIR_FLAG_DEFAULTS)) - { - const std::string path = GetPath(); - const auto it = std::find_if(items.cbegin(), items.cend(), - [path](const auto& entry) { return entry->GetPath() == path; }); - if (it != items.cend()) - { - *this = *(*it); - return true; - } - } - - CLog::LogF(LOGERROR, "Error filling item details (path={})", GetPath()); - return false; - } - - //! @todo add support for other types on demand. - CLog::LogF(LOGDEBUG, "Unsupported item type (path={})", GetPath()); - return false; -} - void CFileItemList::Swap(unsigned int item1, unsigned int item2) { if (item1 != item2 && item1 < m_items.size() && item2 < m_items.size()) diff --git a/xbmc/FileItem.h b/xbmc/FileItem.h index e0adc28e4d..01d64428ff 100644 --- a/xbmc/FileItem.h +++ b/xbmc/FileItem.h @@ -517,15 +517,8 @@ public: // finds a matching local trailer file std::string FindTrailer() const; - bool LoadMusicTag(); - bool LoadGameTag(); - - /*! \brief Load detailed data for an item constructed with only a path and a folder flag - Fills item's video info tag, sets item properties. - - \return true on success, false otherwise. - */ - bool LoadDetails(); + virtual bool LoadMusicTag(); + virtual bool LoadGameTag(); /* Returns the content type of this item if known */ const std::string& GetMimeType() const { return m_mimetype; } diff --git a/xbmc/interfaces/builtins/PlayerBuiltins.cpp b/xbmc/interfaces/builtins/PlayerBuiltins.cpp index ac02169e71..bd0c334179 100644 --- a/xbmc/interfaces/builtins/PlayerBuiltins.cpp +++ b/xbmc/interfaces/builtins/PlayerBuiltins.cpp @@ -493,13 +493,9 @@ int PlayOrQueueMedia(const std::vector<std::string>& params, bool forcePlay) if (!item.m_bIsFolder && item.IsPlugin()) item.SetProperty("IsPlayable", true); - // Here, the item instance has only the path and the folder flag. We need some - // extended item properties to process resume successfully. Load them. - item.LoadDetails(); - - if (askToResume) + if (askToResume == true) { - if (!CGUIWindowVideoBase::ShowResumeMenu(item)) + if (CGUIWindowVideoBase::ShowResumeMenu(item) == false) return false; } @@ -583,13 +579,6 @@ int PlayOrQueueMedia(const std::vector<std::string>& params, bool forcePlay) if (forcePlay) { - if (item.HasVideoInfoTag() && item.GetStartOffset() == STARTOFFSET_RESUME) - { - const CBookmark bookmark = item.GetVideoInfoTag()->GetResumePoint(); - if (bookmark.IsSet()) - item.SetStartOffset(CUtil::ConvertSecsToMilliSecs(bookmark.timeInSeconds)); - } - if ((item.IsAudio() || item.IsVideo()) && !item.IsSmartPlayList()) CServiceBroker::GetPlaylistPlayer().Play(std::make_shared<CFileItem>(item), ""); else diff --git a/xbmc/music/MusicUtils.cpp b/xbmc/music/MusicUtils.cpp index 47304a3a14..9b8b6df3bc 100644 --- a/xbmc/music/MusicUtils.cpp +++ b/xbmc/music/MusicUtils.cpp @@ -727,6 +727,24 @@ bool IsItemPlayable(const CFileItem& item) if (CServiceBroker::GetGUI()->GetWindowManager().GetActiveWindow() == WINDOW_MUSIC_PLAYLIST) return false; + // Include playlists located at one of the possible music playlist locations + if (item.IsPlayList()) + { + if (StringUtils::StartsWithNoCase(item.GetPath(), "special://musicplaylists/") || + StringUtils::StartsWithNoCase(item.GetPath(), "special://profile/playlists/music/")) + return true; + + // Has user changed default playlists location and the list is located there? + const auto settings = CServiceBroker::GetSettingsComponent()->GetSettings(); + std::string path = settings->GetString(CSettings::SETTING_SYSTEM_PLAYLISTSPATH); + StringUtils::TrimRight(path, "/"); + if (StringUtils::StartsWith(item.GetPath(), StringUtils::Format("{}/music/", path))) + return true; + + // Unknown location. Type cannot be determined. + return false; + } + if (item.m_bIsFolder && (item.IsMusicDb() || StringUtils::StartsWithNoCase(item.GetPath(), "library://music/"))) { @@ -741,8 +759,6 @@ bool IsItemPlayable(const CFileItem& item) if (item.HasMusicInfoTag() && item.CanQueue()) return true; - else if (item.IsPlayList() && item.IsAudio()) - return true; else if (!item.m_bIsFolder && item.IsAudio()) return true; else if (!item.m_bIsShareOrDrive && item.m_bIsFolder) diff --git a/xbmc/pvr/windows/GUIWindowPVRRecordings.cpp b/xbmc/pvr/windows/GUIWindowPVRRecordings.cpp index 9dc8b886a1..38c0bc4165 100644 --- a/xbmc/pvr/windows/GUIWindowPVRRecordings.cpp +++ b/xbmc/pvr/windows/GUIWindowPVRRecordings.cpp @@ -28,7 +28,6 @@ #include "settings/SettingsComponent.h" #include "utils/URIUtils.h" #include "video/VideoLibraryQueue.h" -#include "video/VideoUtils.h" #include "video/windows/GUIWindowVideoNav.h" #include <memory> @@ -236,23 +235,18 @@ bool CGUIWindowPVRRecordingsBase::OnMessage(CGUIMessage& message) break; } - if (!item->IsParentFolder() && message.GetParam1() == ACTION_PLAYER_PLAY) - { - if (item->m_bIsFolder) - { - if (CGUIWindowVideoNav::ShowResumeMenu(*item)) - VIDEO_UTILS::PlayItem(item); - } - else - CServiceBroker::GetPVRManager().Get<PVR::GUI::Playback>().PlayRecording( - *item, true /* check resume */); - - bReturn = true; - } - else if (item->m_bIsFolder) + if (item->m_bIsFolder) { // recording folders and ".." folders in subfolders are handled by base class. bReturn = false; + break; + } + + if (message.GetParam1() == ACTION_PLAYER_PLAY) + { + CServiceBroker::GetPVRManager().Get<PVR::GUI::Playback>().PlayRecording( + *item, true /* check resume */); + bReturn = true; } else { diff --git a/xbmc/video/ContextMenus.cpp b/xbmc/video/ContextMenus.cpp index 2f3ad46cdd..b59a2da06c 100644 --- a/xbmc/video/ContextMenus.cpp +++ b/xbmc/video/ContextMenus.cpp @@ -166,7 +166,7 @@ bool CVideoResume::IsVisible(const CFileItem& itemIn) const if (item.IsDeleted()) // e.g. trashed pvr recording return false; - return !CGUIWindowVideoBase::GetResumeString(item).empty(); + return CGUIWindowVideoBase::HasResumeItemOffset(&item); } namespace @@ -294,7 +294,7 @@ std::string CVideoPlay::GetLabel(const CFileItem& itemIn) const CFileItem item(itemIn.GetItemToPlay()); if (item.IsLiveTV()) return g_localizeStrings.Get(19000); // Switch to channel - if (!CGUIWindowVideoBase::GetResumeString(item).empty()) + if (CGUIWindowVideoBase::HasResumeItemOffset(&item)) return g_localizeStrings.Get(12021); // Play from beginning return g_localizeStrings.Get(208); // Play } diff --git a/xbmc/video/VideoDatabase.cpp b/xbmc/video/VideoDatabase.cpp index 119299c39a..d832c72e3f 100644 --- a/xbmc/video/VideoDatabase.cpp +++ b/xbmc/video/VideoDatabase.cpp @@ -2138,19 +2138,6 @@ bool CVideoDatabase::GetTvShowInfo(const std::string& strPath, CVideoInfoTag& de bool CVideoDatabase::GetSeasonInfo(int idSeason, CVideoInfoTag& details, bool allDetails /* = true */) { - if (allDetails) - { - CFileItem dummy; // only interested in the tag data... - return GetSeasonInfo(idSeason, details, &dummy); - } - else - { - return GetSeasonInfo(idSeason, details, nullptr); - } -} - -bool CVideoDatabase::GetSeasonInfo(int idSeason, CVideoInfoTag& details, CFileItem* item) -{ if (idSeason < 0) return false; @@ -2166,7 +2153,7 @@ bool CVideoDatabase::GetSeasonInfo(int idSeason, CVideoInfoTag& details, CFileIt if (m_pDS->num_rows() != 1) return false; - if (item) + if (allDetails) { int idShow = m_pDS->fv(1).get_asInt(); @@ -2188,7 +2175,6 @@ bool CVideoDatabase::GetSeasonInfo(int idSeason, CVideoInfoTag& details, CFileIt if (season->HasVideoInfoTag() && season->GetVideoInfoTag()->m_iDbId == idSeason && season->GetVideoInfoTag()->m_iIdShow == idShow) { details = *season->GetVideoInfoTag(); - *item = *season; return true; } } @@ -2297,7 +2283,7 @@ bool CVideoDatabase::GetMusicVideoInfo(const std::string& strFilenameAndPath, CV return false; } -bool CVideoDatabase::GetSetInfo(int idSet, CVideoInfoTag& details, CFileItem* item /* = nullptr */) +bool CVideoDatabase::GetSetInfo(int idSet, CVideoInfoTag& details) { try { @@ -2313,8 +2299,6 @@ bool CVideoDatabase::GetSetInfo(int idSet, CVideoInfoTag& details, CFileItem* it return false; details = *(items[0]->GetVideoInfoTag()); - if (item) - *item = *items[0]; return !details.IsEmpty(); } catch (...) @@ -3838,7 +3822,7 @@ void CVideoDatabase::GetDetailsFromDB(const dbiplus::sql_record* const record, i } } -bool CVideoDatabase::GetDetailsByTypeAndId(CFileItem& item, VideoDbContentType type, int id) +CVideoInfoTag CVideoDatabase::GetDetailsByTypeAndId(VideoDbContentType type, int id) { CVideoInfoTag details; details.Reset(); @@ -3849,7 +3833,7 @@ bool CVideoDatabase::GetDetailsByTypeAndId(CFileItem& item, VideoDbContentType t GetMovieInfo("", details, id); break; case VideoDbContentType::TVSHOWS: - GetTvShowInfo("", details, id, &item); + GetTvShowInfo("", details, id); break; case VideoDbContentType::EPISODES: GetEpisodeInfo("", details, id); @@ -3858,20 +3842,10 @@ bool CVideoDatabase::GetDetailsByTypeAndId(CFileItem& item, VideoDbContentType t GetMusicVideoInfo("", details, id); break; default: - return false; + break; } - item.SetFromVideoInfoTag(details); - return true; -} - -CVideoInfoTag CVideoDatabase::GetDetailsByTypeAndId(VideoDbContentType type, int id) -{ - CFileItem item; - if (GetDetailsByTypeAndId(item, type, id)) - return CVideoInfoTag(*item.GetVideoInfoTag()); - - return {}; + return details; } bool CVideoDatabase::GetStreamDetails(CFileItem& item) diff --git a/xbmc/video/VideoDatabase.h b/xbmc/video/VideoDatabase.h index 675ec44e89..690450a0c9 100644 --- a/xbmc/video/VideoDatabase.h +++ b/xbmc/video/VideoDatabase.h @@ -513,12 +513,11 @@ public: bool LoadVideoInfo(const std::string& strFilenameAndPath, CVideoInfoTag& details, int getDetails = VideoDbDetailsAll); bool GetMovieInfo(const std::string& strFilenameAndPath, CVideoInfoTag& details, int idMovie = -1, int getDetails = VideoDbDetailsAll); bool GetTvShowInfo(const std::string& strPath, CVideoInfoTag& details, int idTvShow = -1, CFileItem* item = NULL, int getDetails = VideoDbDetailsAll); - bool GetSeasonInfo(int idSeason, CVideoInfoTag& details, CFileItem* item); bool GetSeasonInfo(int idSeason, CVideoInfoTag& details, bool allDetails = true); bool GetEpisodeBasicInfo(const std::string& strFilenameAndPath, CVideoInfoTag& details, int idEpisode = -1); bool GetEpisodeInfo(const std::string& strFilenameAndPath, CVideoInfoTag& details, int idEpisode = -1, int getDetails = VideoDbDetailsAll); bool GetMusicVideoInfo(const std::string& strFilenameAndPath, CVideoInfoTag& details, int idMVideo = -1, int getDetails = VideoDbDetailsAll); - bool GetSetInfo(int idSet, CVideoInfoTag& details, CFileItem* item = nullptr); + bool GetSetInfo(int idSet, CVideoInfoTag& details); bool GetFileInfo(const std::string& strFilenameAndPath, CVideoInfoTag& details, int idFile = -1); int GetPathId(const std::string& strPath); @@ -654,7 +653,6 @@ public: bool GetResumePoint(CVideoInfoTag& tag); bool GetStreamDetails(CFileItem& item); bool GetStreamDetails(CVideoInfoTag& tag) const; - bool GetDetailsByTypeAndId(CFileItem& item, VideoDbContentType type, int id); CVideoInfoTag GetDetailsByTypeAndId(VideoDbContentType type, int id); // scraper settings diff --git a/xbmc/video/windows/GUIWindowVideoBase.cpp b/xbmc/video/windows/GUIWindowVideoBase.cpp index 086da0336f..6ed00262f4 100644 --- a/xbmc/video/windows/GUIWindowVideoBase.cpp +++ b/xbmc/video/windows/GUIWindowVideoBase.cpp @@ -479,7 +479,10 @@ void CGUIWindowVideoBase::GetResumeItemOffset(const CFileItem *item, int64_t& st } else { - // Obtain the resume bookmark from video db... + CBookmark bookmark; + std::string strPath = item->GetPath(); + if ((item->IsVideoDb() || item->IsDVD()) && item->HasVideoInfoTag()) + strPath = item->GetVideoInfoTag()->m_strFileNameAndPath; CVideoDatabase db; if (!db.Open()) @@ -487,55 +490,12 @@ void CGUIWindowVideoBase::GetResumeItemOffset(const CFileItem *item, int64_t& st CLog::Log(LOGERROR, "{} - Cannot open VideoDatabase", __FUNCTION__); return; } - - std::string path = item->GetPath(); - if (item->IsVideoDb() || item->IsDVD()) - { - if (item->HasVideoInfoTag()) - { - path = item->GetVideoInfoTag()->m_strFileNameAndPath; - } - else if (item->IsVideoDb()) - { - // Obtain fileNamAndPath from video db - VIDEODATABASEDIRECTORY::CQueryParams params; - VIDEODATABASEDIRECTORY::CDirectoryNode::GetDatabaseInfo(item->GetPath(), params); - - long id = -1; - VideoDbContentType content_type; - if ((id = params.GetMovieId()) >= 0) - content_type = VideoDbContentType::MOVIES; - else if ((id = params.GetEpisodeId()) >= 0) - content_type = VideoDbContentType::EPISODES; - else if ((id = params.GetMVideoId()) >= 0) - content_type = VideoDbContentType::MUSICVIDEOS; - else - { - CLog::Log(LOGERROR, "{} - Cannot obtain video content type", __FUNCTION__); - db.Close(); - return; - } - - db.GetFilePathById(static_cast<int>(id), path, content_type); - } - else - { - // DVD - CLog::Log(LOGERROR, "{} - Cannot obtain bookmark for DVD", __FUNCTION__); - db.Close(); - return; - } - } - - CBookmark bookmark; - db.GetResumeBookMark(path, bookmark); - db.Close(); - - if (bookmark.IsSet()) + if (db.GetResumeBookMark(strPath, bookmark)) { startoffset = CUtil::ConvertSecsToMilliSecs(bookmark.timeInSeconds); partNumber = bookmark.partNumber; } + db.Close(); } } } @@ -626,11 +586,6 @@ bool CGUIWindowVideoBase::OnFileAction(int iItem, int action, const std::string& return true; case SELECT_ACTION_RESUME: item->SetStartOffset(STARTOFFSET_RESUME); - if (item->m_bIsFolder) - { - PlayItem(iItem, player); - return true; - } break; case SELECT_ACTION_PLAYPART: if (!OnPlayStackPart(iItem)) @@ -640,12 +595,6 @@ bool CGUIWindowVideoBase::OnFileAction(int iItem, int action, const std::string& OnQueueItem(iItem); return true; case SELECT_ACTION_PLAY: - if (item->m_bIsFolder) - { - PlayItem(iItem, player); - return true; - } - break; default: break; } @@ -721,125 +670,23 @@ void CGUIWindowVideoBase::OnRestartItem(int iItem, const std::string &player) CGUIMediaWindow::OnClick(iItem, player); } -namespace -{ -bool HasInProgressVideo(const std::string& path, CVideoDatabase& db) -{ - //! @todo this function is really very expensive and should be optimized (at db level). - - CFileItemList items; - CUtil::GetRecursiveListing(path, items, {}, XFILE::DIR_FLAG_DEFAULTS); - - if (items.IsEmpty()) - return false; - - for (const auto& item : items) - { - const auto videoTag = item->GetVideoInfoTag(); - if (!item->HasVideoInfoTag()) - continue; - - if (videoTag->GetPlayCount() > 0) - continue; - - // get resume point - CBookmark bookmark(videoTag->GetResumePoint()); - if (!bookmark.IsSet() && db.GetResumeBookMark(videoTag->m_strFileNameAndPath, bookmark)) - videoTag->SetResumePoint(bookmark); - - if (bookmark.IsSet()) - return true; - } - - return false; -} -} // unnamed namespace - std::string CGUIWindowVideoBase::GetResumeString(const CFileItem &item) { std::string resumeString; - if (item.m_bIsFolder) - { - bool hasInProgressVideo = false; - - CFileItem folderItem(item); - if ((!folderItem.HasProperty("watchedepisodes") || // season/show - (folderItem.GetProperty("watchedepisodes").asInteger() == 0)) && - (!folderItem.HasProperty("watched") || // movie set - (folderItem.GetProperty("watched").asInteger() == 0))) - { - CVideoDatabase db; - if (db.Open()) - { - if (!folderItem.HasProperty("watchedepisodes") && !folderItem.HasProperty("watched")) - { - VIDEODATABASEDIRECTORY::CQueryParams params; - VIDEODATABASEDIRECTORY::CDirectoryNode::GetDatabaseInfo(item.GetPath(), params); - - if (params.GetTvShowId() >= 0) - { - if (params.GetSeason() >= 0) - { - const int idSeason = db.GetSeasonId(static_cast<int>(params.GetTvShowId()), - static_cast<int>(params.GetSeason())); - if (idSeason >= 0) - { - CVideoInfoTag details; - db.GetSeasonInfo(idSeason, details, &folderItem); - } - } - else - { - CVideoInfoTag details; - db.GetTvShowInfo(item.GetPath(), details, static_cast<int>(params.GetTvShowId()), - &folderItem); - } - } - else if (params.GetSetId() >= 0) - { - CVideoInfoTag details; - db.GetSetInfo(static_cast<int>(params.GetSetId()), details, &folderItem); - } - } - - // no episodes/movies watched completely, but there could be some or more we have - // started watching - if ((folderItem.HasProperty("watchedepisodes") && // season/show - folderItem.GetProperty("watchedepisodes").asInteger() == 0) || - (folderItem.HasProperty("watched") && // movie set - folderItem.GetProperty("watched").asInteger() == 0)) - hasInProgressVideo = HasInProgressVideo(item.GetPath(), db); - - db.Close(); - } - } - - if (hasInProgressVideo || - (folderItem.GetProperty("watchedepisodes").asInteger() > 0 && - folderItem.GetProperty("unwatchedepisodes").asInteger() > 0) || - (folderItem.GetProperty("watched").asInteger() > 0 && - folderItem.GetProperty("unwatched").asInteger() > 0)) - { - resumeString = g_localizeStrings.Get(13362); // Continue watching - } - } - else + int64_t startOffset = 0; + int startPart = 0; + GetResumeItemOffset(&item, startOffset, startPart); + if (startOffset > 0) { - int64_t startOffset = 0; - int startPart = 0; - GetResumeItemOffset(&item, startOffset, startPart); - if (startOffset > 0) + resumeString = + StringUtils::Format(g_localizeStrings.Get(12022), + StringUtils::SecondsToTimeString( + static_cast<long>(CUtil::ConvertMilliSecsToSecsInt(startOffset)), + TIME_FORMAT_HH_MM_SS)); + if (startPart > 0) { - resumeString = - StringUtils::Format(g_localizeStrings.Get(12022), - StringUtils::SecondsToTimeString( - static_cast<long>(CUtil::ConvertMilliSecsToSecsInt(startOffset)), - TIME_FORMAT_HH_MM_SS)); - if (startPart > 0) - { - std::string partString = StringUtils::Format(g_localizeStrings.Get(23051), startPart); - resumeString += " (" + partString + ")"; - } + std::string partString = StringUtils::Format(g_localizeStrings.Get(23051), startPart); + resumeString += " (" + partString + ")"; } } return resumeString; @@ -847,7 +694,7 @@ std::string CGUIWindowVideoBase::GetResumeString(const CFileItem &item) bool CGUIWindowVideoBase::ShowResumeMenu(CFileItem &item) { - if (!item.IsLiveTV()) + if (!item.m_bIsFolder && !item.IsPVR()) { std::string resumeString = GetResumeString(item); if (!resumeString.empty()) @@ -870,6 +717,13 @@ bool CGUIWindowVideoBase::OnResumeItem(int iItem, const std::string &player) if (iItem < 0 || iItem >= m_vecItems->Size()) return true; CFileItemPtr item = m_vecItems->Get(iItem); + if (item->m_bIsFolder) + { + // resuming directories isn't supported yet. play. + PlayItem(iItem, player); + return true; + } + std::string resumeString = GetResumeString(*item); if (!resumeString.empty()) @@ -883,13 +737,6 @@ bool CGUIWindowVideoBase::OnResumeItem(int iItem, const std::string &player) return OnFileAction(iItem, value, player); } - if (item->m_bIsFolder) - { - // resuming directories isn't fully supported yet. play all of its content. - PlayItem(iItem, player); - return true; - } - return OnFileAction(iItem, SELECT_ACTION_PLAY, player); } |