aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKai Sommerfeld <kai.sommerfeld@gmx.com>2018-07-29 11:12:39 +0200
committerKai Sommerfeld <kai.sommerfeld@gmx.com>2018-07-30 10:28:05 +0200
commit556a07b86c75657bdb922df54d29d65d48319cfb (patch)
treef6d9a549a4916c754554de9a442325e40f055bee
parent743da9ed97c92508a2116678b70a5591f4e8d04f (diff)
[guiinfo] Fix PLAYER_(PATH|FILENAME|FILEPATH).
-rw-r--r--xbmc/guilib/guiinfo/GUIInfoHelper.cpp21
-rw-r--r--xbmc/guilib/guiinfo/GUIInfoHelper.h3
-rw-r--r--xbmc/guilib/guiinfo/MusicGUIInfo.cpp31
-rw-r--r--xbmc/guilib/guiinfo/PlayerGUIInfo.cpp13
-rw-r--r--xbmc/guilib/guiinfo/VideoGUIInfo.cpp31
5 files changed, 40 insertions, 59 deletions
diff --git a/xbmc/guilib/guiinfo/GUIInfoHelper.cpp b/xbmc/guilib/guiinfo/GUIInfoHelper.cpp
index 629ced6e07..afd07a094f 100644
--- a/xbmc/guilib/guiinfo/GUIInfoHelper.cpp
+++ b/xbmc/guilib/guiinfo/GUIInfoHelper.cpp
@@ -16,6 +16,7 @@
#include "guilib/LocalizeStrings.h"
#include "playlists/PlayList.h"
#include "utils/StringUtils.h"
+#include "utils/URIUtils.h"
#include "windows/GUIMediaWindow.h"
#include "guilib/guiinfo/GUIInfoLabels.h"
@@ -175,6 +176,26 @@ CGUIListItemPtr GetCurrentListItem(int contextWindow, int containerId /* = 0 */,
return item;
}
+std::string GetFileInfoLabelValueFromPath(int info, const std::string& filenameAndPath)
+{
+ std::string value = filenameAndPath;
+
+ if (info == PLAYER_PATH)
+ {
+ // do this twice since we want the path outside the archive if this is to be of use.
+ if (URIUtils::IsInArchive(value))
+ value = URIUtils::GetParentPath(value);
+
+ value = URIUtils::GetParentPath(value);
+ }
+ else if (info == PLAYER_FILENAME)
+ {
+ value = URIUtils::GetFileName(value);
+ }
+
+ return value;
+}
+
} // namespace GUIINFO
} // namespace GUILIB
} // namespace KODI
diff --git a/xbmc/guilib/guiinfo/GUIInfoHelper.h b/xbmc/guilib/guiinfo/GUIInfoHelper.h
index 3f3860d9e3..433d6c646d 100644
--- a/xbmc/guilib/guiinfo/GUIInfoHelper.h
+++ b/xbmc/guilib/guiinfo/GUIInfoHelper.h
@@ -14,7 +14,6 @@
#include "PlayListPlayer.h"
class CFileItem;
-typedef std::shared_ptr<CFileItem> CFileItemPtr;
class CGUIListItem;
typedef std::shared_ptr<CGUIListItem> CGUIListItemPtr;
@@ -37,6 +36,8 @@ CGUIControl* GetActiveContainer(int containerId, int contextWindow);
CGUIMediaWindow* GetMediaWindow(int contextWindow);
CGUIListItemPtr GetCurrentListItem(int contextWindow, int containerId = 0, int itemOffset = 0, unsigned int itemFlags = 0);
+std::string GetFileInfoLabelValueFromPath(int info, const std::string& filenameAndPath);
+
} // namespace GUIINFO
} // namespace GUILIB
} // namespace KODI
diff --git a/xbmc/guilib/guiinfo/MusicGUIInfo.cpp b/xbmc/guilib/guiinfo/MusicGUIInfo.cpp
index 872c57aea5..1203a7ae91 100644
--- a/xbmc/guilib/guiinfo/MusicGUIInfo.cpp
+++ b/xbmc/guilib/guiinfo/MusicGUIInfo.cpp
@@ -86,6 +86,14 @@ bool CMusicGUIInfo::GetLabel(std::string& value, const CFileItem *item, int cont
/////////////////////////////////////////////////////////////////////////////////////////////
// PLAYER_* / MUSICPLAYER_* / LISTITEM_*
/////////////////////////////////////////////////////////////////////////////////////////////
+ case PLAYER_PATH:
+ case PLAYER_FILENAME:
+ case PLAYER_FILEPATH:
+ value = tag->GetURL();
+ if (value.empty())
+ value = item->GetPath();
+ value = GUIINFO::GetFileInfoLabelValueFromPath(info.m_info, value);
+ return true;
case PLAYER_TITLE:
case MUSICPLAYER_TITLE:
value = tag->GetTitle();
@@ -303,29 +311,6 @@ bool CMusicGUIInfo::GetLabel(std::string& value, const CFileItem *item, int cont
switch (info.m_info)
{
///////////////////////////////////////////////////////////////////////////////////////////////
- // PLAYER_*
- ///////////////////////////////////////////////////////////////////////////////////////////////
- case PLAYER_PATH:
- case PLAYER_FILENAME:
- case PLAYER_FILEPATH:
- if (tag)
- value = tag->GetURL();
- if (value.empty())
- value = item->GetPath();
-
- if (info.m_info == PLAYER_PATH)
- {
- // do this twice since we want the path outside the archive if this
- // is to be of use.
- if (URIUtils::IsInArchive(value))
- value = URIUtils::GetParentPath(value);
- value = URIUtils::GetParentPath(value);
- }
- else if (info.m_info == PLAYER_FILENAME)
- value = URIUtils::GetFileName(value);
- return true;
-
- ///////////////////////////////////////////////////////////////////////////////////////////////
// MUSICPLAYER_*
///////////////////////////////////////////////////////////////////////////////////////////////
case MUSICPLAYER_PROPERTY:
diff --git a/xbmc/guilib/guiinfo/PlayerGUIInfo.cpp b/xbmc/guilib/guiinfo/PlayerGUIInfo.cpp
index d1914a1ded..c721ad60d1 100644
--- a/xbmc/guilib/guiinfo/PlayerGUIInfo.cpp
+++ b/xbmc/guilib/guiinfo/PlayerGUIInfo.cpp
@@ -209,18 +209,7 @@ bool CPlayerGUIInfo::GetLabel(std::string& value, const CFileItem *item, int con
case PLAYER_PATH:
case PLAYER_FILENAME:
case PLAYER_FILEPATH:
- value = item->GetPath();
-
- if (info.m_info == PLAYER_PATH)
- {
- // do this twice since we want the path outside the archive if this
- // is to be of use.
- if (URIUtils::IsInArchive(value))
- value = URIUtils::GetParentPath(value);
- value = URIUtils::GetParentPath(value);
- }
- else if (info.m_info == PLAYER_FILENAME)
- value = URIUtils::GetFileName(value);
+ value = GUIINFO::GetFileInfoLabelValueFromPath(info.m_info, item->GetPath());
return true;
case PLAYER_TITLE:
// use label or drop down to title from path
diff --git a/xbmc/guilib/guiinfo/VideoGUIInfo.cpp b/xbmc/guilib/guiinfo/VideoGUIInfo.cpp
index d6e1687999..590ebf70f3 100644
--- a/xbmc/guilib/guiinfo/VideoGUIInfo.cpp
+++ b/xbmc/guilib/guiinfo/VideoGUIInfo.cpp
@@ -91,6 +91,14 @@ bool CVideoGUIInfo::GetLabel(std::string& value, const CFileItem *item, int cont
/////////////////////////////////////////////////////////////////////////////////////////////
// PLAYER_* / VIDEOPLAYER_* / LISTITEM_*
/////////////////////////////////////////////////////////////////////////////////////////////
+ case PLAYER_PATH:
+ case PLAYER_FILENAME:
+ case PLAYER_FILEPATH:
+ value = tag->m_strFileNameAndPath;
+ if (value.empty())
+ value = item->GetPath();
+ value = GUIINFO::GetFileInfoLabelValueFromPath(info.m_info, value);
+ return true;
case PLAYER_TITLE:
case VIDEOPLAYER_TITLE:
value = tag->m_strTitle;
@@ -452,29 +460,6 @@ bool CVideoGUIInfo::GetLabel(std::string& value, const CFileItem *item, int cont
switch (info.m_info)
{
///////////////////////////////////////////////////////////////////////////////////////////////
- // PLAYER_*
- ///////////////////////////////////////////////////////////////////////////////////////////////
- case PLAYER_PATH:
- case PLAYER_FILENAME:
- case PLAYER_FILEPATH:
- if (tag)
- value = tag->m_strFileNameAndPath;
- if (value.empty())
- value = item->GetPath();
-
- if (info.m_info == PLAYER_PATH)
- {
- // do this twice since we want the path outside the archive if this
- // is to be of use.
- if (URIUtils::IsInArchive(value))
- value = URIUtils::GetParentPath(value);
- value = URIUtils::GetParentPath(value);
- }
- else if (info.m_info == PLAYER_FILENAME)
- value = URIUtils::GetFileName(value);
- return true;
-
- ///////////////////////////////////////////////////////////////////////////////////////////////
// VIDEOPLAYER_*
///////////////////////////////////////////////////////////////////////////////////////////////
case VIDEOPLAYER_PLAYLISTLEN: