Player.Property() support #1130

Merged
merged 2 commits into from Jul 7, 2012
View
14 xbmc/GUIInfoManager.cpp
@@ -189,6 +189,8 @@ const infomap player_labels[] = {{ "hasmedia", PLAYER_HAS_MEDIA },
{ "folderpath", PLAYER_PATH },
{ "filenameandpath", PLAYER_FILEPATH }};
+const infomap player_param[] = {{ "property", PLAYER_ITEM_PROPERTY }};
+
const infomap player_times[] = {{ "seektime", PLAYER_SEEKTIME },
{ "seekoffset", PLAYER_SEEKOFFSET },
{ "timeremaining", PLAYER_TIME_REMAINING },
@@ -683,6 +685,14 @@ int CGUIInfoManager::TranslateSingleString(const CStdString &strCondition)
if (prop.name == player_times[i].str)
return AddMultiInfo(GUIInfo(player_times[i].val, TranslateTimeFormat(prop.param())));
}
+ if (prop.num_params() == 1)
+ {
+ for (size_t i = 0; i < sizeof(player_param) / sizeof(infomap); i++)
+ {
+ if (prop.name == player_param[i].str)
+ return AddMultiInfo(GUIInfo(player_param[i].val, ConditionalStringParameter(prop.param())));
+ }
+ }
}
else if (cat.name == "weather")
{
@@ -2741,6 +2751,10 @@ CStdString CGUIInfoManager::GetMultiInfoLabel(const GUIInfo &info, int contextWi
if (m_seekOffset > 0)
return "+" + seekOffset;
}
+ else if (info.m_info == PLAYER_ITEM_PROPERTY)
+ {
+ return m_currentFile->GetProperty(m_stringParameters[info.GetData1()]).asString();
+ }
else if (info.m_info == SYSTEM_TIME)
{
return GetTime((TIME_FORMAT)info.GetData1());
View
1 xbmc/GUIInfoManager.h
@@ -103,6 +103,7 @@ namespace INFO
#define PLAYER_FILEPATH 46
#define PLAYER_SEEKOFFSET 47
#define PLAYER_PROGRESS_CACHE 48
+#define PLAYER_ITEM_PROPERTY 49
#define WEATHER_CONDITIONS 100
#define WEATHER_TEMPERATURE 101
View
12 xbmc/ThumbLoader.cpp
@@ -388,9 +388,15 @@ bool CVideoThumbLoader::FillLibraryArt(CFileItem *pItem)
// For episodes and seasons, we want to set fanart for that of the show
if (!pItem->HasProperty("fanart_image") && tag.m_iIdShow >= 0)
{
- string fanart = m_database->GetArtForItem(tag.m_iIdShow, "tvshow", "fanart");
- if (!fanart.empty())
- pItem->SetProperty("fanart_image", fanart);
+ map<string, string> showArt;
+ if (m_database->GetArtForItem(tag.m_iIdShow, "tvshow", showArt))
+ {
+ map<string, string>::iterator i = showArt.find("fanart");
+ if (i != showArt.end())
+ pItem->SetProperty("fanart_image", i->second);
+ if ((i = showArt.find("thumb")) != showArt.end())
+ pItem->SetProperty("tvshowthumb", i->second);
+ }
}
m_database->Close();
}
View
16 xbmc/utils/RecentlyAddedJob.cpp
@@ -101,7 +101,6 @@ bool CRecentlyAddedJob::UpdateVideo()
if (videodatabase.GetRecentlyAddedEpisodesNav("videodb://5/", TVShowItems, NUM_ITEMS))
{
- std::map<int, std::string> showThumbs;
for (; i < TVShowItems.Size(); ++i)
{
CFileItemPtr item = TVShowItems.Get(i);
@@ -128,25 +127,12 @@ bool CRecentlyAddedJob::UpdateVideo()
if (!item->HasThumbnail())
m_thumbLoader.LoadItem(item.get());
- std::string showThumb;
- if (item->GetVideoInfoTag()->m_iIdShow > 0)
- {
- std::map<int, std::string>::const_iterator thumbIter;
- if ((thumbIter = showThumbs.find(item->GetVideoInfoTag()->m_iIdShow)) != showThumbs.end())
- showThumb = thumbIter->second;
- else
- {
- showThumb = videodatabase.GetArtForItem(item->GetVideoInfoTag()->m_iIdShow, "tvshow", "thumb");
- showThumbs[item->GetVideoInfoTag()->m_iIdShow] = showThumb;
- }
- }
-
std::string seasonThumb;
if (item->GetVideoInfoTag()->m_iIdSeason > 0)
seasonThumb = videodatabase.GetArtForItem(item->GetVideoInfoTag()->m_iIdSeason, "season", "thumb");
home->SetProperty("LatestEpisode." + value + ".Thumb" , item->GetThumbnailImage());
- home->SetProperty("LatestEpisode." + value + ".ShowThumb" , showThumb);
+ home->SetProperty("LatestEpisode." + value + ".ShowThumb" , item->GetProperty("tvshowthumb"));
home->SetProperty("LatestEpisode." + value + ".SeasonThumb" , seasonThumb);
home->SetProperty("LatestEpisode." + value + ".Fanart" , item->GetProperty("fanart_image"));
}
View
6 xbmc/video/dialogs/GUIDialogVideoInfo.cpp
@@ -309,12 +309,6 @@ void CGUIDialogVideoInfo::SetMovie(const CFileItem *item)
if (!thumb.empty())
m_movieItem->SetProperty("seasonthumb", thumb);
}
- if (m_movieItem->GetVideoInfoTag()->m_iIdShow > -1)
- {
- string thumb = db.GetArtForItem(m_movieItem->GetVideoInfoTag()->m_iIdShow, "tvshow", "thumb");
- if (!thumb.empty())
- m_movieItem->SetProperty("tvshowthumb", thumb);
- }
db.Close();
}
}