Skip to content

Commit

Permalink
Merge pull request xbmc#26289 from ksooo/video-fix-watchedstate-ctx-m…
Browse files Browse the repository at this point in the history
…enus

[video] Fix mark watched/unwatched missing in certain context menus.
  • Loading branch information
ksooo authored Jan 14, 2025
2 parents e7e6ee6 + 9a01d91 commit 251a25f
Showing 1 changed file with 28 additions and 6 deletions.
34 changes: 28 additions & 6 deletions xbmc/video/ContextMenus.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include "settings/Settings.h"
#include "settings/SettingsComponent.h"
#include "utils/PlayerUtils.h"
#include "utils/StringUtils.h"
#include "utils/URIUtils.h"
#include "video/VideoFileItemClassify.h"
#include "video/VideoInfoTag.h"
Expand Down Expand Up @@ -96,10 +97,21 @@ bool CVideoMarkWatched::IsVisible(const CFileItem& item) const
if (item.m_bIsFolder && item.IsPlugin()) // we cannot manage plugin folder's watched state
return false;

if (item.m_bIsFolder) // Only allow video db content, video and recording folders to be updated recursively
if (item.m_bIsFolder)
{
if (item.HasVideoInfoTag())
return VIDEO::IsVideoDb(item);
if (item.HasProperty("watchedepisodes") && item.HasProperty("totalepisodes"))
{
return item.GetProperty("watchedepisodes").asInteger() <
item.GetProperty("totalepisodes").asInteger();
}
else if (item.HasProperty("watched") && item.HasProperty("total"))
{
return item.GetProperty("watched").asInteger() < item.GetProperty("total").asInteger();
}
else if (VIDEO::IsVideoDb(item))
return true;
else if (StringUtils::StartsWithNoCase(item.GetPath(), "library://video/"))
return true;
else if (item.GetProperty("IsVideoFolder").asBoolean())
return true;
else
Expand All @@ -125,10 +137,20 @@ bool CVideoMarkUnWatched::IsVisible(const CFileItem& item) const
if (item.m_bIsFolder && item.IsPlugin()) // we cannot manage plugin folder's watched state
return false;

if (item.m_bIsFolder) // Only allow video db content, video and recording folders to be updated recursively
if (item.m_bIsFolder)
{
if (item.HasVideoInfoTag())
return VIDEO::IsVideoDb(item);
if (item.HasProperty("watchedepisodes"))
{
return item.GetProperty("watchedepisodes").asInteger() > 0;
}
else if (item.HasProperty("watched"))
{
return item.GetProperty("watched").asInteger() > 0;
}
else if (VIDEO::IsVideoDb(item))
return true;
else if (StringUtils::StartsWithNoCase(item.GetPath(), "library://video/"))
return true;
else if (item.GetProperty("IsVideoFolder").asBoolean())
return true;
else
Expand Down

0 comments on commit 251a25f

Please sign in to comment.