Skip to content

Commit

Permalink
Remove playlist filter code for subsequent PR
Browse files Browse the repository at this point in the history
  • Loading branch information
78andyp committed May 3, 2024
1 parent 4317318 commit 6a0f018
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 87 deletions.
33 changes: 0 additions & 33 deletions xbmc/video/VideoFileItemClassify.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@
#include "utils/URIUtils.h"
#include "video/VideoInfoTag.h"

#include <vector>

namespace KODI::VIDEO
{

Expand All @@ -31,24 +29,6 @@ bool IsBDFile(const CFileItem& item)
StringUtils::EqualsNoCase(strFileName, "MOVIEOBJ.BDM"));
}

bool IsBDImage(const CFileItem& item)
{
if (URIUtils::IsDiscImage(item.GetDynPath()))
{
const std::vector<std::string> BDFileNames{"index.bdmv", "MovieObject.bdmv", "INDEX.BDM",
"MOVIEOBJ.BDM"};
CURL url("udf://");
url.SetHostName(item.GetDynPath());
for (const std::string& BDFile : BDFileNames)
{
url.SetFileName("BDMV/" + BDFile);
if (CFileUtils::Exists(url.Get()))
return true;
}
}
return false;
}

bool IsDiscStub(const CFileItem& item)
{
if (IsVideoDb(item) && item.HasVideoInfoTag())
Expand Down Expand Up @@ -86,19 +66,6 @@ bool IsDVDFile(const CFileItem& item, bool bVobs /*= true*/, bool bIfos /*= true
return false;
}

bool IsDVDImage(const CFileItem& item)
{
if (URIUtils::IsDiscImage(item.GetDynPath()))
{
CURL url("udf://");
url.SetHostName(item.GetDynPath());
url.SetFileName("VIDEO_TS/VIDEO_TS.IFO");
if (CFileUtils::Exists(url.Get()))
return true;
}
return false;
}

bool IsProtectedBlurayDisc(const CFileItem& item)
{
const std::string path = URIUtils::AddFileToFolder(item.GetPath(), "AACS", "Unit_Key_RO.inf");
Expand Down
6 changes: 0 additions & 6 deletions xbmc/video/VideoFileItemClassify.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,12 @@ namespace KODI::VIDEO
//! \brief Check whether an item is a blu-ray file.
bool IsBDFile(const CFileItem& item);

//! \brief Check whether an item is a blu-ray image.
bool IsBDImage(const CFileItem& item);

//! \brief Check whether an item is a disc stub.
bool IsDiscStub(const CFileItem& item);

//! \brief Check whether an item is a DVD file.
bool IsDVDFile(const CFileItem& item, bool bVobs = true, bool bIfos = true);

//! \brief Check whether an item is a DVD image.
bool IsDVDImage(const CFileItem& item);

//! \brief Checks whether item points to a protected blu-ray disc.
bool IsProtectedBlurayDisc(const CFileItem& item);

Expand Down
48 changes: 0 additions & 48 deletions xbmc/windows/GUIMediaWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1536,54 +1536,6 @@ bool CGUIMediaWindow::OnPlayAndQueueMedia(const CFileItemPtr& item, const std::s
{ return i->IsZIP() || i->IsRAR() || i->m_bIsFolder; }),
playlist.end());

// Currently when playing a DVD, it automatically goes to the disc menu
// (there is no simple menu or play main title implementation for DVDs yet,
// and even then play main title is meaningless for episode discs, especially those without
// a play all playlist)
// However, for blu-rays, as there is the simple menu option, all the entries should remain so the user
// can select the appropriate playlist, which will then get replaced with a bluray:// DynPath

// Remove duplicates in two stages
// Firstly find each unique DynPath
CFileItemList uniqueDynPaths;
uniqueDynPaths.Copy(playlist, true);
uniqueDynPaths.erase(
std::unique(uniqueDynPaths.begin(), uniqueDynPaths.end(),
[](const std::shared_ptr<CFileItem>& i, const std::shared_ptr<CFileItem>& j)
{ return i->GetDynPath() == j->GetDynPath(); }),
uniqueDynPaths.end());

// For each DynPath - see if is DVD or, Blu-ray without simple menu enabled
// If so remove all paths other than the desired one, or the first one
for (const std::shared_ptr<CFileItem>& path : uniqueDynPaths)
{
if (IsDVDFile(*path) || IsDVDImage(*path) ||
(CServiceBroker::GetSettingsComponent()->GetSettings()->GetInt(
CSettings::SETTING_DISC_PLAYBACK) != BD_PLAYBACK_SIMPLE_MENU &&
(IsBDFile(*path) || IsBDImage(*path))))
{
if (item->GetDynPath() == path->GetDynPath())
// Remove all items (with the given DynPath) other than the desired one
playlist.erase(std::remove_if(playlist.begin(), playlist.end(),
[&item](const std::shared_ptr<CFileItem>& i) {
return i->GetDynPath() == item->GetDynPath() &&
i->GetPath() != item->GetPath();
}),
playlist.end());
else
{
// Remove all items (with the given DynPath) other than the first one
const auto& it = std::find_if(playlist.begin(), playlist.end(),
[&path](const std::shared_ptr<CFileItem>& i)
{ return i->GetDynPath() == path->GetDynPath(); });
playlist.erase(std::remove_if(it + 1, playlist.end(),
[&path](const std::shared_ptr<CFileItem>& i)
{ return i->GetDynPath() == path->GetDynPath(); }),
playlist.end());
}
}
}

// Chosen item
int mediaToPlay =
std::distance(playlist.begin(), std::find_if(playlist.begin(), playlist.end(),
Expand Down

0 comments on commit 6a0f018

Please sign in to comment.