aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRainer Hochecker <fernetmenta@online.de>2018-04-17 07:40:08 +0200
committerGitHub <noreply@github.com>2018-04-17 07:40:08 +0200
commit940c58faedccd99f6f73d358c1d413be4446f12f (patch)
tree67d883aa9b8aa8d99dc58fbb00b736b1e1634aaf
parent992b39364fdc7bc453e417ed6f95ef32f6180367 (diff)
parent983ca93c373c13940c5a389a18b123d502e52904 (diff)
Merge pull request #13771 from FernetMenta/plugin
more use dynPath instead of changing path (id)
-rw-r--r--xbmc/Application.cpp35
-rw-r--r--xbmc/Application.h2
-rw-r--r--xbmc/addons/Scraper.cpp12
-rw-r--r--xbmc/filesystem/PluginDirectory.cpp3
-rw-r--r--xbmc/network/upnp/UPnPInternal.cpp2
5 files changed, 25 insertions, 29 deletions
diff --git a/xbmc/Application.cpp b/xbmc/Application.cpp
index 3857e35fef..f5b1337a69 100644
--- a/xbmc/Application.cpp
+++ b/xbmc/Application.cpp
@@ -2915,17 +2915,17 @@ void CApplication::Stop(int exitCode)
Sleep(200);
}
-bool CApplication::PlayMedia(const CFileItem& item, const std::string &player, int iPlaylist)
+bool CApplication::PlayMedia(CFileItem& item, const std::string &player, int iPlaylist)
{
- //If item is a plugin, expand out now and run ourselves again
- if (item.IsPlugin())
+ //If item is a plugin, expand out
+ if (URIUtils::IsPlugin(item.GetDynPath()))
{
bool resume = item.m_lStartOffset == STARTOFFSET_RESUME;
- CFileItem item_new(item);
- if (XFILE::CPluginDirectory::GetPluginResult(item.GetPath(), item_new, resume))
- return PlayMedia(item_new, player, iPlaylist);
- return false;
+
+ if (!XFILE::CPluginDirectory::GetPluginResult(item.GetDynPath(), item, resume))
+ return false;
}
+
if (item.IsSmartPlayList())
{
CFileItemList items;
@@ -3058,22 +3058,19 @@ bool CApplication::PlayFile(CFileItem item, const std::string& player, bool bRes
if (item.IsPlayList())
return false;
- if (item.IsPlugin())
+ if (URIUtils::IsPlugin(item.GetDynPath()))
{ // we modify the item so that it becomes a real URL
bool resume = item.m_lStartOffset == STARTOFFSET_RESUME;
- CFileItem item_new(item);
- if (XFILE::CPluginDirectory::GetPluginResult(item.GetPath(), item_new, resume))
- return PlayFile(std::move(item_new), player, false);
- return false;
+
+ if (!XFILE::CPluginDirectory::GetPluginResult(item.GetDynPath(), item, resume))
+ return false;
}
#ifdef HAS_UPNP
if (URIUtils::IsUPnP(item.GetPath()))
{
- CFileItem item_new(item);
- if (XFILE::CUPnPDirectory::GetResource(item.GetURL(), item_new))
- return PlayFile(std::move(item_new), player, false);
- return false;
+ if (!XFILE::CUPnPDirectory::GetResource(item.GetURL(), item))
+ return false;
}
#endif
@@ -4069,7 +4066,7 @@ bool CApplication::OnMessage(CGUIMessage& message)
// ok, grab the next song
CFileItem file(*playlist[iNext]);
// handle plugin://
- CURL url(file.GetPath());
+ CURL url(file.GetDynPath());
if (url.IsProtocol("plugin"))
XFILE::CPluginDirectory::GetPluginResult(url.Get(), file, false);
@@ -4088,9 +4085,9 @@ bool CApplication::OnMessage(CGUIMessage& message)
}
#ifdef HAS_UPNP
- if (URIUtils::IsUPnP(file.GetPath()))
+ if (URIUtils::IsUPnP(file.GetDynPath()))
{
- if (!XFILE::CUPnPDirectory::GetResource(file.GetURL(), file))
+ if (!XFILE::CUPnPDirectory::GetResource(file.GetDynURL(), file))
return true;
}
#endif
diff --git a/xbmc/Application.h b/xbmc/Application.h
index 488b113a34..90550d597e 100644
--- a/xbmc/Application.h
+++ b/xbmc/Application.h
@@ -191,7 +191,7 @@ public:
int GetMessageMask() override;
void OnApplicationMessage(KODI::MESSAGING::ThreadMessage* pMsg) override;
- bool PlayMedia(const CFileItem& item, const std::string &player, int iPlaylist);
+ bool PlayMedia(CFileItem& item, const std::string &player, int iPlaylist);
bool ProcessAndStartPlaylist(const std::string& strPlayList, PLAYLIST::CPlayList& playlist, int iPlaylist, int track=0);
bool PlayFile(CFileItem item, const std::string& player, bool bRestart = false);
void StopPlaying();
diff --git a/xbmc/addons/Scraper.cpp b/xbmc/addons/Scraper.cpp
index c1bf2b329d..8d8ccd7717 100644
--- a/xbmc/addons/Scraper.cpp
+++ b/xbmc/addons/Scraper.cpp
@@ -239,7 +239,7 @@ void CScraper::ClearCache()
{
// wipe cache
if (items[i]->m_dateTime + m_persistence <= CDateTime::GetCurrentDateTime())
- CFile::Delete(items[i]->GetPath());
+ CFile::Delete(items[i]->GetDynPath());
}
}
else
@@ -456,7 +456,7 @@ CScraperUrl CScraper::NfoUrl(const std::string &sNfoContent)
CScraperUrl::SUrlEntry surl;
surl.m_type = CScraperUrl::URL_TYPE_GENERAL;
- surl.m_url = items[0]->GetPath();
+ surl.m_url = items[0]->GetDynPath();
scurlRet.m_url.emplace_back(surl);
return scurlRet;
}
@@ -531,7 +531,7 @@ CScraperUrl CScraper::ResolveIDToUrl(const std::string &externalID)
CFileItem item("resolve me", false);
if (XFILE::CPluginDirectory::GetPluginResult(str.str(), item, false))
- scurlRet.ParseString(item.GetPath());
+ scurlRet.ParseString(item.GetDynPath());
return scurlRet;
}
@@ -612,7 +612,7 @@ CScraperUrl FromFileItem<CScraperUrl>(const CFileItem &item)
url.relevance = item.GetProperty("relevance").asDouble();
CScraperUrl::SUrlEntry surl;
surl.m_type = CScraperUrl::URL_TYPE_GENERAL;
- surl.m_url = item.GetPath();
+ surl.m_url = item.GetDynPath();
url.m_url.push_back(surl);
return url;
@@ -636,7 +636,7 @@ CMusicAlbumInfo FromFileItem<CMusicAlbumInfo>(const CFileItem &item)
CScraperUrl url;
url.m_url.resize(1);
- url.m_url[0].m_url = item.GetPath();
+ url.m_url[0].m_url = item.GetDynPath();
info = CMusicAlbumInfo(sTitle, sArtist, sAlbumName, url);
if (item.HasProperty("relevance"))
@@ -653,7 +653,7 @@ CMusicArtistInfo FromFileItem<CMusicArtistInfo>(const CFileItem &item)
CScraperUrl url;
url.m_url.resize(1);
- url.m_url[0].m_url = item.GetPath();
+ url.m_url[0].m_url = item.GetDynPath();
info = CMusicArtistInfo(sTitle, url);
if (item.HasProperty("artist.genre"))
diff --git a/xbmc/filesystem/PluginDirectory.cpp b/xbmc/filesystem/PluginDirectory.cpp
index d8aede2ade..24dbaf2af9 100644
--- a/xbmc/filesystem/PluginDirectory.cpp
+++ b/xbmc/filesystem/PluginDirectory.cpp
@@ -185,8 +185,7 @@ bool CPluginDirectory::GetPluginResult(const std::string& strPath, CFileItem &re
{ // update the play path and metadata, saving the old one as needed
if (!resultItem.HasProperty("original_listitem_url"))
resultItem.SetProperty("original_listitem_url", resultItem.GetPath());
- resultItem.SetPath(newDir.m_fileResult->GetPath());
- resultItem.SetDynPath(std::string());
+ resultItem.SetDynPath(newDir.m_fileResult->GetPath());
resultItem.SetMimeType(newDir.m_fileResult->GetMimeType());
resultItem.SetContentLookup(newDir.m_fileResult->ContentLookup());
resultItem.UpdateInfo(*newDir.m_fileResult);
diff --git a/xbmc/network/upnp/UPnPInternal.cpp b/xbmc/network/upnp/UPnPInternal.cpp
index 385a94bed6..d5024f2087 100644
--- a/xbmc/network/upnp/UPnPInternal.cpp
+++ b/xbmc/network/upnp/UPnPInternal.cpp
@@ -1064,7 +1064,7 @@ bool GetResource(const PLT_MediaObject* entry, CFileItem& item)
// if it's an item, path is the first url to the item
// we hope the server made the first one reachable for us
// (it could be a format we dont know how to play however)
- item.SetPath((const char*) resource.m_Uri);
+ item.SetDynPath((const char*) resource.m_Uri);
// look for content type in protocol info
if (resource.m_ProtocolInfo.IsValid()) {