diff --git a/xbmc/GUIInfoManager.cpp b/xbmc/GUIInfoManager.cpp index 33919f38e2ca2..05198d09ee47f 100644 --- a/xbmc/GUIInfoManager.cpp +++ b/xbmc/GUIInfoManager.cpp @@ -2718,18 +2718,68 @@ const infomap musicplayer[] = {{ "title", MUSICPLAYER_TITLE }, /// @note If it's in the database it will return the database title\, else the filename. ///
/// } +/// \table_row3{ `VideoPlayer.offset(number).Title`, +/// \anchor VideoPlayer_Offset_Title +/// _string_, +/// @return The title of video which has an offset `number` with respect to the currently playing video. +/// @note If it's in the database it will return the database title\, else the filename. +///
+/// } +/// \table_row3{ `VideoPlayer.position(number).Title`, +/// \anchor VideoPlayer_Position_Title +/// _string_, +/// @return The title of the video which has an offset `number` with respect to the start of the playlist. +/// @note If it's in the database it will return the database title\, else the filename. +///
>
+/// } /// \table_row3{ `VideoPlayer.OriginalTitle`, /// \anchor VideoPlayer_OriginalTitle /// _string_, /// @return The original title of currently playing video. If it's in the database. ///
/// } +/// \table_row3{ `VideoPlayer.offset(number).OriginalTitle`, +/// \anchor VideoPlayer_Offset_OriginalTitle +/// _string_, +/// @return The original title of the video which has an offset `number` with respect to the currently playing video. +///
+/// } +/// \table_row3{ `VideoPlayer.position(number).OriginalTitle`, +/// \anchor VideoPlayer_Position_OriginalTitle +/// _string_, +/// @return The original title of the video which has an offset `number` with respect to the start of the playlist. +///
+/// } /// \table_row3{ `VideoPlayer.TVShowTitle`, /// \anchor VideoPlayer_TVShowTitle /// _string_, /// @return The title of currently playing episode's tvshow name. ///
/// } +/// \table_row3{ `VideoPlayer.offset(number).TVShowTitle`, +/// \anchor VideoPlayer_Offset_TVShowTitle +/// _string_, +/// @return The title of the episode's tvshow name which has an offset `number` with respect to the currently playing video. +///
+/// } +/// \table_row3{ `VideoPlayer.position(number).TVShowTitle`, +/// \anchor VideoPlayer_Position_TVShowTitle +/// _string_, +/// @return The title of the episode's tvshow name which has an offset `number` with respect to the start of the playlist. +///
+/// } /// \table_row3{ `VideoPlayer.Season`, /// \anchor VideoPlayer_Season /// _string_, @@ -2739,6 +2789,22 @@ const infomap musicplayer[] = {{ "title", MUSICPLAYER_TITLE }, /// also supports EPG. ///
/// } +/// \table_row3{ `VideoPlayer.offset(number).Season`, +/// \anchor VideoPlayer_Offset_Season +/// _string_, +/// @return The season number of the episode which has an offset `number` with respect to the currently playing video. +///
+/// } +/// \table_row3{ `VideoPlayer.position(number).Season`, +/// \anchor VideoPlayer_Position_Season +/// _string_, +/// @return The season number of the episode which has an offset `number` with respect to the start of the playlist. +///
+/// } /// \table_row3{ `VideoPlayer.Episode`, /// \anchor VideoPlayer_Episode /// _string_, @@ -2748,12 +2814,44 @@ const infomap musicplayer[] = {{ "title", MUSICPLAYER_TITLE }, /// also supports EPG. ///
/// } +/// \table_row3{ `VideoPlayer.offset(number).Episode`, +/// \anchor VideoPlayer_Offset_Episode +/// _string_, +/// @return The episode number of the episode which has an offset `number` with respect to the currently playing video. +///
+/// } +/// \table_row3{ `VideoPlayer.position(number).Episode`, +/// \anchor VideoPlayer_Position_Episode +/// _string_, +/// @return The episode number of the episode which has an offset `number` with respect to the start of the playlist. +///
+/// } /// \table_row3{ `VideoPlayer.Genre`, /// \anchor VideoPlayer_Genre /// _string_, /// @return The genre(s) of current movie\, if it's in the database. ///
/// } +/// \table_row3{ `VideoPlayer.offset(number).Genre`, +/// \anchor VideoPlayer_Offset_Genre +/// _string_, +/// @return The genre(s) of the video which has an offset `number` with respect to the currently playing video. +///
+/// } +/// \table_row3{ `VideoPlayer.position(number).Genre`, +/// \anchor VideoPlayer_Position_Genre +/// _string_, +/// @return The genre(s) of the video which has an offset `number` with respect to the start of the playlist. +///
+/// } /// \table_row3{ `VideoPlayer.Director`, /// \anchor VideoPlayer_Director /// _string_, @@ -2763,30 +2861,110 @@ const infomap musicplayer[] = {{ "title", MUSICPLAYER_TITLE }, /// also supports EPG. ///
/// } +/// \table_row3{ `VideoPlayer.offset(number).Director`, +/// \anchor VideoPlayer_Offset_Director +/// _string_, +/// @return The director of the video which has an offset `number` with respect to the currently playing video. +///
+/// } +/// \table_row3{ `VideoPlayer.position(number).Director`, +/// \anchor VideoPlayer_Position_Director +/// _string_, +/// @return The director of the video which has an offset `number` with respect to the start of the playlist. +///
+/// } /// \table_row3{ `VideoPlayer.Country`, /// \anchor VideoPlayer_Country /// _string_, /// @return The production country of current movie\, if it's in the database. ///
/// } +/// \table_row3{ `VideoPlayer.offset(number).Country`, +/// \anchor VideoPlayer_Offset_Country +/// _string_, +/// @return The production country of the video which has an offset `number` with respect to the currently playing video. +///
+/// } +/// \table_row3{ `VideoPlayer.position(number).Country`, +/// \anchor VideoPlayer_Position_Country +/// _string_, +/// @return The production country of the video which has an offset `number` with respect to the start of the playlist. +///
+/// } /// \table_row3{ `VideoPlayer.Year`, /// \anchor VideoPlayer_Year /// _string_, /// @return The year of release of current movie\, if it's in the database. ///
/// } +/// \table_row3{ `VideoPlayer.offset(number).Year`, +/// \anchor VideoPlayer_Offset_Year +/// _string_, +/// @return The year of release of the video which has an offset `number` with respect to the currently playing video. +///
+/// } +/// \table_row3{ `VideoPlayer.position(number).Year`, +/// \anchor VideoPlayer_Position_Year +/// _string_, +/// @return The year of release of the video which has an offset `number` with respect to the start of the playlist. +///
+/// } /// \table_row3{ `VideoPlayer.Cover`, /// \anchor VideoPlayer_Cover /// _string_, /// @return The cover of currently playing movie. ///
/// } +/// \table_row3{ `VideoPlayer.offset(number).Cover`, +/// \anchor VideoPlayer_Offset_Cover +/// _string_, +/// @return The cover of the video which has an offset `number` with respect to the currently playing video. +///
+/// } +/// \table_row3{ `VideoPlayer.position(number).Cover`, +/// \anchor VideoPlayer_Position_Cover +/// _string_, +/// @return The cover of the video which has an offset `number` with respect to the start of the playlist. +///
+/// } /// \table_row3{ `VideoPlayer.Rating`, /// \anchor VideoPlayer_Rating /// _string_, /// @return The scraped rating of current movie\, if it's in the database. ///
/// } +/// \table_row3{ `VideoPlayer.offset(number).Rating`, +/// \anchor VideoPlayer_Offset_Rating +/// _string_, +/// @return The scraped rating of the video which has an offset `number` with respect to the currently playing video. +///
+/// } +/// \table_row3{ `VideoPlayer.position(number).Rating`, +/// \anchor VideoPlayer_Position_Rating +/// _string_, +/// @return The scraped rating of the video which has an offset `number` with respect to the start of the playlist. +///
+/// } /// \table_row3{ `VideoPlayer.UserRating`, /// \anchor VideoPlayer_UserRating /// _string_, @@ -2795,6 +2973,22 @@ const infomap musicplayer[] = {{ "title", MUSICPLAYER_TITLE }, /// @skinning_v16 **[New Infolabel]** \link VideoPlayer_UserRating `VideoPlayer.UserRating`\endlink ///
/// } +/// \table_row3{ `VideoPlayer.offset(number).UserRating`, +/// \anchor VideoPlayer_Offset_UserRating +/// _string_, +/// @return The user rating of the video which has an offset `number` with respect to the currently playing video. +///
+/// } +/// \table_row3{ `VideoPlayer.position(number).UserRating`, +/// \anchor VideoPlayer_Position_UserRating +/// _string_, +/// @return The user rating of the video which has an offset `number` with respect to the start of the playlist. +///
+/// } /// \table_row3{ `VideoPlayer.Votes`, /// \anchor VideoPlayer_Votes /// _string_, @@ -2803,18 +2997,66 @@ const infomap musicplayer[] = {{ "title", MUSICPLAYER_TITLE }, /// @skinning_v13 **[New Infolabel]** \link VideoPlayer_Votes `VideoPlayer.Votes`\endlink ///
/// } +/// \table_row3{ `VideoPlayer.offset(number).Votes`, +/// \anchor VideoPlayer_Offset_Votes +/// _string_, +/// @return The scraped votes of the video which has an offset `number` with respect to the currently playing video. +///
+/// } +/// \table_row3{ `VideoPlayer.position(number).Votes`, +/// \anchor VideoPlayer_Position_Votes +/// _string_, +/// @return The scraped votes of the video which has an offset `number` with respect to the start of the playlist. +///
+/// } /// \table_row3{ `VideoPlayer.RatingAndVotes`, /// \anchor VideoPlayer_RatingAndVotes /// _string_, /// @return The scraped rating and votes of current movie\, if it's in the database ///
/// } +/// \table_row3{ `VideoPlayer.offset(number).RatingAndVotes`, +/// \anchor VideoPlayer_Offset_RatingAndVotes +/// _string_, +/// @return The scraped rating and votes of the video which has an offset `number` with respect to the currently playing video. +///
+/// } +/// \table_row3{ `VideoPlayer.position(number).RatingAndVotes`, +/// \anchor VideoPlayer_Position_RatingAndVotes +/// _string_, +/// @return The scraped rating and votes of the video which has an offset `number` with respect to the start of the playlist. +///
+/// } /// \table_row3{ `VideoPlayer.mpaa`, /// \anchor VideoPlayer_mpaa /// _string_, /// @return The MPAA rating of current movie\, if it's in the database. ///
/// } +/// \table_row3{ `VideoPlayer.offset(number).mpaa`, +/// \anchor VideoPlayer_Offset_mpaa +/// _string_, +/// @return The MPAA rating of the video which has an offset `number` with respect to the currently playing video. +///
+/// } +/// \table_row3{ `VideoPlayer.position(number).mpaa`, +/// \anchor VideoPlayer_Position_mpaa +/// _string_, +/// @return The MPAA rating of the video which has an offset `number` with respect to the start of the playlist. +///
+/// } /// \table_row3{ `VideoPlayer.IMDBNumber`, /// \anchor VideoPlayer_IMDBNumber /// _string_, @@ -2823,12 +3065,44 @@ const infomap musicplayer[] = {{ "title", MUSICPLAYER_TITLE }, /// @skinning_v15 **[New Infolabel]** \link VideoPlayer_IMDBNumber `VideoPlayer.IMDBNumber`\endlink ///
/// } +/// \table_row3{ `VideoPlayer.offset(number).IMDBNumber`, +/// \anchor VideoPlayer_Offset_IMDBNumber +/// _string_, +/// @return The IMDb ID of the the video which has an offset `number` with respect to the currently playing video. +///
+/// } +/// \table_row3{ `VideoPlayer.position(number).IMDBNumber`, +/// \anchor VideoPlayer_Position_IMDBNumber +/// _string_, +/// @return The IMDb ID of the video which has an offset `number` with respect to the start of the playlist. +///
+/// } /// \table_row3{ `VideoPlayer.Top250`, /// \anchor VideoPlayer_Top250 /// _string_, /// @return The IMDb Top250 position of the currently playing movie\, if it's in the database. ///
/// } +/// \table_row3{ `VideoPlayer.offset(number).Top250`, +/// \anchor VideoPlayer_Offset_Top250 +/// _string_, +/// @return The IMDb Top250 position of the video which has an offset `number` with respect to the currently playing video. +///
+/// } +/// \table_row3{ `VideoPlayer.position(number).Top250`, +/// \anchor VideoPlayer_Position_Top250 +/// _string_, +/// @return The IMDb Top250 position of the video which has an offset `number` with respect to the start of the playlist. +///
+/// } /// \table_row3{ `VideoPlayer.EpisodeName`, /// \anchor VideoPlayer_EpisodeName /// _string_, @@ -2873,18 +3147,66 @@ const infomap musicplayer[] = {{ "title", MUSICPLAYER_TITLE }, /// @return The album from which the current Music Video is from\, if it's in the database. ///
/// } +/// \table_row3{ `VideoPlayer.offset(number).Album`, +/// \anchor VideoPlayer_Offset_Album +/// _string_, +/// @return The album from which the video which has an offset `number` with respect to the currently playing video. +///
+/// } +/// \table_row3{ `VideoPlayer.position(number).Album`, +/// \anchor VideoPlayer_Position_Album +/// _string_, +/// @return The album from which the music video which has an offset `number` with respect to the start of the playlist. +///
+/// } /// \table_row3{ `VideoPlayer.Artist`, /// \anchor VideoPlayer_Artist /// _string_, /// @return The artist(s) of current Music Video\, if it's in the database. ///
/// } +/// \table_row3{ `VideoPlayer.offset(number).Artist`, +/// \anchor VideoPlayer_Offset_Artist +/// _string_, +/// @return The artist(s) of the video which has an offset `number` with respect to the currently playing video. +///
+/// } +/// \table_row3{ `VideoPlayer.position(number).Artist`, +/// \anchor VideoPlayer_Position_Artist +/// _string_, +/// @return The artist(s) of the music video which has an offset `number` with respect to the start of the playlist. +///
+/// } /// \table_row3{ `VideoPlayer.Studio`, /// \anchor VideoPlayer_Studio /// _string_, /// @return The studio of current Music Video\, if it's in the database. ///
/// } +/// \table_row3{ `VideoPlayer.offset(number).Studio`, +/// \anchor VideoPlayer_Offset_Studio +/// _string_, +/// @return The studio of the video which has an offset `number` with respect to the currently playing video. +///
+/// } +/// \table_row3{ `VideoPlayer.position(number).Studio`, +/// \anchor VideoPlayer_Position_Studio +/// _string_, +/// @return The studio of the video which has an offset `number` with respect to the start of the playlist. +///
+/// } /// \table_row3{ `VideoPlayer.Writer`, /// \anchor VideoPlayer_Writer /// _string_, @@ -2894,24 +3216,88 @@ const infomap musicplayer[] = {{ "title", MUSICPLAYER_TITLE }, /// also supports EPG. ///
/// } +/// \table_row3{ `VideoPlayer.offset(number).Writer`, +/// \anchor VideoPlayer_Offset_Writer +/// _string_, +/// @return The name of Writer of the video which has an offset `number` with respect to the currently playing video. +///
+/// } +/// \table_row3{ `VideoPlayer.position(number).Writer`, +/// \anchor VideoPlayer_Position_Writer +/// _string_, +/// @return The name of Writer of the video which has an offset `number` with respect to the start of the playlist. +///
+/// } /// \table_row3{ `VideoPlayer.Tagline`, /// \anchor VideoPlayer_Tagline /// _string_, /// @return The small Summary of current playing Video\, if it's in the database. ///
/// } +/// \table_row3{ `VideoPlayer.offset(number).Tagline`, +/// \anchor VideoPlayer_Offset_Tagline +/// _string_, +/// @return The small Summary of the video which has an offset `number` with respect to the currently playing video. +///
+/// } +/// \table_row3{ `VideoPlayer.position(number).Tagline`, +/// \anchor VideoPlayer_Position_Tagline +/// _string_, +/// @return The small Summary of the video which has an offset `number` with respect to the start of the playlist. +///
+/// } /// \table_row3{ `VideoPlayer.PlotOutline`, /// \anchor VideoPlayer_PlotOutline /// _string_, /// @return The small Summary of current playing Video\, if it's in the database. ///
/// } +/// \table_row3{ `VideoPlayer.offset(number).PlotOutline`, +/// \anchor VideoPlayer_Offset_PlotOutline +/// _string_, +/// @return The small Summary of the video which has an offset `number` with respect to the currently playing video. +///
+/// } +/// \table_row3{ `VideoPlayer.position(number).PlotOutline`, +/// \anchor VideoPlayer_Position_PlotOutline +/// _string_, +/// @return The small Summary of the video which has an offset `number` with respect to the start of the playlist. +///
+/// } /// \table_row3{ `VideoPlayer.Plot`, /// \anchor VideoPlayer_Plot /// _string_, /// @return The complete Text Summary of current playing Video\, if it's in the database. ///
/// } +/// \table_row3{ `VideoPlayer.offset(number).Plot`, +/// \anchor VideoPlayer_Offset_Plot +/// _string_, +/// @return The complete Text Summary of the video which has an offset `number` with respect to the currently playing video. +///
+/// } +/// \table_row3{ `VideoPlayer.position(number).Plot`, +/// \anchor VideoPlayer_Position_Plot +/// _string_, +/// @return The complete Text Summary of the video which has an offset `number` with respect to the start of the playlist. +///
+/// } /// \table_row3{ `VideoPlayer.Premiered`, /// \anchor VideoPlayer_Premiered /// _string_, @@ -2919,24 +3305,89 @@ const infomap musicplayer[] = {{ "title", MUSICPLAYER_TITLE }, /// if it's in the database. ///
/// } +/// \table_row3{ `VideoPlayer.offset(number).Premiered`, +/// \anchor VideoPlayer_Offset_Premiered +/// _string_, +/// @return The release or aired date of the video which has an offset `number` with respect to the currently playing video. +///
+/// } +/// \table_row3{ `VideoPlayer.position(number).Premiered`, +/// \anchor VideoPlayer_Position_Premiered +/// _string_, +/// @return The release or aired date of the video which has an offset `number` with respect to the start of the playlist. +/// if it's in the database. +///
+/// } /// \table_row3{ `VideoPlayer.Trailer`, /// \anchor VideoPlayer_Trailer /// _string_, /// @return The path to the trailer of the currently playing movie\, if it's in the database. ///
/// } +/// \table_row3{ `VideoPlayer.offset(number).Trailer`, +/// \anchor VideoPlayer_Offset_Trailer +/// _string_, +/// @return The path to the trailer of the video which has an offset `number` with respect to the currently playing video. +///
+/// } +/// \table_row3{ `VideoPlayer.position(number).Trailer`, +/// \anchor VideoPlayer_Position_Trailer +/// _string_, +/// @return The path to the trailer of the video which has an offset `number` with respect to the start of the playlist. +///
+/// } /// \table_row3{ `VideoPlayer.LastPlayed`, /// \anchor VideoPlayer_LastPlayed /// _string_, /// @return The last play date of current playing Video\, if it's in the database. ///
/// } +/// \table_row3{ `VideoPlayer.offset(number).LastPlayed`, +/// \anchor VideoPlayer_Offset_LastPlayed +/// _string_, +/// @return The last play date of the video which has an offset `number` with respect to the currently playing video. +///
+/// } +/// \table_row3{ `VideoPlayer.position(number).LastPlayed`, +/// \anchor VideoPlayer_Position_LastPlayed +/// _string_, +/// @return The last play date of the video which has an offset `number` with respect to the start of the playlist. +///
+/// } /// \table_row3{ `VideoPlayer.PlayCount`, /// \anchor VideoPlayer_PlayCount /// _string_, /// @return The playcount of current playing Video\, if it's in the database. ///
/// } +/// \table_row3{ `VideoPlayer.offset(number).PlayCount`, +/// \anchor VideoPlayer_Offset_PlayCount +/// _string_, +/// @return The playcount of the video which has an offset `number` with respect to the currently playing video. +///
+/// } +/// \table_row3{ `VideoPlayer.position(number).PlayCount`, +/// \anchor VideoPlayer_Position_PlayCount +/// _string_, +/// @return The playcount of the video which has an offset `number` with respect to the start of the playlist. +///
+/// } /// \table_row3{ `VideoPlayer.VideoCodec`, /// \anchor VideoPlayer_VideoCodec /// _string_, @@ -3092,6 +3543,22 @@ const infomap musicplayer[] = {{ "title", MUSICPLAYER_TITLE }, /// @skinning_v17 **[New Infolabel]** \link VideoPlayer_DBID `VideoPlayer.DBID`\endlink ///
/// } +/// \table_row3{ `VideoPlayer.offset(number).DBID`, +/// \anchor VideoPlayer_Offset_DBID +/// _string_, +/// @return The database id of the video which has an offset `number` with respect to the currently playing video. +///
+/// } +/// \table_row3{ `VideoPlayer.position(number).DBID`, +/// \anchor VideoPlayer_Position_DBID +/// _string_, +/// @return The database id of the video which has an offset `number` with respect to the start of the playlist. +///
+/// } /// \table_row3{ `VideoPlayer.UniqueID(name)`, /// \anchor VideoPlayer_UniqueID /// _string_, @@ -9143,11 +9610,7 @@ int CGUIInfoManager::TranslateSingleString(const std::string &strCondition, bool { return AddMultiInfo(CGUIInfo(VIDEOPLAYER_CONTENT, prop.param(), 0)); } - for (const infomap& i : videoplayer) - { - if (prop.name == i.str) - return i.val; - } + return TranslateVideoPlayerString(prop.name); } else if (cat.name == "retroplayer") { @@ -9382,6 +9845,21 @@ int CGUIInfoManager::TranslateSingleString(const std::string &strCondition, bool return AddMultiInfo(CGUIInfo(value, 1, position)); // 1 => relative } } + else if (info[0].name == "videoplayer") + { //! @todo these two don't allow duration(foo) and also don't allow more than this number of levels... + if (info[1].name == "position") + { + int position = atoi(info[1].param().c_str()); + int value = TranslateVideoPlayerString(info[2].name); // videoplayer.position(foo).bar + return AddMultiInfo(CGUIInfo(value, 2, position)); // 2 => absolute (0 used for not set) + } + else if (info[1].name == "offset") + { + int position = atoi(info[1].param().c_str()); + int value = TranslateVideoPlayerString(info[2].name); // videoplayer.offset(foo).bar + return AddMultiInfo(CGUIInfo(value, 1, position)); // 1 => relative + } + } else if (info[0].name == "container") { if (info[1].name == "listitem" || @@ -9488,6 +9966,16 @@ int CGUIInfoManager::TranslateMusicPlayerString(const std::string &info) const return 0; } +int CGUIInfoManager::TranslateVideoPlayerString(const std::string& info) const +{ + for (const infomap& i : videoplayer) + { + if (info == i.str) + return i.val; + } + return 0; +} + TIME_FORMAT CGUIInfoManager::TranslateTimeFormat(const std::string &format) { if (format.empty()) diff --git a/xbmc/GUIInfoManager.h b/xbmc/GUIInfoManager.h index 7e73e07aea999..8f9403f7c4f43 100644 --- a/xbmc/GUIInfoManager.h +++ b/xbmc/GUIInfoManager.h @@ -173,6 +173,7 @@ class CGUIInfoManager : public KODI::MESSAGING::IMessageTarget int TranslateSingleString(const std::string &strCondition); int TranslateListItem(const Property& cat, const Property& prop, int id, bool container); int TranslateMusicPlayerString(const std::string &info) const; + int TranslateVideoPlayerString(const std::string& info) const; static TIME_FORMAT TranslateTimeFormat(const std::string &format); std::string GetMultiInfoLabel(const KODI::GUILIB::GUIINFO::CGUIInfo &info, int contextWindow, std::string *fallback = nullptr) const; diff --git a/xbmc/guilib/guiinfo/GUIInfoLabels.h b/xbmc/guilib/guiinfo/GUIInfoLabels.h index 9df42523d770a..e037f1904d991 100644 --- a/xbmc/guilib/guiinfo/GUIInfoLabels.h +++ b/xbmc/guilib/guiinfo/GUIInfoLabels.h @@ -205,79 +205,88 @@ #define MUSICPLAYER_PLAYLISTPLAYING 243 #define MUSICPLAYER_CONTENT 244 -#define VIDEOPLAYER_AUDIO_BITRATE 248 -#define VIDEOPLAYER_VIDEO_BITRATE 249 +// Keep videoplayer infolabels that work with offset and position together #define VIDEOPLAYER_TITLE 250 #define VIDEOPLAYER_GENRE 251 #define VIDEOPLAYER_DIRECTOR 252 #define VIDEOPLAYER_YEAR 253 -#define VIDEOPLAYER_HASSUBTITLES 254 -#define VIDEOPLAYER_SUBTITLESENABLED 255 -#define VIDEOPLAYER_COVER 258 -#define VIDEOPLAYER_USING_OVERLAYS 259 -#define VIDEOPLAYER_ISFULLSCREEN 260 -#define VIDEOPLAYER_HASMENU 261 -#define VIDEOPLAYER_PLAYLISTLEN 262 -#define VIDEOPLAYER_PLAYLISTPOS 263 -#define VIDEOPLAYER_EVENT 264 -#define VIDEOPLAYER_ORIGINALTITLE 265 -#define VIDEOPLAYER_PLOT 266 -#define VIDEOPLAYER_PLOT_OUTLINE 267 -#define VIDEOPLAYER_EPISODE 268 -#define VIDEOPLAYER_SEASON 269 -#define VIDEOPLAYER_RATING 270 -#define VIDEOPLAYER_TVSHOW 271 -#define VIDEOPLAYER_PREMIERED 272 -#define VIDEOPLAYER_CONTENT 273 -#define VIDEOPLAYER_STUDIO 274 -#define VIDEOPLAYER_MPAA 275 -#define VIDEOPLAYER_CAST 276 -#define VIDEOPLAYER_CAST_AND_ROLE 277 -#define VIDEOPLAYER_ARTIST 278 -#define VIDEOPLAYER_ALBUM 279 -#define VIDEOPLAYER_WRITER 280 -#define VIDEOPLAYER_TAGLINE 281 -#define VIDEOPLAYER_HAS_INFO 282 -#define VIDEOPLAYER_TOP250 283 -#define VIDEOPLAYER_RATING_AND_VOTES 284 -#define VIDEOPLAYER_TRAILER 285 -#define VIDEOPLAYER_VIDEO_CODEC 286 -#define VIDEOPLAYER_VIDEO_RESOLUTION 287 -#define VIDEOPLAYER_AUDIO_CODEC 288 -#define VIDEOPLAYER_AUDIO_CHANNELS 289 -#define VIDEOPLAYER_VIDEO_ASPECT 290 -#define VIDEOPLAYER_HASTELETEXT 291 -#define VIDEOPLAYER_COUNTRY 292 -#define VIDEOPLAYER_PLAYCOUNT 293 -#define VIDEOPLAYER_LASTPLAYED 294 - -#define VIDEOPLAYER_STARTTIME 295 -#define VIDEOPLAYER_ENDTIME 296 -#define VIDEOPLAYER_NEXT_TITLE 297 -#define VIDEOPLAYER_NEXT_GENRE 298 -#define VIDEOPLAYER_NEXT_PLOT 299 -#define VIDEOPLAYER_NEXT_PLOT_OUTLINE 300 -#define VIDEOPLAYER_NEXT_STARTTIME 301 -#define VIDEOPLAYER_NEXT_ENDTIME 302 -#define VIDEOPLAYER_NEXT_DURATION 303 -#define VIDEOPLAYER_CHANNEL_NAME 304 -// unused 305 -#define VIDEOPLAYER_CHANNEL_GROUP 306 -#define VIDEOPLAYER_PARENTAL_RATING 307 -#define VIDEOPLAYER_HAS_EPG 308 -#define VIDEOPLAYER_VOTES 309 +#define VIDEOPLAYER_COVER 254 +#define VIDEOPLAYER_ORIGINALTITLE 255 +#define VIDEOPLAYER_PLOT 256 +#define VIDEOPLAYER_PLOT_OUTLINE 257 +#define VIDEOPLAYER_EPISODE 258 +#define VIDEOPLAYER_SEASON 259 +#define VIDEOPLAYER_RATING 260 +#define VIDEOPLAYER_TVSHOW 261 +#define VIDEOPLAYER_PREMIERED 262 +#define VIDEOPLAYER_STUDIO 263 +#define VIDEOPLAYER_MPAA 264 +#define VIDEOPLAYER_ARTIST 265 +#define VIDEOPLAYER_ALBUM 266 +#define VIDEOPLAYER_WRITER 267 +#define VIDEOPLAYER_TAGLINE 268 +#define VIDEOPLAYER_TOP250 269 +#define VIDEOPLAYER_RATING_AND_VOTES 270 +#define VIDEOPLAYER_TRAILER 271 +#define VIDEOPLAYER_COUNTRY 272 +#define VIDEOPLAYER_PLAYCOUNT 273 +#define VIDEOPLAYER_LASTPLAYED 274 +#define VIDEOPLAYER_VOTES 275 +#define VIDEOPLAYER_IMDBNUMBER 276 +#define VIDEOPLAYER_USER_RATING 277 +#define VIDEOPLAYER_DBID 278 + +// Range of videoplayer infolabels that work with offset and position +#define VIDEOPLAYER_OFFSET_POSITION_FIRST VIDEOPLAYER_TITLE +#define VIDEOPLAYER_OFFSET_POSITION_LAST VIDEOPLAYER_DBID + +#define VIDEOPLAYER_AUDIO_BITRATE 281 +#define VIDEOPLAYER_VIDEO_BITRATE 282 +#define VIDEOPLAYER_VIDEO_CODEC 283 +#define VIDEOPLAYER_VIDEO_RESOLUTION 284 +#define VIDEOPLAYER_AUDIO_CODEC 285 +#define VIDEOPLAYER_AUDIO_CHANNELS 286 +#define VIDEOPLAYER_VIDEO_ASPECT 287 +#define VIDEOPLAYER_SUBTITLES_LANG 288 +#define VIDEOPLAYER_AUDIO_LANG 290 +#define VIDEOPLAYER_STEREOSCOPIC_MODE 291 +#define VIDEOPLAYER_CAST 292 +#define VIDEOPLAYER_CAST_AND_ROLE 293 +#define VIDEOPLAYER_UNIQUEID 294 + +// Videoplayer infobools +#define VIDEOPLAYER_HASSUBTITLES 300 +#define VIDEOPLAYER_SUBTITLESENABLED 301 +#define VIDEOPLAYER_USING_OVERLAYS 302 +#define VIDEOPLAYER_ISFULLSCREEN 303 +#define VIDEOPLAYER_HASMENU 304 +#define VIDEOPLAYER_PLAYLISTLEN 305 +#define VIDEOPLAYER_PLAYLISTPOS 306 +#define VIDEOPLAYER_CONTENT 307 +#define VIDEOPLAYER_HAS_INFO 308 +#define VIDEOPLAYER_HASTELETEXT 309 #define VIDEOPLAYER_IS_STEREOSCOPIC 310 -#define VIDEOPLAYER_STEREOSCOPIC_MODE 311 -#define VIDEOPLAYER_SUBTITLES_LANG 312 -#define VIDEOPLAYER_AUDIO_LANG 313 -// unused 314 -#define VIDEOPLAYER_CHANNEL_NUMBER 315 -#define VIDEOPLAYER_CAN_RESUME_LIVE_TV 316 -#define VIDEOPLAYER_IMDBNUMBER 317 -#define VIDEOPLAYER_EPISODENAME 318 -#define VIDEOPLAYER_USER_RATING 319 -#define VIDEOPLAYER_DBID 320 -#define VIDEOPLAYER_UNIQUEID 321 + +// PVR infolabels +#define VIDEOPLAYER_EVENT 313 +#define VIDEOPLAYER_EPISODENAME 314 +#define VIDEOPLAYER_STARTTIME 315 +#define VIDEOPLAYER_ENDTIME 316 +#define VIDEOPLAYER_NEXT_TITLE 317 +#define VIDEOPLAYER_NEXT_GENRE 318 +#define VIDEOPLAYER_NEXT_PLOT 319 +#define VIDEOPLAYER_NEXT_PLOT_OUTLINE 320 +#define VIDEOPLAYER_NEXT_STARTTIME 321 +#define VIDEOPLAYER_NEXT_ENDTIME 322 +#define VIDEOPLAYER_NEXT_DURATION 323 +#define VIDEOPLAYER_CHANNEL_NAME 324 +#define VIDEOPLAYER_CHANNEL_GROUP 325 +#define VIDEOPLAYER_PARENTAL_RATING 326 +#define VIDEOPLAYER_CHANNEL_NUMBER 327 + +// PVR infobools +#define VIDEOPLAYER_HAS_EPG 328 +#define VIDEOPLAYER_CAN_RESUME_LIVE_TV 329 #define RETROPLAYER_VIDEO_FILTER 330 #define RETROPLAYER_STRETCH_MODE 331 diff --git a/xbmc/guilib/guiinfo/VideoGUIInfo.cpp b/xbmc/guilib/guiinfo/VideoGUIInfo.cpp index dc2647f92d5c2..97ec5785a0733 100644 --- a/xbmc/guilib/guiinfo/VideoGUIInfo.cpp +++ b/xbmc/guilib/guiinfo/VideoGUIInfo.cpp @@ -10,6 +10,7 @@ #include "Application.h" #include "FileItem.h" +#include "PlayListPlayer.h" #include "ServiceBroker.h" #include "URL.h" #include "cores/DataCacheCore.h" @@ -22,6 +23,7 @@ #include "guilib/guiinfo/GUIInfo.h" #include "guilib/guiinfo/GUIInfoHelper.h" #include "guilib/guiinfo/GUIInfoLabels.h" +#include "playlists/PlayList.h" #include "settings/AdvancedSettings.h" #include "settings/Settings.h" #include "settings/SettingsComponent.h" @@ -83,6 +85,11 @@ bool CVideoGUIInfo::InitCurrentItem(CFileItem *item) bool CVideoGUIInfo::GetLabel(std::string& value, const CFileItem *item, int contextWindow, const CGUIInfo &info, std::string *fallback) const { + // For videoplayer "offset" and "position" info labels check playlist + if (info.GetData1() && info.m_info >= VIDEOPLAYER_OFFSET_POSITION_FIRST && + info.m_info <= VIDEOPLAYER_OFFSET_POSITION_LAST) + return GetPlaylistInfo(value, info); + const CVideoInfoTag* tag = item->GetVideoInfoTag(); if (tag) { @@ -579,6 +586,48 @@ bool CVideoGUIInfo::GetLabel(std::string& value, const CFileItem *item, int cont return false; } +bool CVideoGUIInfo::GetPlaylistInfo(std::string& value, const CGUIInfo& info) const +{ + PLAYLIST::CPlayList& playlist = CServiceBroker::GetPlaylistPlayer().GetPlaylist(PLAYLIST_VIDEO); + if (playlist.size() < 1) + return false; + + int index = info.GetData2(); + if (info.GetData1() == 1) + { // relative index (requires current playlist is PLAYLIST_VIDEO) + if (CServiceBroker::GetPlaylistPlayer().GetCurrentPlaylist() != PLAYLIST_VIDEO) + return false; + + index = CServiceBroker::GetPlaylistPlayer().GetNextSong(index); + } + + if (index < 0 || index >= playlist.size()) + return false; + + const CFileItemPtr playlistItem = playlist[index]; + // try to set a thumbnail + if (!playlistItem->HasArt("thumb")) + { + CVideoThumbLoader loader; + loader.LoadItem(playlistItem.get()); + // still no thumb? then just the set the default cover + if (!playlistItem->HasArt("thumb")) + playlistItem->SetArt("thumb", "DefaultVideoCover.png"); + } + if (info.m_info == VIDEOPLAYER_PLAYLISTPOS) + { + value = StringUtils::Format("%i", index + 1); + return true; + } + else if (info.m_info == VIDEOPLAYER_COVER) + { + value = playlistItem->GetArt("thumb"); + return true; + } + + return GetLabel(value, playlistItem.get(), 0, CGUIInfo(info.m_info), nullptr); +} + bool CVideoGUIInfo::GetInt(int& value, const CGUIListItem *gitem, int contextWindow, const CGUIInfo &info) const { if (!gitem->IsFileItem()) diff --git a/xbmc/guilib/guiinfo/VideoGUIInfo.h b/xbmc/guilib/guiinfo/VideoGUIInfo.h index f66e5f28ea0a5..557ca167c6591 100644 --- a/xbmc/guilib/guiinfo/VideoGUIInfo.h +++ b/xbmc/guilib/guiinfo/VideoGUIInfo.h @@ -35,6 +35,7 @@ class CVideoGUIInfo : public CGUIInfoProvider private: int GetPercentPlayed(const CVideoInfoTag* tag) const; + bool GetPlaylistInfo(std::string& value, const CGUIInfo& info) const; }; } // namespace GUIINFO