aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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())