aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArne Morten Kvarving <spiff@kodi.tv>2024-02-11 00:59:50 +0100
committerArne Morten Kvarving <spiff@kodi.tv>2024-05-05 21:41:25 +0200
commit67e9eba384d830fca76ef59b4d3067ca26c16c62 (patch)
tree6729aa604deb9e5783e537a8ba9518dd8055108f
parentcaa22c102501cee860ceb8ee22c3955c579ae325 (diff)
downloadxbmc-67e9eba384d830fca76ef59b4d3067ca26c16c62.tar.xz
move CFileItem::IsInternetStream to NetworkFileItemClassify
-rw-r--r--xbmc/FileItem.cpp70
-rw-r--r--xbmc/FileItem.h1
-rw-r--r--xbmc/Util.cpp11
-rw-r--r--xbmc/application/Application.cpp3
-rw-r--r--xbmc/application/ApplicationPlayerCallback.cpp12
-rw-r--r--xbmc/cores/VideoPlayer/DVDFileInfo.cpp3
-rw-r--r--xbmc/cores/VideoPlayer/DVDInputStreams/DVDFactoryInputStream.cpp3
-rw-r--r--xbmc/cores/playercorefactory/PlayerSelectionRule.cpp6
-rw-r--r--xbmc/guilib/guiinfo/MusicGUIInfo.cpp6
-rw-r--r--xbmc/guilib/guiinfo/VideoGUIInfo.cpp5
-rw-r--r--xbmc/music/MusicInfoLoader.cpp7
-rw-r--r--xbmc/music/MusicUtils.cpp3
-rw-r--r--xbmc/music/tags/MusicInfoTagLoaderFactory.cpp3
-rw-r--r--xbmc/music/windows/GUIWindowMusicBase.cpp3
-rw-r--r--xbmc/music/windows/GUIWindowMusicNav.cpp4
-rw-r--r--xbmc/network/CMakeLists.txt2
-rw-r--r--xbmc/network/NetworkFileItemClassify.cpp28
-rw-r--r--xbmc/network/NetworkFileItemClassify.h19
-rw-r--r--xbmc/network/test/CMakeLists.txt3
-rw-r--r--xbmc/network/test/TestNetworkFileItemClassify.cpp177
-rw-r--r--xbmc/pictures/PictureInfoLoader.cpp5
-rw-r--r--xbmc/playlists/PlayListFactory.cpp9
-rw-r--r--xbmc/video/guilib/VideoGUIUtils.cpp3
-rw-r--r--xbmc/video/windows/GUIWindowVideoBase.cpp6
-rw-r--r--xbmc/windows/GUIMediaWindow.cpp5
25 files changed, 306 insertions, 91 deletions
diff --git a/xbmc/FileItem.cpp b/xbmc/FileItem.cpp
index 1890f21db0..9744094416 100644
--- a/xbmc/FileItem.cpp
+++ b/xbmc/FileItem.cpp
@@ -32,6 +32,7 @@
#include "music/MusicFileItemClassify.h"
#include "music/tags/MusicInfoTag.h"
#include "music/tags/MusicInfoTagLoaderFactory.h"
+#include "network/NetworkFileItemClassify.h"
#include "pictures/PictureInfoTag.h"
#include "playlists/PlayList.h"
#include "playlists/PlayListFactory.h"
@@ -842,13 +843,8 @@ void CFileItem::ToSortable(SortItem &sortable, const Fields &fields) const
bool CFileItem::Exists(bool bUseCache /* = true */) const
{
- if (m_strPath.empty()
- || IsPath("add")
- || IsInternetStream()
- || IsParentFolder()
- || IsVirtualDirectoryRoot()
- || IsPlugin()
- || IsPVR())
+ if (m_strPath.empty() || IsPath("add") || NETWORK::IsInternetStream(*this) || IsParentFolder() ||
+ IsVirtualDirectoryRoot() || IsPlugin() || IsPVR())
return true;
if (IsVideoDb(*this) && HasVideoInfoTag())
@@ -971,17 +967,6 @@ bool CFileItem::IsPicture() const
return false;
}
-bool CFileItem::IsInternetStream(const bool bStrictCheck /* = false */) const
-{
- if (HasProperty("IsHTTPDirectory"))
- return bStrictCheck;
-
- if (!m_strDynPath.empty())
- return URIUtils::IsInternetStream(m_strDynPath, bStrictCheck);
-
- return URIUtils::IsInternetStream(m_strPath, bStrictCheck);
-}
-
bool CFileItem::IsStreamedFilesystem() const
{
if (!m_strDynPath.empty())
@@ -995,7 +980,7 @@ bool CFileItem::IsFileFolder(EFileFolderType types) const
EFileFolderType always_type = EFILEFOLDER_TYPE_ALWAYS;
/* internet streams are not directly expanded */
- if(IsInternetStream())
+ if (NETWORK::IsInternetStream(*this))
always_type = EFILEFOLDER_TYPE_ONCLICK;
// strm files are not browsable
@@ -1480,7 +1465,7 @@ void CFileItem::UpdateMimeType(bool lookup /*= true*/)
void CFileItem::SetMimeTypeForInternetFile()
{
- if (m_doContentLookup && IsInternetStream())
+ if (m_doContentLookup && NETWORK::IsInternetStream(*this))
{
SetMimeType("");
FillInMimeType(true);
@@ -2014,7 +1999,7 @@ std::string CFileItem::GetUserMusicThumb(bool alwaysCheckRemote /* = false */, b
{
if (m_strPath.empty() || StringUtils::StartsWithNoCase(m_strPath, "newsmartplaylist://") ||
StringUtils::StartsWithNoCase(m_strPath, "newplaylist://") || m_bIsShareOrDrive ||
- IsInternetStream() || URIUtils::IsUPnP(m_strPath) ||
+ NETWORK::IsInternetStream(*this) || URIUtils::IsUPnP(m_strPath) ||
(URIUtils::IsFTP(m_strPath) &&
!CServiceBroker::GetSettingsComponent()->GetAdvancedSettings()->m_bFTPThumbs) ||
IsPlugin() || IsAddonsPath() || IsLibraryFolder() || IsParentFolder() ||
@@ -2126,20 +2111,13 @@ std::string CFileItem::GetTBNFile() const
bool CFileItem::SkipLocalArt() const
{
- return (m_strPath.empty()
- || StringUtils::StartsWithNoCase(m_strPath, "newsmartplaylist://")
- || StringUtils::StartsWithNoCase(m_strPath, "newplaylist://")
- || m_bIsShareOrDrive
- || IsInternetStream()
- || URIUtils::IsUPnP(m_strPath)
- || (URIUtils::IsFTP(m_strPath) && !CServiceBroker::GetSettingsComponent()->GetAdvancedSettings()->m_bFTPThumbs)
- || IsPlugin()
- || IsAddonsPath()
- || IsLibraryFolder()
- || IsParentFolder()
- || IsLiveTV()
- || IsPVRRecording()
- || IsDVD());
+ return (m_strPath.empty() || StringUtils::StartsWithNoCase(m_strPath, "newsmartplaylist://") ||
+ StringUtils::StartsWithNoCase(m_strPath, "newplaylist://") || m_bIsShareOrDrive ||
+ NETWORK::IsInternetStream(*this) || URIUtils::IsUPnP(m_strPath) ||
+ (URIUtils::IsFTP(m_strPath) &&
+ !CServiceBroker::GetSettingsComponent()->GetAdvancedSettings()->m_bFTPThumbs) ||
+ IsPlugin() || IsAddonsPath() || IsLibraryFolder() || IsParentFolder() || IsLiveTV() ||
+ IsPVRRecording() || IsDVD());
}
std::string CFileItem::GetThumbHideIfUnwatched(const CFileItem* item) const
@@ -2369,15 +2347,11 @@ std::string CFileItem::GetLocalFanart() const
}
// no local fanart available for these
- if (IsInternetStream()
- || URIUtils::IsUPnP(strFile)
- || URIUtils::IsBluray(strFile)
- || IsLiveTV()
- || IsPlugin()
- || IsAddonsPath()
- || IsDVD()
- || (URIUtils::IsFTP(strFile) && !CServiceBroker::GetSettingsComponent()->GetAdvancedSettings()->m_bFTPThumbs)
- || m_strPath.empty())
+ if (NETWORK::IsInternetStream(*this) || URIUtils::IsUPnP(strFile) ||
+ URIUtils::IsBluray(strFile) || IsLiveTV() || IsPlugin() || IsAddonsPath() || IsDVD() ||
+ (URIUtils::IsFTP(strFile) &&
+ !CServiceBroker::GetSettingsComponent()->GetAdvancedSettings()->m_bFTPThumbs) ||
+ m_strPath.empty())
return "";
std::string strDir = URIUtils::GetDirectory(strFile);
@@ -2779,12 +2753,8 @@ std::string CFileItem::FindTrailer() const
}
// no local trailer available for these
- if (IsInternetStream()
- || URIUtils::IsUPnP(strFile)
- || URIUtils::IsBluray(strFile)
- || IsLiveTV()
- || IsPlugin()
- || IsDVD())
+ if (NETWORK::IsInternetStream(*this) || URIUtils::IsUPnP(strFile) ||
+ URIUtils::IsBluray(strFile) || IsLiveTV() || IsPlugin() || IsDVD())
return "";
std::string strDir = URIUtils::GetDirectory(strFile);
diff --git a/xbmc/FileItem.h b/xbmc/FileItem.h
index 0fe427a650..bf160b5070 100644
--- a/xbmc/FileItem.h
+++ b/xbmc/FileItem.h
@@ -172,7 +172,6 @@ public:
bool IsDeleted() const;
bool IsGame() const;
- bool IsInternetStream(const bool bStrictCheck = false) const;
bool IsStreamedFilesystem() const;
bool IsPlayList() const;
bool IsSmartPlayList() const;
diff --git a/xbmc/Util.cpp b/xbmc/Util.cpp
index dea659099c..82cc638bee 100644
--- a/xbmc/Util.cpp
+++ b/xbmc/Util.cpp
@@ -7,6 +7,7 @@
*/
#include "network/Network.h"
+#include "network/NetworkFileItemClassify.h"
#include "video/VideoFileItemClassify.h"
#if defined(TARGET_DARWIN)
#include <sys/param.h>
@@ -93,7 +94,7 @@ using namespace MEDIA_DETECT;
using namespace XFILE;
using namespace PLAYLIST;
using KODI::UTILITY::CDigest;
-using namespace KODI::VIDEO;
+using namespace KODI;
#if !defined(TARGET_WINDOWS)
unsigned int CUtil::s_randomSeed = time(NULL);
@@ -2056,8 +2057,8 @@ void CUtil::ScanForExternalSubtitles(const std::string& strMovie, std::vector<st
auto start = std::chrono::steady_clock::now();
CFileItem item(strMovie, false);
- if ((item.IsInternetStream() && !URIUtils::IsOnLAN(item.GetDynPath())) || item.IsPlayList() ||
- item.IsLiveTV() || !IsVideo(item))
+ if ((NETWORK::IsInternetStream(item) && !URIUtils::IsOnLAN(item.GetDynPath())) ||
+ item.IsPlayList() || item.IsLiveTV() || !VIDEO::IsVideo(item))
return;
CLog::Log(LOGDEBUG, "{}: Searching for subtitles...", __FUNCTION__);
@@ -2346,8 +2347,8 @@ std::string CUtil::GetVobSubIdxFromSub(const std::string& vobSub)
void CUtil::ScanForExternalAudio(const std::string& videoPath, std::vector<std::string>& vecAudio)
{
CFileItem item(videoPath, false);
- if (item.IsInternetStream() || item.IsPlayList() || item.IsLiveTV() || item.IsPVR() ||
- !IsVideo(item))
+ if (NETWORK::IsInternetStream(item) || item.IsPlayList() || item.IsLiveTV() || item.IsPVR() ||
+ !VIDEO::IsVideo(item))
return;
std::string strBasePath;
diff --git a/xbmc/application/Application.cpp b/xbmc/application/Application.cpp
index baa561879c..1f5c65f64e 100644
--- a/xbmc/application/Application.cpp
+++ b/xbmc/application/Application.cpp
@@ -61,6 +61,7 @@
#include "filesystem/DllLibCurl.h"
#include "filesystem/File.h"
#include "music/MusicFileItemClassify.h"
+#include "network/NetworkFileItemClassify.h"
#include "video/VideoFileItemClassify.h"
#ifdef HAS_FILESYSTEM_NFS
#include "filesystem/NFSFile.h"
@@ -2198,7 +2199,7 @@ bool CApplication::PlayMedia(CFileItem& item, const std::string& player, PLAYLIS
return ProcessAndStartPlaylist(smartpl.GetName(), playlist, smartplPlaylistId);
}
}
- else if (item.IsPlayList() || item.IsInternetStream())
+ else if (item.IsPlayList() || NETWORK::IsInternetStream(item))
{
// Not owner. Dialog auto-deletes itself.
CGUIDialogCache* dlgCache =
diff --git a/xbmc/application/ApplicationPlayerCallback.cpp b/xbmc/application/ApplicationPlayerCallback.cpp
index 258a528225..955de21f34 100644
--- a/xbmc/application/ApplicationPlayerCallback.cpp
+++ b/xbmc/application/ApplicationPlayerCallback.cpp
@@ -21,9 +21,9 @@
#include "guilib/GUIWindowManager.h"
#include "guilib/StereoscopicsManager.h"
#include "interfaces/AnnouncementManager.h"
-#include "interfaces/json-rpc/JSONUtils.h"
#include "interfaces/python/XBPython.h"
#include "music/MusicFileItemClassify.h"
+#include "network/NetworkFileItemClassify.h"
#include "profiles/ProfileManager.h"
#include "settings/AdvancedSettings.h"
#include "settings/MediaSettings.h"
@@ -39,7 +39,6 @@
#include <memory>
using namespace KODI;
-using namespace KODI::VIDEO;
CApplicationPlayerCallback::CApplicationPlayerCallback()
{
@@ -59,8 +58,9 @@ void CApplicationPlayerCallback::OnPlayBackStarted(const CFileItem& file)
std::shared_ptr<CFileItem> itemCurrentFile;
// check if VideoPlayer should set file item stream details from its current streams
- const bool isBlu_dvd_image_or_stream = (URIUtils::IsBluray(file.GetPath()) || IsDVDFile(file) ||
- file.IsDiscImage() || file.IsInternetStream());
+ const bool isBlu_dvd_image_or_stream = URIUtils::IsBluray(file.GetPath()) ||
+ VIDEO::IsDVDFile(file) || file.IsDiscImage() ||
+ NETWORK::IsInternetStream(file);
const bool hasNoStreamDetails =
(!file.HasVideoInfoTag() || !file.GetVideoInfoTag()->HasStreamDetails());
@@ -85,7 +85,7 @@ void CApplicationPlayerCallback::OnPlayBackStarted(const CFileItem& file)
* This should speed up player startup for files on internet filesystems (eg. webdav) and
* increase performance on low powered systems (Atom/ARM).
*/
- if (IsVideo(file) || file.IsGame())
+ if (VIDEO::IsVideo(file) || file.IsGame())
{
CServiceBroker::GetJobManager()->PauseJobs();
}
@@ -133,7 +133,7 @@ void CApplicationPlayerCallback::OnPlayerCloseFile(const CFileItem& file,
if ((MUSIC::IsAudio(fileItem) && advancedSettings->m_audioPlayCountMinimumPercent > 0 &&
percent >= advancedSettings->m_audioPlayCountMinimumPercent) ||
- (IsVideo(fileItem) && advancedSettings->m_videoPlayCountMinimumPercent > 0 &&
+ (VIDEO::IsVideo(fileItem) && advancedSettings->m_videoPlayCountMinimumPercent > 0 &&
percent >= advancedSettings->m_videoPlayCountMinimumPercent))
{
playCountUpdate = true;
diff --git a/xbmc/cores/VideoPlayer/DVDFileInfo.cpp b/xbmc/cores/VideoPlayer/DVDFileInfo.cpp
index 65dfc539de..9989176bb4 100644
--- a/xbmc/cores/VideoPlayer/DVDFileInfo.cpp
+++ b/xbmc/cores/VideoPlayer/DVDFileInfo.cpp
@@ -15,6 +15,7 @@
#include "ServiceBroker.h"
#include "filesystem/StackDirectory.h"
#include "guilib/Texture.h"
+#include "network/NetworkFileItemClassify.h"
#include "pictures/Picture.h"
#include "settings/AdvancedSettings.h"
#include "settings/SettingsComponent.h"
@@ -262,7 +263,7 @@ bool CDVDFileInfo::CanExtract(const CFileItem& fileItem)
URIUtils::IsPVRRecording(fileItem.GetDynPath()) ||
// plugin path not fully resolved
URIUtils::IsPlugin(fileItem.GetDynPath()) || URIUtils::IsUPnP(fileItem.GetPath()) ||
- fileItem.IsInternetStream() || VIDEO::IsDiscStub(fileItem) || fileItem.IsPlayList())
+ NETWORK::IsInternetStream(fileItem) || VIDEO::IsDiscStub(fileItem) || fileItem.IsPlayList())
return false;
// mostly can't extract from discs and files from discs.
diff --git a/xbmc/cores/VideoPlayer/DVDInputStreams/DVDFactoryInputStream.cpp b/xbmc/cores/VideoPlayer/DVDInputStreams/DVDFactoryInputStream.cpp
index 2b65938437..888c7477b5 100644
--- a/xbmc/cores/VideoPlayer/DVDInputStreams/DVDFactoryInputStream.cpp
+++ b/xbmc/cores/VideoPlayer/DVDInputStreams/DVDFactoryInputStream.cpp
@@ -9,6 +9,7 @@
#include "DVDFactoryInputStream.h"
#include "DVDInputStream.h"
+#include "network/NetworkFileItemClassify.h"
#ifdef HAVE_LIBBLURAY
#include "DVDInputStreamBluray.h"
#endif
@@ -139,7 +140,7 @@ std::shared_ptr<CDVDInputStream> CDVDFactoryInputStream::CreateInputStream(IVide
CFileItem finalFileitem(fileitem);
- if (finalFileitem.IsInternetStream())
+ if (NETWORK::IsInternetStream(finalFileitem))
{
if (finalFileitem.ContentLookup())
{
diff --git a/xbmc/cores/playercorefactory/PlayerSelectionRule.cpp b/xbmc/cores/playercorefactory/PlayerSelectionRule.cpp
index 423b6f1643..6f78649d42 100644
--- a/xbmc/cores/playercorefactory/PlayerSelectionRule.cpp
+++ b/xbmc/cores/playercorefactory/PlayerSelectionRule.cpp
@@ -12,12 +12,12 @@
#include "ServiceBroker.h"
#include "URL.h"
#include "music/MusicFileItemClassify.h"
+#include "network/NetworkFileItemClassify.h"
#include "settings/Settings.h"
#include "settings/SettingsComponent.h"
#include "utils/RegExp.h"
#include "utils/StreamDetails.h"
#include "utils/StringUtils.h"
-#include "utils/XBMCTinyXML.h"
#include "utils/XMLUtils.h"
#include "utils/log.h"
#include "video/VideoFileItemClassify.h"
@@ -124,7 +124,7 @@ void CPlayerSelectionRule::GetPlayers(const CFileItem& item, std::vector<std::st
return;
if (m_tGame >= 0 && (m_tGame > 0) != item.IsGame())
return;
- if (m_tInternetStream >= 0 && (m_tInternetStream > 0) != item.IsInternetStream())
+ if (m_tInternetStream >= 0 && (m_tInternetStream > 0) != NETWORK::IsInternetStream(item))
return;
if (m_tRemote >= 0 && (m_tRemote > 0) != item.IsRemote())
return;
@@ -207,5 +207,3 @@ void CPlayerSelectionRule::GetPlayers(const CFileItem& item, std::vector<std::st
players.push_back(m_playerName);
}
}
-
-
diff --git a/xbmc/guilib/guiinfo/MusicGUIInfo.cpp b/xbmc/guilib/guiinfo/MusicGUIInfo.cpp
index 6edae7a808..cb246febda 100644
--- a/xbmc/guilib/guiinfo/MusicGUIInfo.cpp
+++ b/xbmc/guilib/guiinfo/MusicGUIInfo.cpp
@@ -25,6 +25,7 @@
#include "music/MusicInfoLoader.h"
#include "music/MusicThumbLoader.h"
#include "music/tags/MusicInfoTag.h"
+#include "network/NetworkFileItemClassify.h"
#include "playlists/PlayList.h"
#include "settings/AdvancedSettings.h"
#include "settings/SettingsComponent.h"
@@ -40,7 +41,8 @@ bool CMusicGUIInfo::InitCurrentItem(CFileItem *item)
{
const auto& components = CServiceBroker::GetAppComponents();
const auto appPlayer = components.GetComponent<CApplicationPlayer>();
- if (item && (MUSIC::IsAudio(*item) || (item->IsInternetStream() && appPlayer->IsPlayingAudio())))
+ if (item &&
+ (MUSIC::IsAudio(*item) || (NETWORK::IsInternetStream(*item) && appPlayer->IsPlayingAudio())))
{
CLog::Log(LOGDEBUG, "CMusicGUIInfo::InitCurrentItem({})", item->GetPath());
@@ -50,7 +52,7 @@ bool CMusicGUIInfo::InitCurrentItem(CFileItem *item)
tag->SetLoaded(true);
// find a thumb for this file.
- if (item->IsInternetStream() && !MUSIC::IsMusicDb(*item))
+ if (NETWORK::IsInternetStream(*item) && !MUSIC::IsMusicDb(*item))
{
if (!g_application.m_strPlayListFile.empty())
{
diff --git a/xbmc/guilib/guiinfo/VideoGUIInfo.cpp b/xbmc/guilib/guiinfo/VideoGUIInfo.cpp
index 9e440b2539..6bec6186b7 100644
--- a/xbmc/guilib/guiinfo/VideoGUIInfo.cpp
+++ b/xbmc/guilib/guiinfo/VideoGUIInfo.cpp
@@ -26,6 +26,7 @@
#include "guilib/guiinfo/GUIInfo.h"
#include "guilib/guiinfo/GUIInfoHelper.h"
#include "guilib/guiinfo/GUIInfoLabels.h"
+#include "network/NetworkFileItemClassify.h"
#include "playlists/PlayList.h"
#include "settings/AdvancedSettings.h"
#include "settings/SettingUtils.h"
@@ -66,7 +67,7 @@ bool CVideoGUIInfo::InitCurrentItem(CFileItem *item)
if (item && VIDEO::IsVideo(*item))
{
// special case where .strm is used to start an audio stream
- if (item->IsInternetStream() && m_appPlayer->IsPlayingAudio())
+ if (NETWORK::IsInternetStream(*item) && m_appPlayer->IsPlayingAudio())
return false;
CLog::Log(LOGDEBUG, "CVideoGUIInfo::InitCurrentItem({})", CURL::GetRedacted(item->GetPath()));
@@ -79,7 +80,7 @@ bool CVideoGUIInfo::InitCurrentItem(CFileItem *item)
}
// find a thumb for this stream
- if (item->IsInternetStream())
+ if (NETWORK::IsInternetStream(*item))
{
if (!g_application.m_strPlayListFile.empty())
{
diff --git a/xbmc/music/MusicInfoLoader.cpp b/xbmc/music/MusicInfoLoader.cpp
index e49b511ad4..a6bff1a36e 100644
--- a/xbmc/music/MusicInfoLoader.cpp
+++ b/xbmc/music/MusicInfoLoader.cpp
@@ -21,6 +21,7 @@
#include "music/MusicFileItemClassify.h"
#include "music/tags/MusicInfoTag.h"
#include "music/tags/MusicInfoTagLoaderFactory.h"
+#include "network/NetworkFileItemClassify.h"
#include "settings/Settings.h"
#include "settings/SettingsComponent.h"
#include "utils/Archive.h"
@@ -75,7 +76,7 @@ void CMusicInfoLoader::OnLoaderStart()
bool CMusicInfoLoader::LoadAdditionalTagInfo(CFileItem* pItem)
{
if (!pItem || (pItem->m_bIsFolder && !MUSIC::IsAudio(*pItem)) || pItem->IsPlayList() ||
- pItem->IsNFO() || pItem->IsInternetStream())
+ pItem->IsNFO() || NETWORK::IsInternetStream(*pItem))
return false;
if (pItem->GetProperty("hasfullmusictag") == "true")
@@ -152,7 +153,7 @@ bool CMusicInfoLoader::LoadItemCached(CFileItem* pItem)
pItem->IsSmartPlayList() ||
StringUtils::StartsWithNoCase(pItem->GetPath(), "newplaylist://") ||
StringUtils::StartsWithNoCase(pItem->GetPath(), "newsmartplaylist://") || pItem->IsNFO() ||
- (pItem->IsInternetStream() && !MUSIC::IsMusicDb(*pItem)))
+ (NETWORK::IsInternetStream(*pItem) && !MUSIC::IsMusicDb(*pItem)))
return false;
// Get thumb for item
@@ -170,7 +171,7 @@ bool CMusicInfoLoader::LoadItemLookup(CFileItem* pItem)
pItem->IsPlayList() || pItem->IsSmartPlayList() || //
StringUtils::StartsWithNoCase(pItem->GetPath(), "newplaylist://") || //
StringUtils::StartsWithNoCase(pItem->GetPath(), "newsmartplaylist://") || //
- pItem->IsNFO() || (pItem->IsInternetStream() && !MUSIC::IsMusicDb(*pItem)))
+ pItem->IsNFO() || (NETWORK::IsInternetStream(*pItem) && !MUSIC::IsMusicDb(*pItem)))
return false;
if ((!pItem->HasMusicInfoTag() || !pItem->GetMusicInfoTag()->Loaded()) && MUSIC::IsAudio(*pItem))
diff --git a/xbmc/music/MusicUtils.cpp b/xbmc/music/MusicUtils.cpp
index bac6901bf0..c3e6b71625 100644
--- a/xbmc/music/MusicUtils.cpp
+++ b/xbmc/music/MusicUtils.cpp
@@ -31,6 +31,7 @@
#include "music/MusicDbUrl.h"
#include "music/MusicFileItemClassify.h"
#include "music/tags/MusicInfoTag.h"
+#include "network/NetworkFileItemClassify.h"
#include "playlists/PlayList.h"
#include "playlists/PlayListFactory.h"
#include "profiles/ProfileManager.h"
@@ -601,7 +602,7 @@ void CAsyncGetItemsForPlaylist::GetItemsForPlaylist(const std::shared_ptr<CFileI
GetItemsForPlaylist((*playList)[i]);
}
}
- else if (item->IsInternetStream() && !MUSIC::IsMusicDb(*item))
+ else if (NETWORK::IsInternetStream(*item) && !MUSIC::IsMusicDb(*item))
{
// just queue the internet stream, it will be expanded on play
m_queuedItems.Add(item);
diff --git a/xbmc/music/tags/MusicInfoTagLoaderFactory.cpp b/xbmc/music/tags/MusicInfoTagLoaderFactory.cpp
index b5e3567bda..523b0bf233 100644
--- a/xbmc/music/tags/MusicInfoTagLoaderFactory.cpp
+++ b/xbmc/music/tags/MusicInfoTagLoaderFactory.cpp
@@ -19,6 +19,7 @@
#include "addons/ExtsMimeSupportList.h"
#include "addons/addoninfo/AddonType.h"
#include "music/MusicFileItemClassify.h"
+#include "network/NetworkFileItemClassify.h"
#include "utils/StringUtils.h"
#include "utils/URIUtils.h"
@@ -33,7 +34,7 @@ CMusicInfoTagLoaderFactory::~CMusicInfoTagLoaderFactory() = default;
IMusicInfoTagLoader* CMusicInfoTagLoaderFactory::CreateLoader(const CFileItem& item)
{
// dont try to read the tags for streams & shoutcast
- if (item.IsInternetStream())
+ if (NETWORK::IsInternetStream(item))
return NULL;
if (MUSIC::IsMusicDb(item))
diff --git a/xbmc/music/windows/GUIWindowMusicBase.cpp b/xbmc/music/windows/GUIWindowMusicBase.cpp
index 3ebcc46f86..5ace8dcfe4 100644
--- a/xbmc/music/windows/GUIWindowMusicBase.cpp
+++ b/xbmc/music/windows/GUIWindowMusicBase.cpp
@@ -24,6 +24,7 @@
#include "application/ApplicationComponents.h"
#include "application/ApplicationPlayer.h"
#include "music/MusicFileItemClassify.h"
+#include "network/NetworkFileItemClassify.h"
#include "video/VideoFileItemClassify.h"
#ifdef HAS_CDDA_RIPPER
#include "cdrip/CDDARipper.h"
@@ -711,7 +712,7 @@ bool CGUIWindowMusicBase::OnPlayMedia(int iItem, const std::string &player)
g_partyModeManager.AddUserSongs(playlistTemp, !CServiceBroker::GetSettingsComponent()->GetSettings()->GetBool(CSettings::SETTING_MUSICPLAYER_QUEUEBYDEFAULT));
return true;
}
- else if (!pItem->IsPlayList() && !pItem->IsInternetStream())
+ else if (!pItem->IsPlayList() && !NETWORK::IsInternetStream(*pItem))
{ // single music file - if we get here then we have autoplaynextitem turned off or queuebydefault
// turned on, but we still want to use the playlist player in order to handle more queued items
// following etc.
diff --git a/xbmc/music/windows/GUIWindowMusicNav.cpp b/xbmc/music/windows/GUIWindowMusicNav.cpp
index 3f6cd7508f..46e1fab725 100644
--- a/xbmc/music/windows/GUIWindowMusicNav.cpp
+++ b/xbmc/music/windows/GUIWindowMusicNav.cpp
@@ -33,6 +33,7 @@
#include "music/MusicLibraryQueue.h"
#include "music/dialogs/GUIDialogInfoProviderSettings.h"
#include "music/tags/MusicInfoTag.h"
+#include "network/NetworkFileItemClassify.h"
#include "playlists/PlayList.h"
#include "playlists/PlayListFactory.h"
#include "profiles/ProfileManager.h"
@@ -612,7 +613,8 @@ void CGUIWindowMusicNav::GetContextButtons(int itemNumber, CContextButtons &butt
// Scan button for real folders containing files when navigating within music sources.
// Blacklist the bespoke Kodi protocols as to many valid external protocols to whitelist
if (m_vecItems->GetContent() == "files" && // Other content not scanned to library
- !inPlaylists && !m_vecItems->IsInternetStream() && // Not playlists locations or streams
+ !inPlaylists &&
+ !NETWORK::IsInternetStream(*m_vecItems) && // Not playlists locations or streams
!item->IsPath("add") && !item->IsParentFolder() && // Not ".." and "Add items
item->m_bIsFolder && // Folders only, but playlists can be folders too
!URIUtils::IsLibraryContent(item->GetPath()) && // database folder or .xsp files
diff --git a/xbmc/network/CMakeLists.txt b/xbmc/network/CMakeLists.txt
index 147af290b6..2060605761 100644
--- a/xbmc/network/CMakeLists.txt
+++ b/xbmc/network/CMakeLists.txt
@@ -4,6 +4,7 @@ set(SOURCES DNSNameCache.cpp
EventServer.cpp
GUIDialogNetworkSetup.cpp
Network.cpp
+ NetworkFileItemClassify.cpp
NetworkServices.cpp
Socket.cpp
TCPServer.cpp
@@ -18,6 +19,7 @@ set(HEADERS DNSNameCache.h
EventServer.h
GUIDialogNetworkSetup.h
Network.h
+ NetworkFileItemClassify.h
NetworkServices.h
Socket.h
TCPServer.h
diff --git a/xbmc/network/NetworkFileItemClassify.cpp b/xbmc/network/NetworkFileItemClassify.cpp
new file mode 100644
index 0000000000..b73a0a45c9
--- /dev/null
+++ b/xbmc/network/NetworkFileItemClassify.cpp
@@ -0,0 +1,28 @@
+/*
+ * Copyright (C) 2005-2020 Team Kodi
+ * This file is part of Kodi - https://kodi.tv
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ * See LICENSES/README.md for more information.
+ */
+
+#include "network/NetworkFileItemClassify.h"
+
+#include "FileItem.h"
+#include "utils/URIUtils.h"
+
+namespace KODI::NETWORK
+{
+
+bool IsInternetStream(const CFileItem& item, const bool bStrictCheck /* = false */)
+{
+ if (item.HasProperty("IsHTTPDirectory"))
+ return bStrictCheck;
+
+ if (!item.GetDynPath().empty())
+ return URIUtils::IsInternetStream(item.GetDynPath(), bStrictCheck);
+
+ return URIUtils::IsInternetStream(item.GetPath(), bStrictCheck);
+}
+
+} // namespace KODI::NETWORK
diff --git a/xbmc/network/NetworkFileItemClassify.h b/xbmc/network/NetworkFileItemClassify.h
new file mode 100644
index 0000000000..22d34c1702
--- /dev/null
+++ b/xbmc/network/NetworkFileItemClassify.h
@@ -0,0 +1,19 @@
+/*
+ * Copyright (C) 2005-2018 Team Kodi
+ * This file is part of Kodi - https://kodi.tv
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ * See LICENSES/README.md for more information.
+ */
+
+#pragma once
+
+class CFileItem;
+
+namespace KODI::NETWORK
+{
+
+//! \brief Check whether an item is a an internet stream.
+bool IsInternetStream(const CFileItem& item, const bool bStrictCheck = false);
+
+} // namespace KODI::NETWORK
diff --git a/xbmc/network/test/CMakeLists.txt b/xbmc/network/test/CMakeLists.txt
index 05eb260c0b..b075775736 100644
--- a/xbmc/network/test/CMakeLists.txt
+++ b/xbmc/network/test/CMakeLists.txt
@@ -1,4 +1,5 @@
-set(SOURCES TestNetwork.cpp)
+set(SOURCES TestNetwork.cpp
+ TestNetworkFileItemClassify.cpp)
if(MICROHTTPD_FOUND)
list(APPEND SOURCES TestWebServer.cpp)
diff --git a/xbmc/network/test/TestNetworkFileItemClassify.cpp b/xbmc/network/test/TestNetworkFileItemClassify.cpp
new file mode 100644
index 0000000000..335b8340fc
--- /dev/null
+++ b/xbmc/network/test/TestNetworkFileItemClassify.cpp
@@ -0,0 +1,177 @@
+/*
+ * Copyright (C) 2005-2018 Team Kodi
+ * This file is part of Kodi - https://kodi.tv
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ * See LICENSES/README.md for more information.
+ */
+
+#include "FileItem.h"
+#include "filesystem/StackDirectory.h"
+#include "network/NetworkFileItemClassify.h"
+
+#include <array>
+#include <string>
+
+#include <gtest/gtest.h>
+
+using namespace KODI;
+
+struct InternetStreamDefinition
+{
+ InternetStreamDefinition(const std::string& path, bool folder, bool strict, bool res)
+ : item(path, folder), strictCheck(strict), result(res)
+ {
+ }
+
+ CFileItem item;
+ bool strictCheck;
+ bool result;
+};
+
+class InternetStreamTest : public testing::WithParamInterface<InternetStreamDefinition>,
+ public testing::Test
+{
+};
+
+TEST_P(InternetStreamTest, IsInternetStream)
+{
+ EXPECT_EQ(NETWORK::IsInternetStream(GetParam().item, GetParam().strictCheck), GetParam().result);
+}
+
+const auto inetstream_tests = std::array{
+ InternetStreamDefinition{"/home/user/test.disc", false, false, false},
+ InternetStreamDefinition{"/home/user/test.disc", true, true, false},
+ InternetStreamDefinition{"http://some.where/foo", false, false, true},
+ InternetStreamDefinition{"http://some.where/foo", false, true, true},
+ InternetStreamDefinition{"http://some.where/foo", true, false, true},
+ InternetStreamDefinition{"http://some.where/foo", true, true, true},
+ InternetStreamDefinition{"https://some.where/foo", false, false, true},
+ InternetStreamDefinition{"https://some.where/foo", false, true, true},
+ InternetStreamDefinition{"https://some.where/foo", true, false, true},
+ InternetStreamDefinition{"https://some.where/foo", true, true, true},
+ InternetStreamDefinition{"tcp://some.where/foo", false, false, true},
+ InternetStreamDefinition{"tcp://some.where/foo", false, true, true},
+ InternetStreamDefinition{"tcp://some.where/foo", true, false, true},
+ InternetStreamDefinition{"tcp://some.where/foo", true, true, true},
+ InternetStreamDefinition{"udp://some.where/foo", false, false, true},
+ InternetStreamDefinition{"udp://some.where/foo", false, true, true},
+ InternetStreamDefinition{"udp://some.where/foo", true, false, true},
+ InternetStreamDefinition{"udp://some.where/foo", true, true, true},
+ InternetStreamDefinition{"rtp://some.where/foo", false, false, true},
+ InternetStreamDefinition{"rtp://some.where/foo", false, false, true},
+ InternetStreamDefinition{"rtp://some.where/foo", true, false, true},
+ InternetStreamDefinition{"rtp://some.where/foo", true, true, true},
+ InternetStreamDefinition{"sdp://some.where/foo", false, false, true},
+ InternetStreamDefinition{"sdp://some.where/foo", false, true, true},
+ InternetStreamDefinition{"sdp://some.where/foo", true, false, true},
+ InternetStreamDefinition{"sdp://some.where/foo", true, true, true},
+ InternetStreamDefinition{"mms://some.where/foo", false, false, true},
+ InternetStreamDefinition{"mms://some.where/foo", false, true, true},
+ InternetStreamDefinition{"mms://some.where/foo", true, false, true},
+ InternetStreamDefinition{"mms://some.where/foo", true, true, true},
+ InternetStreamDefinition{"mmst://some.where/foo", false, false, true},
+ InternetStreamDefinition{"mmst://some.where/foo", false, true, true},
+ InternetStreamDefinition{"mmst://some.where/foo", true, false, true},
+ InternetStreamDefinition{"mmst://some.where/foo", true, true, true},
+ InternetStreamDefinition{"mmsh://some.where/foo", false, false, true},
+ InternetStreamDefinition{"mmsh://some.where/foo", false, true, true},
+ InternetStreamDefinition{"mmsh://some.where/foo", true, false, true},
+ InternetStreamDefinition{"mmsh://some.where/foo", true, true, true},
+ InternetStreamDefinition{"rtsp://some.where/foo", false, false, true},
+ InternetStreamDefinition{"rtsp://some.where/foo", false, true, true},
+ InternetStreamDefinition{"rtsp://some.where/foo", true, false, true},
+ InternetStreamDefinition{"rtsp://some.where/foo", true, true, true},
+ InternetStreamDefinition{"rtmp://some.where/foo", false, false, true},
+ InternetStreamDefinition{"rtmp://some.where/foo", false, true, true},
+ InternetStreamDefinition{"rtmp://some.where/foo", true, false, true},
+ InternetStreamDefinition{"rtmp://some.where/foo", true, true, true},
+ InternetStreamDefinition{"rtmpt://some.where/foo", false, false, true},
+ InternetStreamDefinition{"rtmpt://some.where/foo", false, true, true},
+ InternetStreamDefinition{"rtmpt://some.where/foo", true, false, true},
+ InternetStreamDefinition{"rtmpt://some.where/foo", true, true, true},
+ InternetStreamDefinition{"rtmpe://some.where/foo", false, false, true},
+ InternetStreamDefinition{"rtmpe://some.where/foo", false, true, true},
+ InternetStreamDefinition{"rtmpe://some.where/foo", true, false, true},
+ InternetStreamDefinition{"rtmpe://some.where/foo", true, true, true},
+ InternetStreamDefinition{"rtmpte://some.where/foo", false, false, true},
+ InternetStreamDefinition{"rtmpte://some.where/foo", false, true, true},
+ InternetStreamDefinition{"rtmpte://some.where/foo", true, false, true},
+ InternetStreamDefinition{"rtmpte://some.where/foo", true, true, true},
+ InternetStreamDefinition{"rtmps://some.where/foo", false, false, true},
+ InternetStreamDefinition{"rtmps://some.where/foo", false, true, true},
+ InternetStreamDefinition{"rtmps://some.where/foo", true, false, true},
+ InternetStreamDefinition{"rtmps://some.where/foo", true, true, true},
+ InternetStreamDefinition{"shout://some.where/foo", false, false, true},
+ InternetStreamDefinition{"shout://some.where/foo", false, true, true},
+ InternetStreamDefinition{"shout://some.where/foo", true, false, true},
+ InternetStreamDefinition{"shout://some.where/foo", true, true, true},
+ InternetStreamDefinition{"rss://some.where/foo", false, false, true},
+ InternetStreamDefinition{"rss://some.where/foo", false, true, true},
+ InternetStreamDefinition{"rss://some.where/foo", true, false, true},
+ InternetStreamDefinition{"rss://some.where/foo", true, true, true},
+ InternetStreamDefinition{"rsss://some.where/foo", false, false, true},
+ InternetStreamDefinition{"rsss://some.where/foo", false, true, true},
+ InternetStreamDefinition{"rsss://some.where/foo", true, false, true},
+ InternetStreamDefinition{"rsss://some.where/foo", true, true, true},
+ InternetStreamDefinition{"upnp://some.where/foo", false, false, false},
+ InternetStreamDefinition{"upnp://some.where/foo", true, false, false},
+ InternetStreamDefinition{"upnp://some.where/foo", false, true, true},
+ InternetStreamDefinition{"upnp://some.where/foo", true, true, true},
+ InternetStreamDefinition{"ftp://some.where/foo", false, false, false},
+ InternetStreamDefinition{"ftp://some.where/foo", true, false, false},
+ InternetStreamDefinition{"ftp://some.where/foo", false, true, true},
+ InternetStreamDefinition{"ftp://some.where/foo", true, true, true},
+ InternetStreamDefinition{"sftp://some.where/foo", false, false, false},
+ InternetStreamDefinition{"sftp://some.where/foo", true, false, false},
+ InternetStreamDefinition{"sftp://some.where/foo", false, true, true},
+ InternetStreamDefinition{"sftp://some.where/foo", true, true, true},
+ InternetStreamDefinition{"ssh://some.where/foo", false, false, false},
+ InternetStreamDefinition{"ssh://some.where/foo", true, false, false},
+ InternetStreamDefinition{"ssh://some.where/foo", false, true, true},
+ InternetStreamDefinition{"ssh://some.where/foo", true, true, true},
+ InternetStreamDefinition{"ssh://some.where/foo", true, true, true},
+};
+
+INSTANTIATE_TEST_SUITE_P(TestNetworkFileItemClassify,
+ InternetStreamTest,
+ testing::ValuesIn(inetstream_tests));
+
+TEST(TestNetworkWorkFileItemClassify, InternetStreamStacks)
+{
+ std::string stackPath;
+ EXPECT_TRUE(XFILE::CStackDirectory::ConstructStackPath(
+ {"/home/foo/somthing.avi", "/home/bar/else.mkv"}, stackPath));
+ EXPECT_FALSE(NETWORK::IsInternetStream(CFileItem(stackPath, false), false));
+ EXPECT_FALSE(NETWORK::IsInternetStream(CFileItem(stackPath, true), false));
+ EXPECT_FALSE(NETWORK::IsInternetStream(CFileItem(stackPath, false), true));
+ EXPECT_FALSE(NETWORK::IsInternetStream(CFileItem(stackPath, true), true));
+
+ EXPECT_TRUE(XFILE::CStackDirectory::ConstructStackPath(
+ {"https://home/foo/somthing.avi", "https://home/bar/else.mkv"}, stackPath));
+ EXPECT_TRUE(NETWORK::IsInternetStream(CFileItem(stackPath, false), false));
+ EXPECT_TRUE(NETWORK::IsInternetStream(CFileItem(stackPath, true), false));
+ EXPECT_TRUE(NETWORK::IsInternetStream(CFileItem(stackPath, false), true));
+ EXPECT_TRUE(NETWORK::IsInternetStream(CFileItem(stackPath, true), true));
+
+ EXPECT_TRUE(XFILE::CStackDirectory::ConstructStackPath(
+ {"ftp://home/foo/somthing.avi", "ftp://home/bar/else.mkv"}, stackPath));
+ EXPECT_FALSE(NETWORK::IsInternetStream(CFileItem(stackPath, false), false));
+ EXPECT_FALSE(NETWORK::IsInternetStream(CFileItem(stackPath, true), false));
+ EXPECT_TRUE(NETWORK::IsInternetStream(CFileItem(stackPath, false), true));
+ EXPECT_TRUE(NETWORK::IsInternetStream(CFileItem(stackPath, true), true));
+
+ EXPECT_TRUE(XFILE::CStackDirectory::ConstructStackPath(
+ {"ftp://home/foo/somthing.avi", "/home/bar/else.mkv"}, stackPath));
+ EXPECT_FALSE(NETWORK::IsInternetStream(CFileItem(stackPath, false), false));
+ EXPECT_FALSE(NETWORK::IsInternetStream(CFileItem(stackPath, true), false));
+ EXPECT_TRUE(NETWORK::IsInternetStream(CFileItem(stackPath, false), true));
+ EXPECT_TRUE(NETWORK::IsInternetStream(CFileItem(stackPath, true), true));
+
+ EXPECT_TRUE(XFILE::CStackDirectory::ConstructStackPath(
+ {"/home/foo/somthing.avi", "ftp://home/bar/else.mkv"}, stackPath));
+ EXPECT_FALSE(NETWORK::IsInternetStream(CFileItem(stackPath, false), false));
+ EXPECT_FALSE(NETWORK::IsInternetStream(CFileItem(stackPath, true), false));
+ EXPECT_FALSE(NETWORK::IsInternetStream(CFileItem(stackPath, false), true));
+ EXPECT_FALSE(NETWORK::IsInternetStream(CFileItem(stackPath, true), true));
+}
diff --git a/xbmc/pictures/PictureInfoLoader.cpp b/xbmc/pictures/PictureInfoLoader.cpp
index 14a880bcec..507834e5bd 100644
--- a/xbmc/pictures/PictureInfoLoader.cpp
+++ b/xbmc/pictures/PictureInfoLoader.cpp
@@ -12,6 +12,7 @@
#include "FileItemList.h"
#include "PictureInfoTag.h"
#include "ServiceBroker.h"
+#include "network/NetworkFileItemClassify.h"
#include "settings/Settings.h"
#include "settings/SettingsComponent.h"
#include "video/VideoFileItemClassify.h"
@@ -55,7 +56,7 @@ bool CPictureInfoLoader::LoadItem(CFileItem* pItem)
bool CPictureInfoLoader::LoadItemCached(CFileItem* pItem)
{
if (!pItem->IsPicture() || pItem->IsZIP() || pItem->IsRAR() || pItem->IsCBR() || pItem->IsCBZ() ||
- pItem->IsInternetStream() || VIDEO::IsVideo(*pItem))
+ NETWORK::IsInternetStream(*pItem) || VIDEO::IsVideo(*pItem))
return false;
if (pItem->HasPictureInfoTag())
@@ -79,7 +80,7 @@ bool CPictureInfoLoader::LoadItemLookup(CFileItem* pItem)
m_pProgressCallback->SetProgressAdvance();
if (!pItem->IsPicture() || pItem->IsZIP() || pItem->IsRAR() || pItem->IsCBR() || pItem->IsCBZ() ||
- pItem->IsInternetStream() || VIDEO::IsVideo(*pItem))
+ NETWORK::IsInternetStream(*pItem) || VIDEO::IsVideo(*pItem))
return false;
if (pItem->HasPictureInfoTag())
diff --git a/xbmc/playlists/PlayListFactory.cpp b/xbmc/playlists/PlayListFactory.cpp
index dc45bcce2d..4bae13dd27 100644
--- a/xbmc/playlists/PlayListFactory.cpp
+++ b/xbmc/playlists/PlayListFactory.cpp
@@ -9,6 +9,7 @@
#include "PlayListFactory.h"
#include "FileItem.h"
+#include "network/NetworkFileItemClassify.h"
#include "playlists/PlayListB4S.h"
#include "playlists/PlayListM3U.h"
#include "playlists/PlayListPLS.h"
@@ -19,6 +20,7 @@
#include "utils/StringUtils.h"
#include "utils/URIUtils.h"
+using namespace KODI;
using namespace PLAYLIST;
CPlayList* CPlayListFactory::Create(const std::string& filename)
@@ -29,7 +31,7 @@ CPlayList* CPlayListFactory::Create(const std::string& filename)
CPlayList* CPlayListFactory::Create(const CFileItem& item)
{
- if (item.IsInternetStream())
+ if (NETWORK::IsInternetStream(item))
{
// Ensure the MIME type has been retrieved for http:// and shout:// streams
if (item.GetMimeType().empty())
@@ -71,7 +73,8 @@ CPlayList* CPlayListFactory::Create(const CFileItem& item)
std::string extension = URIUtils::GetExtension(path);
StringUtils::ToLower(extension);
- if (extension == ".m3u" || (extension == ".m3u8" && !item.IsInternetStream()) || extension == ".strm")
+ if (extension == ".m3u" || (extension == ".m3u8" && !NETWORK::IsInternetStream(item)) ||
+ extension == ".strm")
return new CPlayListM3U();
if (extension == ".pls")
@@ -120,7 +123,7 @@ bool CPlayListFactory::IsPlaylist(const CFileItem& item)
*/
// online m3u8 files are hls:// -- do not treat as playlist
- if (item.IsInternetStream() && item.IsType(".m3u8"))
+ if (NETWORK::IsInternetStream(item) && item.IsType(".m3u8"))
return false;
if(strMimeType == "audio/x-pn-realaudio"
diff --git a/xbmc/video/guilib/VideoGUIUtils.cpp b/xbmc/video/guilib/VideoGUIUtils.cpp
index 36464cae95..8cadb0e755 100644
--- a/xbmc/video/guilib/VideoGUIUtils.cpp
+++ b/xbmc/video/guilib/VideoGUIUtils.cpp
@@ -24,6 +24,7 @@
#include "guilib/GUIWindowManager.h"
#include "guilib/LocalizeStrings.h"
#include "music/MusicFileItemClassify.h"
+#include "network/NetworkFileItemClassify.h"
#include "playlists/PlayList.h"
#include "playlists/PlayListFactory.h"
#include "profiles/ProfileManager.h"
@@ -295,7 +296,7 @@ void CAsyncGetItemsForPlaylist::GetItemsForPlaylist(const std::shared_ptr<CFileI
// just queue the playlist, it will be expanded on play
m_queuedItems.Add(item);
}
- else if (item->IsInternetStream())
+ else if (NETWORK::IsInternetStream(*item))
{
// just queue the internet stream, it will be expanded on play
m_queuedItems.Add(item);
diff --git a/xbmc/video/windows/GUIWindowVideoBase.cpp b/xbmc/video/windows/GUIWindowVideoBase.cpp
index 6a9f1faecf..50da6ba3b8 100644
--- a/xbmc/video/windows/GUIWindowVideoBase.cpp
+++ b/xbmc/video/windows/GUIWindowVideoBase.cpp
@@ -37,6 +37,7 @@
#include "input/actions/ActionIDs.h"
#include "messaging/helpers/DialogOKHelper.h"
#include "music/dialogs/GUIDialogMusicInfo.h"
+#include "network/NetworkFileItemClassify.h"
#include "playlists/PlayList.h"
#include "playlists/PlayListFactory.h"
#include "profiles/ProfileManager.h"
@@ -1231,8 +1232,9 @@ bool CGUIWindowVideoBase::GetDirectory(const std::string &strDirectory, CFileIte
bool CGUIWindowVideoBase::StackingAvailable(const CFileItemList &items)
{
CURL url(items.GetPath());
- return !(items.IsPlugin() || items.IsAddonsPath() || items.IsRSS() || items.IsInternetStream() ||
- VIDEO::IsVideoDb(items) || url.IsProtocol("playlistvideo"));
+ return !(items.IsPlugin() || items.IsAddonsPath() || items.IsRSS() ||
+ NETWORK::IsInternetStream(items) || VIDEO::IsVideoDb(items) ||
+ url.IsProtocol("playlistvideo"));
}
void CGUIWindowVideoBase::GetGroupedItems(CFileItemList &items)
diff --git a/xbmc/windows/GUIMediaWindow.cpp b/xbmc/windows/GUIMediaWindow.cpp
index 62cf70e6d0..f764b671c5 100644
--- a/xbmc/windows/GUIMediaWindow.cpp
+++ b/xbmc/windows/GUIMediaWindow.cpp
@@ -24,6 +24,7 @@
#include "addons/addoninfo/AddonType.h"
#include "application/Application.h"
#include "messaging/ApplicationMessenger.h"
+#include "network/NetworkFileItemClassify.h"
#if defined(TARGET_ANDROID)
#include "platform/android/activity/XBMCApp.h"
#endif
@@ -76,8 +77,8 @@
#define PLUGIN_REFRESH_DELAY 200
using namespace ADDON;
+using namespace KODI;
using namespace KODI::MESSAGING;
-using namespace KODI::VIDEO;
using namespace std::chrono_literals;
namespace
@@ -1500,7 +1501,7 @@ bool CGUIMediaWindow::OnPlayMedia(int iItem, const std::string &player)
CLog::Log(LOGDEBUG, "{} {}", __FUNCTION__, CURL::GetRedacted(pItem->GetPath()));
bool bResult = false;
- if (pItem->IsInternetStream() || pItem->IsPlayList())
+ if (NETWORK::IsInternetStream(*pItem) || pItem->IsPlayList())
bResult = g_application.PlayMedia(*pItem, player, m_guiState->GetPlaylist());
else
bResult = g_application.PlayFile(*pItem, player);