aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKai Sommerfeld <3226626+ksooo@users.noreply.github.com>2024-03-18 14:55:11 +0100
committerGitHub <noreply@github.com>2024-03-18 14:55:11 +0100
commitefba00e1412714a76ca4554a357bd6118992f1a0 (patch)
treebf7ade96da0e67ca3cbe11ba2f2d306356215335
parent0f844b189d2533b7b6fb21a3f63889ebcc33c4dd (diff)
parent7a15dcd78294cf9878e4866e4d7f5636f513a784 (diff)
Merge pull request #24863 from ksooo/video-fix-deleted-item-query-omega
[Omega][video] Fix regression when playing deleted movie.
-rw-r--r--xbmc/video/windows/GUIWindowVideoBase.cpp35
-rw-r--r--xbmc/video/windows/GUIWindowVideoNav.cpp24
2 files changed, 36 insertions, 23 deletions
diff --git a/xbmc/video/windows/GUIWindowVideoBase.cpp b/xbmc/video/windows/GUIWindowVideoBase.cpp
index 9a4c2605f6..cf98585fcd 100644
--- a/xbmc/video/windows/GUIWindowVideoBase.cpp
+++ b/xbmc/video/windows/GUIWindowVideoBase.cpp
@@ -1073,6 +1073,41 @@ void CGUIWindowVideoBase::LoadPlayList(const std::string& strPlayList,
bool CGUIWindowVideoBase::PlayItem(const std::shared_ptr<CFileItem>& pItem,
const std::string& player)
{
+ if (!pItem->m_bIsFolder && pItem->IsVideoDb() && !pItem->Exists())
+ {
+ CLog::LogF(LOGDEBUG, "File '{}' for library item '{}' doesn't exist.", pItem->GetDynPath(),
+ pItem->GetPath());
+
+ const auto profileManager{CServiceBroker::GetSettingsComponent()->GetProfileManager()};
+
+ if (profileManager->GetCurrentProfile().canWriteDatabases() || g_passwordManager.bMasterUser)
+ {
+ if (CGUIDialogVideoInfo::DeleteVideoItemFromDatabase(pItem, true))
+ {
+ int itemIndex{0};
+ const std::string path{pItem->GetPath()};
+ for (int i = 0; i < m_vecItems->Size(); ++i)
+ {
+ if (m_vecItems->Get(i)->GetPath() == path)
+ {
+ itemIndex = i;
+ break;
+ }
+ }
+
+ // update list
+ Refresh(true);
+ m_viewControl.SetSelectedItem(itemIndex);
+ }
+ }
+ else
+ {
+ HELPERS::ShowOKDialogText(CVariant{257}, // Error
+ CVariant{662}); // This file is no longer available.
+ }
+ return true;
+ }
+
//! @todo get rid of "videos with versions as folder" hack!
if (pItem->m_bIsFolder && !pItem->IsPlugin() &&
!(pItem->HasVideoInfoTag() && pItem->GetVideoInfoTag()->IsDefaultVideoVersion()))
diff --git a/xbmc/video/windows/GUIWindowVideoNav.cpp b/xbmc/video/windows/GUIWindowVideoNav.cpp
index 4f246ba181..86ab1d96eb 100644
--- a/xbmc/video/windows/GUIWindowVideoNav.cpp
+++ b/xbmc/video/windows/GUIWindowVideoNav.cpp
@@ -964,29 +964,7 @@ bool CGUIWindowVideoNav::OnAddMediaSource()
bool CGUIWindowVideoNav::OnClick(int iItem, const std::string &player)
{
CFileItemPtr item = m_vecItems->Get(iItem);
- if (!item->m_bIsFolder && item->IsVideoDb() && !item->Exists())
- {
- CLog::Log(LOGDEBUG, "{} called on '{}' but file doesn't exist", __FUNCTION__, item->GetPath());
-
- const std::shared_ptr<CProfileManager> profileManager = CServiceBroker::GetSettingsComponent()->GetProfileManager();
-
- if (profileManager->GetCurrentProfile().canWriteDatabases() || g_passwordManager.bMasterUser)
- {
- if (!CGUIDialogVideoInfo::DeleteVideoItemFromDatabase(item, true))
- return true;
-
- // update list
- Refresh(true);
- m_viewControl.SetSelectedItem(iItem);
- return true;
- }
- else
- {
- HELPERS::ShowOKDialogText(CVariant{257}, CVariant{662});
- return true;
- }
- }
- else if (StringUtils::StartsWithNoCase(item->GetPath(), "newtag://"))
+ if (StringUtils::StartsWithNoCase(item->GetPath(), "newtag://"))
{
// dont allow update while scanning
if (CVideoLibraryQueue::GetInstance().IsScanningLibrary())