aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKai Sommerfeld <kai.sommerfeld@gmx.com>2018-03-16 09:37:12 +0100
committerGitHub <noreply@github.com>2018-03-16 09:37:12 +0100
commitdd9a37417a4ec4770f0d14aad67a9a14f99d8236 (patch)
treeb371c6c3b49faa25ca1439dbc8748187e7ce9a06
parent63fe531e3297579562e33da76ce64fe421278de0 (diff)
parentc009a13ef6a1b2626430c6196c06adeb1800cb60 (diff)
Merge pull request #13651 from ksooo/pvr-guiinfo-2
[guiinfo][PVR] Another bunch of (PVR) guiinfo fixes and improvements
-rw-r--r--addons/skin.estuary/xml/DialogSeekBar.xml3
-rw-r--r--xbmc/GUIInfoManager.cpp475
-rw-r--r--xbmc/GUIInfoManager.h30
-rw-r--r--xbmc/XBDateTime.h5
-rw-r--r--xbmc/guiinfo/CMakeLists.txt3
-rw-r--r--xbmc/guiinfo/GUIInfo.h47
-rw-r--r--xbmc/guiinfo/GUIInfoLabels.h5
-rw-r--r--xbmc/pvr/PVRGUIChannelNavigator.cpp19
-rw-r--r--xbmc/pvr/PVRGUIInfo.cpp189
-rw-r--r--xbmc/pvr/PVRGUIInfo.h39
-rw-r--r--xbmc/pvr/PVRManager.cpp15
-rw-r--r--xbmc/pvr/PVRManager.h18
-rw-r--r--xbmc/utils/StringUtils.cpp47
13 files changed, 567 insertions, 328 deletions
diff --git a/addons/skin.estuary/xml/DialogSeekBar.xml b/addons/skin.estuary/xml/DialogSeekBar.xml
index 75464e6dc9..d31d09e7a7 100644
--- a/addons/skin.estuary/xml/DialogSeekBar.xml
+++ b/addons/skin.estuary/xml/DialogSeekBar.xml
@@ -131,8 +131,7 @@
<label>$VAR[SeekTimeLabelVar]</label>
<font>font45</font>
<shadowcolor>black</shadowcolor>
- <visible>!Player.ChannelPreviewActive</visible>
- <animation effect="fade" start="0" end="100" time="200" delay="1000">Visible</animation>
+ <visible>!Player.ChannelPreviewActive | VideoPlayer.HasEpg</visible>
</control>
<control type="label" id="40000">
<centerleft>50%</centerleft>
diff --git a/xbmc/GUIInfoManager.cpp b/xbmc/GUIInfoManager.cpp
index 5602f18eb4..df22cf8bda 100644
--- a/xbmc/GUIInfoManager.cpp
+++ b/xbmc/GUIInfoManager.cpp
@@ -540,8 +540,10 @@ const infomap player_param[] = {{ "art", PLAYER_ITEM_ART }};
/// \table_row3{ <b>`Player.SeekOffset(format)`</b>,
/// \anchor Player_SeekOffset_format
/// _string_,
-/// Returns hours (hh)\, minutes (mm) or seconds (ss). Also supported: (hh:mm)\,
-/// (mm:ss)\, (hh:mm:ss)\, (hh:mm:ss).
+/// Returns hours (hh)\, minutes (mm) or seconds (ss).
+/// Also supported: (hh:mm)\, (mm:ss)\, (hh:mm:ss)\, (h:mm:ss).
+/// Added with Leia: (secs)\, (mins)\, (hours) for total time values.
+/// Example: 3661 seconds => hh=1\, mm=1\, ss=1\, hours=1\, mins=61\, secs=3661
/// }
/// \table_row3{ <b>`Player.SeekStepSize`</b>,
/// \anchor Player_SeekStepSize
@@ -556,9 +558,10 @@ const infomap player_param[] = {{ "art", PLAYER_ITEM_ART }};
/// \table_row3{ <b>`Player.TimeRemaining(format)`</b>,
/// \anchor Player_TimeRemaining_format
/// _string_,
-/// Returns hours (hh)\, minutes (mm) or seconds (ss). When 12 hour clock is
-/// used (xx) will return AM/PM. Also supported: (hh:mm)\, (mm:ss)\,
-/// (hh:mm:ss)\, (hh:mm:ss).
+/// Returns hours (hh)\, minutes (mm) or seconds (ss).
+/// Also supported: (hh:mm)\, (mm:ss)\, (hh:mm:ss)\, (h:mm:ss).
+/// Added with Leia: (secs)\, (mins)\, (hours) for total time values.
+/// Example: 3661 seconds => hh=1\, mm=1\, ss=1\, hours=1\, mins=61\, secs=3661
/// }
/// \table_row3{ <b>`Player.TimeSpeed`</b>,
/// \anchor Player_TimeSpeed
@@ -573,9 +576,10 @@ const infomap player_param[] = {{ "art", PLAYER_ITEM_ART }};
/// \table_row3{ <b>`Player.Time(format)`</b>,
/// \anchor Player_Time_format
/// _string_,
-/// Returns hours (hh)\, minutes (mm) or seconds (ss). When 12 hour clock is
-/// used (xx) will return AM/PM. Also supported: (hh:mm)\, (mm:ss)\,
-/// (hh:mm:ss)\, (hh:mm:ss).
+/// Returns hours (hh)\, minutes (mm) or seconds (ss).
+/// Also supported: (hh:mm)\, (mm:ss)\, (hh:mm:ss)\, (h:mm:ss).
+/// Added with Leia: (secs)\, (mins)\, (hours) for total time values.
+/// Example: 3661 seconds => hh=1\, mm=1\, ss=1\, hours=1\, mins=61\, secs=3661
/// }
/// \table_row3{ <b>`Player.Duration`</b>,
/// \anchor Player_Duration
@@ -585,9 +589,10 @@ const infomap player_param[] = {{ "art", PLAYER_ITEM_ART }};
/// \table_row3{ <b>`Player.Duration(format)`</b>,
/// \anchor Player_Duration_format
/// _string_,
-/// Returns hours (hh)\, minutes (mm) or seconds (ss). When 12 hour clock is used
-/// (xx) will return AM/PM. Also supported: (hh:mm)\, (mm:ss)\, (hh:mm:ss)\,
-/// (hh:mm:ss).
+/// Returns hours (hh)\, minutes (mm) or seconds (ss).
+/// Also supported: (hh:mm)\, (mm:ss)\, (hh:mm:ss)\, (h:mm:ss).
+/// Added with Leia: (secs)\, (mins)\, (hours) for total time values.
+/// Example: 3661 seconds => hh=1\, mm=1\, ss=1\, hours=1\, mins=61\, secs=3661
/// }
/// \table_row3{ <b>`Player.FinishTime`</b>,
/// \anchor Player_FinishTime
@@ -597,9 +602,10 @@ const infomap player_param[] = {{ "art", PLAYER_ITEM_ART }};
/// \table_row3{ <b>`Player.FinishTime(format)`</b>,
/// \anchor Player_FinishTime_format
/// _string_,
-/// Returns hours (hh)\, minutes (mm) or seconds (ss). When 12 hour clock is
-/// used (xx) will return AM/PM. Also supported: (hh:mm)\, (mm:ss)\,
-/// (hh:mm:ss)\, (hh:mm:ss).
+/// Returns hours (hh)\, minutes (mm) or seconds (ss). When 12 hour clock is used
+/// (xx) will return AM/PM. Also supported: (hh:mm)\, (mm:ss)\, (hh:mm:ss)\, (h:mm:ss).
+/// Added with Leia: (secs)\, (mins)\, (hours) for total time values.
+/// Example: 3661 seconds => hh=1\, mm=1\, ss=1\, hours=1\, mins=61\, secs=3661
/// }
/// \table_row3{ <b>`Player.StartTime`</b>,
/// \anchor Player_StartTime
@@ -609,9 +615,10 @@ const infomap player_param[] = {{ "art", PLAYER_ITEM_ART }};
/// \table_row3{ <b>`Player.StartTime(format)`</b>,
/// \anchor Player_StartTime_format
/// _string_,
-/// Returns hours (hh)\, minutes (mm) or seconds (ss). When 12 hour clock is
-/// used (xx) will return AM/PM. Also supported: (hh:mm)\, (mm:ss)\,
-/// (hh:mm:ss)\, (hh:mm:ss).
+/// Returns hours (hh)\, minutes (mm) or seconds (ss). When 12 hour clock is used
+/// (xx) will return AM/PM. Also supported: (hh:mm)\, (mm:ss)\, (hh:mm:ss)\, (h:mm:ss).
+/// Added with Leia: (secs)\, (mins)\, (hours) for total time values.
+/// Example: 3661 seconds => hh=1\, mm=1\, ss=1\, hours=1\, mins=61\, secs=3661
/// }
/// \table_row3{ <b>`Player.SeekNumeric`</b>,
/// \anchor Player_SeekNumeric
@@ -622,8 +629,9 @@ const infomap player_param[] = {{ "art", PLAYER_ITEM_ART }};
/// \anchor Player_SeekNumeric_format
/// _string_,
/// Returns hours (hh)\, minutes (mm) or seconds (ss). When 12 hour clock is used
-/// (xx) will return AM/PM. Also supported: (hh:mm)\, (mm:ss)\, (hh:mm:ss)\,
-/// (hh:mm:ss).
+/// (xx) will return AM/PM. Also supported: (hh:mm)\, (mm:ss)\, (hh:mm:ss)\, (h:mm:ss).
+/// Added with Leia: (secs)\, (mins)\, (hours) for total time values.
+/// Example: 3661 seconds => hh=1\, mm=1\, ss=1\, hours=1\, mins=61\, secs=3661
/// }
/// \table_end
///
@@ -899,9 +907,10 @@ const infomap weather[] = {{ "isfetched", WEATHER_IS_FETCHED },
/// \table_row3{ <b>`System.Time(format)`</b>,
/// \anchor System_Time_format
/// _string_,
-/// Returns hours (hh)\, minutes (mm) or seconds (ss). When 12 hour clock is
-/// used (xx) will return AM/PM. Also supported: (hh:mm)\, (mm:ss)\,
-/// (hh:mm:ss)\, (hh:mm:ss). (xx) option added after dharma
+/// Returns hours (hh)\, minutes (mm) or seconds (ss). When 12 hour clock is used
+/// (xx) will return AM/PM. Also supported: (hh:mm)\, (mm:ss)\, (hh:mm:ss)\, (h:mm:ss).
+/// Added with Leia: (secs)\, (mins)\, (hours) for total time values.
+/// Example: 3661 seconds => hh=1\, mm=1\, ss=1\, hours=1\, mins=61\, secs=3661
/// }
/// \table_row3{ <b>`System.Date`</b>,
/// \anchor System_Date
@@ -3323,8 +3332,17 @@ const infomap container_str[] = {{ "property", CONTAINER_PROPERTY },
/// \table_row3{ <b>`ListItem.Duration`</b>,
/// \anchor ListItem_Duration
/// _string_,
-/// Returns the song or movie duration of the currently selected movie in a
-/// container
+/// Returns the duration of the currently selected item in a container
+/// in the format hh:mm:ss. hh: will be omitted if hours value is zero.
+/// }
+/// \table_row3{ <b>`ListItem.Duration(format)`</b>,
+/// \anchor ListItem.Duration_format
+/// _string_,
+/// Returns the duration of the currently selected item in a container in
+/// different formats: hours (hh)\, minutes (mm) or seconds (ss).
+/// Also supported: (hh:mm)\, (mm:ss)\, (hh:mm:ss)\, (h:mm:ss).
+/// Added with Leia: (secs)\, (mins)\, (hours) for total time values.
+/// Example: 3661 seconds => hh=1\, mm=1\, ss=1\, hours=1\, mins=61\, secs=3661
/// }
/// \table_row3{ <b>`ListItem.DBTYPE`</b>,
/// \anchor ListItem_DBTYPE
@@ -4252,46 +4270,6 @@ const infomap playlist[] = {{ "length", PLAYLIST_LENGTH },
/// _boolean_,
/// Returns true if there are timers present who currently not do recording
/// }
-/// \table_row3{ <b>`PVR.NowRecordingTitle`</b>,
-/// \anchor PVR_NowRecordingTitle
-/// _string_,
-/// Title of the programme being recorded
-/// }
-/// \table_row3{ <b>`PVR.NowRecordingDateTime`</b>,
-/// \anchor PVR_NowRecordingDateTime
-/// _Date/Time string_,
-/// Start date and time of the current recording
-/// }
-/// \table_row3{ <b>`PVR.NowRecordingChannel`</b>,
-/// \anchor PVR_NowRecordingChannel
-/// _string_,
-/// Channel name of the current recording
-/// }
-/// \table_row3{ <b>`PVR.NowRecordingChannelIcon`</b>,
-/// \anchor PVR_NowRecordingChannelIcon
-/// _string_,
-/// Icon of the current recording channel
-/// }
-/// \table_row3{ <b>`PVR.NextRecordingTitle`</b>,
-/// \anchor PVR_NextRecordingTitle
-/// _string_,
-/// Title of the next programme that will be recorded
-/// }
-/// \table_row3{ <b>`PVR.NextRecordingDateTime`</b>,
-/// \anchor PVR_NextRecordingDateTime
-/// _Date/Time string_,
-/// Start date and time of the next recording
-/// }
-/// \table_row3{ <b>`PVR.NextRecordingChannel`</b>,
-/// \anchor PVR_NextRecordingChannel
-/// _string_,
-/// Channel name of the next recording
-/// }
-/// \table_row3{ <b>`PVR.NextRecordingChannelIcon`</b>,
-/// \anchor PVR_NextRecordingChannelIcon
-/// _string_,
-/// Icon of the next recording channel
-/// }
/// \table_row3{ <b>`PVR.BackendName`</b>,
/// \anchor PVR_BackendName
/// _string_,
@@ -4372,31 +4350,6 @@ const infomap playlist[] = {{ "length", PLAYLIST_LENGTH },
/// _boolean_,
/// Returns true when an epg tag is being watched.
/// }
-/// \table_row3{ <b>`PVR.EpgEventDuration`</b>,
-/// \anchor PVR_EpgEventDuration
-/// _string_,
-/// Returns the duration of the currently playing epg event
-/// }
-/// \table_row3{ <b>`PVR.EpgEventElapsedTime`</b>,
-/// \anchor PVR_EpgEventElapsedTime
-/// _string_,
-/// Returns the time of the current position of the currently playing epg event
-/// }
-/// \table_row3{ <b>`PVR.EpgEventRemainingTime`</b>,
-/// \anchor PVR_EpgEventRemainingTime
-/// _string_,
-/// Returns the remaining time for currently playing epg event
-/// }
-/// \table_row3{ <b>`PVR.EpgEventSeekTime`</b>,
-/// \anchor PVR_EpgEventSeekTime
-/// _string_,
-/// Returns the time the user is seeking within the currently playing epg event
-/// }
-/// \table_row3{ <b>`PVR.EpgEventFinishTime`</b>,
-/// \anchor PVR_EpgEventFinishTime
-/// _string_,
-/// Returns the time the currently playing epg event will end
-/// }
/// \table_row3{ <b>`PVR.EpgEventProgress`</b>,
/// \anchor PVR_EpgEventProgress
/// _integer_,
@@ -4477,30 +4430,50 @@ const infomap playlist[] = {{ "length", PLAYLIST_LENGTH },
/// _boolean_,
/// Returns true when for channel is timeshift available
/// }
-/// \table_row3{ <b>`PVR.TimeShiftStart`</b>,
-/// \anchor PVR_TimeShiftStart
-/// _time string_,
-/// Start position of the timeshift
-/// }
-/// \table_row3{ <b>`PVR.TimeShiftEnd`</b>,
-/// \anchor PVR_TimeShiftEnd
-/// _time string_,
-/// End position of the timeshift
-/// }
-/// \table_row3{ <b>`PVR.TimeShiftCur`</b>,
-/// \anchor PVR_TimeShiftCur
-/// _time string_,
-/// Current position of the timeshift
-/// }
/// \table_row3{ <b>`PVR.TimeShiftProgress`</b>,
/// \anchor PVR_TimeShiftProgress
/// _integer_,
/// Returns the position of currently timeshifted title on TV as integer
/// }
-/// \table_row3{ <b>`PVR.TimeShiftOffset`</b>,
-/// \anchor PVR_TimeShiftOffset
-/// _integer_,
-/// Returns the delta of timeshifted time to actual time
+/// \table_row3{ <b>`PVR.NowRecordingTitle`</b>,
+/// \anchor PVR_NowRecordingTitle
+/// _string_,
+/// Title of the programme being recorded
+/// }
+/// \table_row3{ <b>`PVR.NowRecordingDateTime`</b>,
+/// \anchor PVR_NowRecordingDateTime
+/// _Date/Time string_,
+/// Start date and time of the current recording
+/// }
+/// \table_row3{ <b>`PVR.NowRecordingChannel`</b>,
+/// \anchor PVR_NowRecordingChannel
+/// _string_,
+/// Channel name of the current recording
+/// }
+/// \table_row3{ <b>`PVR.NowRecordingChannelIcon`</b>,
+/// \anchor PVR_NowRecordingChannelIcon
+/// _string_,
+/// Icon of the current recording channel
+/// }
+/// \table_row3{ <b>`PVR.NextRecordingTitle`</b>,
+/// \anchor PVR_NextRecordingTitle
+/// _string_,
+/// Title of the next programme that will be recorded
+/// }
+/// \table_row3{ <b>`PVR.NextRecordingDateTime`</b>,
+/// \anchor PVR_NextRecordingDateTime
+/// _Date/Time string_,
+/// Start date and time of the next recording
+/// }
+/// \table_row3{ <b>`PVR.NextRecordingChannel`</b>,
+/// \anchor PVR_NextRecordingChannel
+/// _string_,
+/// Channel name of the next recording
+/// }
+/// \table_row3{ <b>`PVR.NextRecordingChannelIcon`</b>,
+/// \anchor PVR_NextRecordingChannelIcon
+/// _string_,
+/// Icon of the next recording channel
/// }
/// \table_row3{ <b>`PVR.TVNowRecordingTitle`</b>,
/// \anchor PVR_TVNowRecordingTitle
@@ -4636,14 +4609,6 @@ const infomap pvr[] = {{ "isrecording", PVR_IS_RECORDING
{ "hastvchannels", PVR_HAS_TV_CHANNELS },
{ "hasradiochannels", PVR_HAS_RADIO_CHANNELS },
{ "hasnonrecordingtimer", PVR_HAS_NONRECORDING_TIMER },
- { "nowrecordingtitle", PVR_NOW_RECORDING_TITLE },
- { "nowrecordingdatetime", PVR_NOW_RECORDING_DATETIME },
- { "nowrecordingchannel", PVR_NOW_RECORDING_CHANNEL },
- { "nowrecordingchannelicon", PVR_NOW_RECORDING_CHAN_ICO },
- { "nextrecordingtitle", PVR_NEXT_RECORDING_TITLE },
- { "nextrecordingdatetime", PVR_NEXT_RECORDING_DATETIME },
- { "nextrecordingchannel", PVR_NEXT_RECORDING_CHANNEL },
- { "nextrecordingchannelicon", PVR_NEXT_RECORDING_CHAN_ICO },
{ "backendname", PVR_BACKEND_NAME },
{ "backendversion", PVR_BACKEND_VERSION },
{ "backendhost", PVR_BACKEND_HOST },
@@ -4660,11 +4625,6 @@ const infomap pvr[] = {{ "isrecording", PVR_IS_RECORDING
{ "isplayingradio", PVR_IS_PLAYING_RADIO },
{ "isplayingrecording", PVR_IS_PLAYING_RECORDING },
{ "isplayingepgtag", PVR_IS_PLAYING_EPGTAG },
- { "epgeventduration", PVR_EPG_EVENT_DURATION },
- { "epgeventelapsedtime", PVR_EPG_EVENT_ELAPSED_TIME },
- { "epgeventremainingtime", PVR_EPG_EVENT_REMAINING_TIME },
- { "epgeventfinishtime", PVR_EPG_EVENT_FINISH_TIME },
- { "epgeventseektime", PVR_EPG_EVENT_SEEK_TIME },
{ "epgeventprogress", PVR_EPG_EVENT_PROGRESS },
{ "actstreamclient", PVR_ACTUAL_STREAM_CLIENT },
{ "actstreamdevice", PVR_ACTUAL_STREAM_DEVICE },
@@ -4681,11 +4641,7 @@ const infomap pvr[] = {{ "isrecording", PVR_IS_RECORDING
{ "actstreammux", PVR_ACTUAL_STREAM_MUX },
{ "actstreamprovidername", PVR_ACTUAL_STREAM_PROVIDER },
{ "istimeshift", PVR_IS_TIMESHIFTING },
- { "timeshiftstart", PVR_TIMESHIFT_START_TIME },
- { "timeshiftend", PVR_TIMESHIFT_END_TIME },
- { "timeshiftcur", PVR_TIMESHIFT_PLAY_TIME },
{ "timeshiftprogress", PVR_TIMESHIFT_PROGRESS },
- { "timeshiftoffset", PVR_TIMESHIFT_OFFSET },
{ "nowrecordingtitle", PVR_NOW_RECORDING_TITLE },
{ "nowrecordingdatetime", PVR_NOW_RECORDING_DATETIME },
{ "nowrecordingchannel", PVR_NOW_RECORDING_CHANNEL },
@@ -4721,6 +4677,160 @@ const infomap pvr[] = {{ "isrecording", PVR_IS_RECORDING
{ "isrecordingplayingchannel", PVR_IS_RECORDING_PLAYING_CHANNEL }};
/// \page modules__General__List_of_gui_access
+/// \section modules__General__List_of_gui_access_PvrTimes PvrTimes
+/// @{
+/// \table_start
+/// \table_h3{ Labels, Type, Description }
+/// \table_row3{ <b>`PVR.EpgEventDuration`</b>,
+/// \anchor PVR_EpgEventDuration
+/// _string_,
+/// Returns the duration of the currently playing epg event in the
+/// format hh:mm:ss. hh: will be omitted if hours value is zero.
+/// }
+/// \table_row3{ <b>`PVR.EpgEventDuration(format)`</b>,
+/// \anchor PVR_EpgEventDuration_format
+/// _string_,
+/// Returns the duration of the currently playing epg event in different formats:
+/// Hours (hh)\, minutes (mm) or seconds (ss).
+/// Also supported: (hh:mm)\, (mm:ss)\, (hh:mm:ss)\, (h:mm:ss).
+/// Added with Leia: (secs)\, (mins)\, (hours) for total time values.
+/// Example: 3661 seconds => hh=1\, mm=1\, ss=1\, hours=1\, mins=61\, secs=3661
+/// }
+/// \table_row3{ <b>`PVR.EpgEventElapsedTime`</b>,
+/// \anchor PVR_EpgEventElapsedTime
+/// _string_,
+/// Returns the time of the current position of the currently playing epg event in the
+/// format hh:mm:ss. hh: will be omitted if hours value is zero.
+/// }
+/// \table_row3{ <b>`PVR.EpgEventElapsedTime(format)`</b>,
+/// \anchor PVR_EpgEventElapsedTime_format
+/// _string_,
+/// Returns the time of the current position of the currently playing epg event in different formats:
+/// Hours (hh)\, minutes (mm) or seconds (ss).
+/// Also supported: (hh:mm)\, (mm:ss)\, (hh:mm:ss)\, (h:mm:ss).
+/// Added with Leia: (secs)\, (mins)\, (hours) for total time values.
+/// Example: 3661 seconds => hh=1\, mm=1\, ss=1\, hours=1\, mins=61\, secs=3661
+/// }
+/// \table_row3{ <b>`PVR.EpgEventRemainingTime`</b>,
+/// \anchor PVR_EpgEventRemainingTime
+/// _string_,
+/// Returns the remaining time for currently playing epg event in the
+/// format hh:mm:ss. hh: will be omitted if hours value is zero.
+/// }
+/// \table_row3{ <b>`PVR.EpgEventRemainingTime(format)`</b>,
+/// \anchor PVR_EpgEventRemainingTime_format
+/// _string_,
+/// Returns the remaining time for currently playing epg event in different formats:
+/// Hours (hh)\, minutes (mm) or seconds (ss).
+/// Also supported: (hh:mm)\, (mm:ss)\, (hh:mm:ss)\, (h:mm:ss).
+/// Added with Leia: (secs)\, (mins)\, (hours) for total time values.
+/// Example: 3661 seconds => hh=1\, mm=1\, ss=1\, hours=1\, mins=61\, secs=3661
+/// }
+/// \table_row3{ <b>`PVR.EpgEventSeekTime`</b>,
+/// \anchor PVR_EpgEventSeekTime
+/// _string_,
+/// Returns the time the user is seeking within the currently playing epg event in the
+/// format hh:mm:ss. hh: will be omitted if hours value is zero.
+/// }
+/// \table_row3{ <b>`PVR.EpgEventSeekTime(format)`</b>,
+/// \anchor PVR_EpgEventSeekTime_format
+/// _string_,
+/// Returns the time the user is seeking within the currently playing epg event in different formats:
+/// Hours (hh)\, minutes (mm) or seconds (ss). When 12 hour clock is used
+/// (xx) will return AM/PM. Also supported: (hh:mm)\, (mm:ss)\, (hh:mm:ss)\, (h:mm:ss).
+/// Added with Leia: (secs)\, (mins)\, (hours) for total time values.
+/// Example: 3661 seconds => hh=1\, mm=1\, ss=1\, hours=1\, mins=61\, secs=3661
+/// }
+/// \table_row3{ <b>`PVR.EpgEventFinishTime`</b>,
+/// \anchor PVR_EpgEventFinishTime
+/// _string_,
+/// Returns the time the currently playing epg event will end in the
+/// format hh:mm:ss. hh: will be omitted if hours value is zero.
+/// }
+/// \table_row3{ <b>`PVR.EpgEventFinishTime(format)`</b>,
+/// \anchor PVR_EpgEventFinishTime_format
+/// _string_,
+/// Returns the time the currently playing epg event will end in different formats:
+/// Hours (hh)\, minutes (mm) or seconds (ss). When 12 hour clock is used
+/// (xx) will return AM/PM. Also supported: (hh:mm)\, (mm:ss)\, (hh:mm:ss)\, (h:mm:ss).
+/// Added with Leia: (secs)\, (mins)\, (hours) for total time values.
+/// Example: 3661 seconds => hh=1\, mm=1\, ss=1\, hours=1\, mins=61\, secs=3661
+/// }
+/// \table_row3{ <b>`PVR.TimeShiftStart`</b>,
+/// \anchor PVR_TimeShiftStart
+/// _string_,
+/// Returns the start time of the timeshift buffer in the
+/// format hh:mm:ss. hh: will be omitted if hours value is zero.
+/// }
+/// \table_row3{ <b>`PVR.TimeShiftStart(format)`</b>,
+/// \anchor PVR_TimeShiftStart_format
+/// _string_,
+/// Returns the start time of the timeshift buffer in different formats:
+/// Hours (hh)\, minutes (mm) or seconds (ss). When 12 hour clock is used
+/// (xx) will return AM/PM. Also supported: (hh:mm)\, (mm:ss)\, (hh:mm:ss)\, (h:mm:ss).
+/// Added with Leia: (secs)\, (mins)\, (hours) for total time values.
+/// Example: 3661 seconds => hh=1\, mm=1\, ss=1\, hours=1\, mins=61\, secs=3661
+/// }
+/// \table_row3{ <b>`PVR.TimeShiftEnd`</b>,
+/// \anchor PVR_TimeShiftEnd
+/// _string_,
+/// Returns the end time of the timeshift buffer in the
+/// format hh:mm:ss. hh: will be omitted if hours value is zero.
+/// }
+/// \table_row3{ <b>`PVR.TimeShiftEnd(format)`</b>,
+/// \anchor PVR_TimeShiftEnd_format
+/// _string_,
+/// Returns the end time of the timeshift buffer in different formats:
+/// Hours (hh)\, minutes (mm) or seconds (ss). When 12 hour clock is used
+/// (xx) will return AM/PM. Also supported: (hh:mm)\, (mm:ss)\, (hh:mm:ss)\, (h:mm:ss).
+/// Added with Leia: (secs)\, (mins)\, (hours) for total time values.
+/// Example: 3661 seconds => hh=1\, mm=1\, ss=1\, hours=1\, mins=61\, secs=3661
+/// }
+/// \table_row3{ <b>`PVR.TimeShiftCur`</b>,
+/// \anchor PVR_TimeShiftCur
+/// _string_,
+/// Returns the current playback time within the timeshift buffer in the
+/// format hh:mm:ss. hh: will be omitted if hours value is zero.
+/// }
+/// \table_row3{ <b>`PVR.TimeShiftCur(format)`</b>,
+/// \anchor PVR_TimeShiftCur_format
+/// _string_,
+/// Returns the current playback time within the timeshift buffer in different formats:
+/// Hours (hh)\, minutes (mm) or seconds (ss). When 12 hour clock is used
+/// (xx) will return AM/PM. Also supported: (hh:mm)\, (mm:ss)\, (hh:mm:ss)\, (h:mm:ss).
+/// Added with Leia: (secs)\, (mins)\, (hours) for total time values.
+/// Example: 3661 seconds => hh=1\, mm=1\, ss=1\, hours=1\, mins=61\, secs=3661
+/// }
+/// \table_row3{ <b>`PVR.TimeShiftOffset`</b>,
+/// \anchor PVR_TimeShiftOffset
+/// _string_,
+/// Returns the delta of timeshifted time to actual time in the
+/// format hh:mm:ss. hh: will be omitted if hours value is zero.
+/// }
+/// \table_row3{ <b>`PVR.TimeShiftOffset(format)`</b>,
+/// \anchor PVR_TimeShiftOffset_format
+/// _string_,
+/// Returns the delta of timeshifted time to actual time in different formats:
+/// Hours (hh)\, minutes (mm) or seconds (ss).
+/// Also supported: (hh:mm)\, (mm:ss)\, (hh:mm:ss)\, (h:mm:ss).
+/// Added with Leia: (secs)\, (mins)\, (hours) for total time values.
+/// Example: 3661 seconds => hh=1\, mm=1\, ss=1\, hours=1\, mins=61\, secs=3661
+/// }
+/// \table_end
+///
+/// -----------------------------------------------------------------------------
+/// @}
+const infomap pvr_times[] = {{ "epgeventduration", PVR_EPG_EVENT_DURATION },
+ { "epgeventelapsedtime", PVR_EPG_EVENT_ELAPSED_TIME },
+ { "epgeventremainingtime", PVR_EPG_EVENT_REMAINING_TIME },
+ { "epgeventfinishtime", PVR_EPG_EVENT_FINISH_TIME },
+ { "epgeventseektime", PVR_EPG_EVENT_SEEK_TIME },
+ { "timeshiftstart", PVR_TIMESHIFT_START_TIME },
+ { "timeshiftend", PVR_TIMESHIFT_END_TIME },
+ { "timeshiftcur", PVR_TIMESHIFT_PLAY_TIME },
+ { "timeshiftoffset", PVR_TIMESHIFT_OFFSET }};
+
+/// \page modules__General__List_of_gui_access
/// \section modules__General__List_of_gui_access_ADSP ADSP
/// @{
/// \table_start
@@ -5791,6 +5901,11 @@ int CGUIInfoManager::TranslateSingleString(const std::string &strCondition, bool
if (prop.name == pvr[i].str)
return pvr[i].val;
}
+ for (size_t i = 0; i < sizeof(pvr_times) / sizeof(infomap); i++)
+ {
+ if (prop.name == pvr_times[i].str)
+ return AddMultiInfo(GUIInfo(pvr_times[i].val, TranslateTimeFormat(prop.param())));
+ }
}
else if (cat.name == "adsp")
{
@@ -5910,6 +6025,8 @@ int CGUIInfoManager::TranslateListItem(const Property &info)
return AddListItemProp(info.param(), LISTITEM_VOTES_OFFSET);
if (info.name == "ratingandvotes")
return AddListItemProp(info.param(), LISTITEM_RATING_AND_VOTES_OFFSET);
+ if (info.name == "duration")
+ return AddListItemProp(info.param(), LISTITEM_DURATION_OFFSET);
}
for (size_t i = 0; i < sizeof(listitem_labels) / sizeof(infomap); i++) // these ones don't have or need an id
@@ -5944,6 +6061,9 @@ TIME_FORMAT CGUIInfoManager::TranslateTimeFormat(const std::string &format)
else if (StringUtils::EqualsNoCase(format, "h:mm:ss")) return TIME_FORMAT_H_MM_SS;
else if (StringUtils::EqualsNoCase(format, "h:mm:ss xx")) return TIME_FORMAT_H_MM_SS_XX;
else if (StringUtils::EqualsNoCase(format, "xx")) return TIME_FORMAT_XX;
+ else if (StringUtils::EqualsNoCase(format, "secs")) return TIME_FORMAT_SECS;
+ else if (StringUtils::EqualsNoCase(format, "mins")) return TIME_FORMAT_MINS;
+ else if (StringUtils::EqualsNoCase(format, "hours")) return TIME_FORMAT_HOURS;
return TIME_FORMAT_GUESS;
}
@@ -6000,14 +6120,6 @@ std::string CGUIInfoManager::GetLabel(int info, int contextWindow, std::string *
switch (info)
{
- case PVR_NEXT_RECORDING_CHANNEL:
- case PVR_NEXT_RECORDING_CHAN_ICO:
- case PVR_NEXT_RECORDING_DATETIME:
- case PVR_NEXT_RECORDING_TITLE:
- case PVR_NOW_RECORDING_CHANNEL:
- case PVR_NOW_RECORDING_CHAN_ICO:
- case PVR_NOW_RECORDING_DATETIME:
- case PVR_NOW_RECORDING_TITLE:
case PVR_BACKEND_NAME:
case PVR_BACKEND_VERSION:
case PVR_BACKEND_HOST:
@@ -6019,10 +6131,6 @@ std::string CGUIInfoManager::GetLabel(int info, int contextWindow, std::string *
case PVR_BACKEND_NUMBER:
case PVR_TOTAL_DISKSPACE:
case PVR_NEXT_TIMER:
- case PVR_EPG_EVENT_DURATION:
- case PVR_EPG_EVENT_ELAPSED_TIME:
- case PVR_EPG_EVENT_REMAINING_TIME:
- case PVR_EPG_EVENT_FINISH_TIME:
case PVR_EPG_EVENT_PROGRESS:
case PVR_ACTUAL_STREAM_CLIENT:
case PVR_ACTUAL_STREAM_DEVICE:
@@ -6037,10 +6145,14 @@ std::string CGUIInfoManager::GetLabel(int info, int contextWindow, std::string *
case PVR_ACTUAL_STREAM_SERVICE:
case PVR_ACTUAL_STREAM_MUX:
case PVR_ACTUAL_STREAM_PROVIDER:
- case PVR_TIMESHIFT_START_TIME:
- case PVR_TIMESHIFT_END_TIME:
- case PVR_TIMESHIFT_PLAY_TIME:
- case PVR_TIMESHIFT_OFFSET:
+ case PVR_NOW_RECORDING_TITLE:
+ case PVR_NOW_RECORDING_CHANNEL:
+ case PVR_NOW_RECORDING_CHAN_ICO:
+ case PVR_NOW_RECORDING_DATETIME:
+ case PVR_NEXT_RECORDING_TITLE:
+ case PVR_NEXT_RECORDING_CHANNEL:
+ case PVR_NEXT_RECORDING_CHAN_ICO:
+ case PVR_NEXT_RECORDING_DATETIME:
case PVR_TV_NOW_RECORDING_TITLE:
case PVR_TV_NOW_RECORDING_CHANNEL:
case PVR_TV_NOW_RECORDING_CHAN_ICO:
@@ -6057,10 +6169,7 @@ std::string CGUIInfoManager::GetLabel(int info, int contextWindow, std::string *
case PVR_RADIO_NEXT_RECORDING_CHANNEL:
case PVR_RADIO_NEXT_RECORDING_CHAN_ICO:
case PVR_RADIO_NEXT_RECORDING_DATETIME:
- CServiceBroker::GetPVRManager().TranslateCharInfo(info, strLabel);
- break;
- case PVR_EPG_EVENT_SEEK_TIME:
- CServiceBroker::GetPVRManager().GetSeekTimeLabel(g_application.GetAppPlayer().GetSeekHandler().GetSeekSize(), strLabel);
+ CServiceBroker::GetPVRManager().TranslateCharInfo(m_currentFile, info, strLabel);
break;
case PVR_CHANNEL_NUMBER_INPUT:
strLabel = CServiceBroker::GetPVRManager().GUIActions()->GetChannelNumberInputHandler().GetChannelNumberAsString();
@@ -6871,7 +6980,7 @@ bool CGUIInfoManager::GetInt(int &value, int info, int contextWindow, const CGUI
case PVR_ACTUAL_STREAM_SNR_PROGR:
case PVR_BACKEND_DISKSPACE_PROGR:
case PVR_TIMESHIFT_PROGRESS:
- value = CServiceBroker::GetPVRManager().TranslateIntInfo(*m_currentFile, info);
+ value = CServiceBroker::GetPVRManager().TranslateIntInfo(m_currentFile, info);
return true;
case SYSTEM_BATTERY_LEVEL:
value = CServiceBroker::GetPowerManager().BatteryLevel();
@@ -8025,6 +8134,10 @@ CGUIControl* CGUIInfoManager::GetActiveContainer(int containerId, int contextWin
/// \brief Examines the multi information sent and returns the string as appropriate
std::string CGUIInfoManager::GetMultiInfoLabel(const GUIInfo &info, int contextWindow, std::string *fallback)
{
+ std::string strValue;
+ if (CServiceBroker::GetPVRManager().GetMultiInfoLabel(m_currentFile, info, strValue))
+ return strValue;
+
if (info.m_info == SKIN_STRING)
{
return CSkinSettings::GetInstance().GetString(info.GetData1());
@@ -8087,6 +8200,14 @@ std::string CGUIInfoManager::GetMultiInfoLabel(const GUIInfo &info, int contextW
{
return GetCurrentSeekTime((TIME_FORMAT)info.GetData1());
}
+ else if (info.m_info == PVR_EPG_EVENT_SEEK_TIME)
+ {
+ std::string strLabel;
+ CServiceBroker::GetPVRManager().GetSeekTimeLabel(g_application.GetAppPlayer().GetSeekHandler().GetSeekSize(),
+ static_cast<TIME_FORMAT>(info.GetData1()),
+ strLabel);
+ return strLabel;
+ }
else if (info.m_info == PLAYER_SEEKOFFSET)
{
std::string seekOffset = StringUtils::SecondsToTimeString(abs(m_seekOffset / 1000), (TIME_FORMAT)info.GetData1());
@@ -9480,6 +9601,36 @@ bool CGUIInfoManager::GetItemInt(int &value, const CGUIListItem *item, int info)
return false;
}
+std::string CGUIInfoManager::GetItemDuration(const CFileItem *item, TIME_FORMAT format) const
+{
+ int iDuration = -1;
+ if (item->IsPVRChannel() || item->IsEPG() || item->IsPVRTimer())
+ {
+ const CPVREpgInfoTagPtr epgTag = CPVRItem(item).GetEpgInfoTag();
+ if (epgTag)
+ iDuration = epgTag->GetDuration();
+ }
+ else if (item->HasVideoInfoTag())
+ {
+ if (item->GetVideoInfoTag()->GetDuration() > 0)
+ iDuration = item->GetVideoInfoTag()->GetDuration();
+ }
+ else if (item->HasMusicInfoTag())
+ {
+ if (item->GetMusicInfoTag()->GetDuration() > 0)
+ iDuration = item->GetMusicInfoTag()->GetDuration();
+ }
+ else if (item->HasProperty(FILEITEM_PROPERTY_SAVESTATE_DURATION))
+ {
+ iDuration = static_cast<long>(item->GetProperty(FILEITEM_PROPERTY_SAVESTATE_DURATION).asInteger());
+ }
+
+ if (iDuration != -1)
+ return StringUtils::SecondsToTimeString(iDuration, format);
+
+ return std::string();
+}
+
std::string CGUIInfoManager::GetItemLabel(const CFileItem *item, int info, std::string *fallback)
{
if (!item) return "";
@@ -9519,6 +9670,12 @@ std::string CGUIInfoManager::GetItemLabel(const CFileItem *item, int info, std::
return FormatRatingAndVotes(rating.rating, rating.votes);
}
+ if (info >= LISTITEM_PROPERTY_START + LISTITEM_DURATION_OFFSET &&
+ info - (LISTITEM_PROPERTY_START + LISTITEM_DURATION_OFFSET) < static_cast<int>(m_listitemProperties.size()))
+ {
+ return GetItemDuration(item, TranslateTimeFormat(m_listitemProperties[info - (LISTITEM_PROPERTY_START + LISTITEM_DURATION_OFFSET)]));
+ }
+
if (info >= LISTITEM_PROPERTY_START && info - LISTITEM_PROPERTY_START < (int)m_listitemProperties.size())
{
std::string property = m_listitemProperties[info - LISTITEM_PROPERTY_START];
@@ -9787,31 +9944,7 @@ std::string CGUIInfoManager::GetItemLabel(const CFileItem *item, int info, std::
}
case LISTITEM_DURATION:
{
- std::string duration;
- if (item->IsPVRChannel() || item->IsEPG() || item->IsPVRTimer())
- {
- const CPVREpgInfoTagPtr epgTag = CPVRItem(item).GetEpgInfoTag();
- if (epgTag)
- return StringUtils::SecondsToTimeString(epgTag->GetDuration());
- else
- return std::string();
- }
- else if (item->HasVideoInfoTag())
- {
- if (item->GetVideoInfoTag()->GetDuration() > 0)
- duration = StringUtils::SecondsToTimeString(item->GetVideoInfoTag()->GetDuration());
- }
- else if (item->HasMusicInfoTag())
- {
- if (item->GetMusicInfoTag()->GetDuration() > 0)
- duration = StringUtils::SecondsToTimeString(item->GetMusicInfoTag()->GetDuration());
- }
- else if (item->HasProperty(FILEITEM_PROPERTY_SAVESTATE_DURATION))
- {
- long iDuration = static_cast<long>(item->GetProperty(FILEITEM_PROPERTY_SAVESTATE_DURATION).asInteger());
- duration = StringUtils::SecondsToTimeString(iDuration);
- }
- return duration;
+ return GetItemDuration(item, TIME_FORMAT_GUESS);
}
case LISTITEM_PLOT:
if (item->IsPVRChannel() || item->IsEPG() || item->IsPVRTimer())
diff --git a/xbmc/GUIInfoManager.h b/xbmc/GUIInfoManager.h
index 010ac3eafd..86ce562604 100644
--- a/xbmc/GUIInfoManager.h
+++ b/xbmc/GUIInfoManager.h
@@ -20,6 +20,7 @@
#pragma once
#include "threads/CriticalSection.h"
+#include "guiinfo/GUIInfo.h"
#include "guilib/IMsgTargetCallback.h"
#include "guilib/GUIControl.h"
#include "messaging/IMessageTarget.h"
@@ -54,33 +55,6 @@ namespace INFO
// forward
class CGUIWindow;
-// structure to hold multiple integer data
-// for storage referenced from a single integer
-class GUIInfo
-{
-public:
- GUIInfo(int info, uint32_t data1 = 0, int data2 = 0, uint32_t flag = 0)
- {
- m_info = info;
- m_data1 = data1;
- m_data2 = data2;
- if (flag)
- SetInfoFlag(flag);
- }
- bool operator ==(const GUIInfo &right) const
- {
- return (m_info == right.m_info && m_data1 == right.m_data1 && m_data2 == right.m_data2);
- };
- uint32_t GetInfoFlag() const;
- uint32_t GetData1() const;
- int GetData2() const;
- int m_info;
-private:
- void SetInfoFlag(uint32_t flag);
- uint32_t m_data1;
- int m_data2;
-};
-
/*!
\ingroup strings
\brief
@@ -138,7 +112,6 @@ public:
std::string GetDuration(TIME_FORMAT format = TIME_FORMAT_GUESS) const;
/*! \brief Set currently playing file item
- \param blocking whether to run in current thread (true) or background thread (false)
*/
void SetCurrentItem(const CFileItem &item);
void ResetCurrentItem();
@@ -338,6 +311,7 @@ private:
static std::string GetEpgEventTitle(const PVR::CPVREpgInfoTagPtr& epgTag);
static std::string FormatRatingAndVotes(float rating, int votes);
bool IsPlayerChannelPreviewActive() const;
+ std::string GetItemDuration(const CFileItem *item, TIME_FORMAT format) const;
};
/*!
diff --git a/xbmc/XBDateTime.h b/xbmc/XBDateTime.h
index a7cd5b9c56..4a06fb9db8 100644
--- a/xbmc/XBDateTime.h
+++ b/xbmc/XBDateTime.h
@@ -42,7 +42,10 @@ enum TIME_FORMAT { TIME_FORMAT_GUESS = 0,
TIME_FORMAT_HH_MM_SS_XX = 15,
TIME_FORMAT_H = 16,
TIME_FORMAT_H_MM_SS = 19,
- TIME_FORMAT_H_MM_SS_XX = 27};
+ TIME_FORMAT_H_MM_SS_XX = 27,
+ TIME_FORMAT_SECS = 32,
+ TIME_FORMAT_MINS = 64,
+ TIME_FORMAT_HOURS = 128 };
class CDateTime;
diff --git a/xbmc/guiinfo/CMakeLists.txt b/xbmc/guiinfo/CMakeLists.txt
index 4c01446be3..b52dbe9f71 100644
--- a/xbmc/guiinfo/CMakeLists.txt
+++ b/xbmc/guiinfo/CMakeLists.txt
@@ -1,4 +1,5 @@
-set(HEADERS GUIInfoLabels.h)
+set(HEADERS GUIInfo.h
+ GUIInfoLabels.h)
if(NOT ENABLE_STATIC_LIBS)
core_add_library(guiinfo)
diff --git a/xbmc/guiinfo/GUIInfo.h b/xbmc/guiinfo/GUIInfo.h
new file mode 100644
index 0000000000..d7d0ac8a28
--- /dev/null
+++ b/xbmc/guiinfo/GUIInfo.h
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 2005-2013 Team XBMC
+ * http://kodi.tv
+ *
+ * This Program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This Program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with XBMC; see the file COPYING. If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ */
+#pragma once
+
+// structure to hold multiple integer data
+// for storage referenced from a single integer
+class GUIInfo
+{
+public:
+ GUIInfo(int info, uint32_t data1 = 0, int data2 = 0, uint32_t flag = 0)
+ {
+ m_info = info;
+ m_data1 = data1;
+ m_data2 = data2;
+ if (flag)
+ SetInfoFlag(flag);
+ }
+ bool operator ==(const GUIInfo &right) const
+ {
+ return (m_info == right.m_info && m_data1 == right.m_data1 && m_data2 == right.m_data2);
+ };
+ uint32_t GetInfoFlag() const;
+ uint32_t GetData1() const;
+ int GetData2() const;
+ int m_info;
+private:
+ void SetInfoFlag(uint32_t flag);
+ uint32_t m_data1;
+ int m_data2;
+};
diff --git a/xbmc/guiinfo/GUIInfoLabels.h b/xbmc/guiinfo/GUIInfoLabels.h
index d0ec637a07..24eaea41ea 100644
--- a/xbmc/guiinfo/GUIInfoLabels.h
+++ b/xbmc/guiinfo/GUIInfoLabels.h
@@ -822,7 +822,7 @@
//! @todo There are issues with the LISTITEM_PROPERTY range, breakage occurs when more than 200 properties are used in skins.
#define LISTITEM_PROPERTY_START (LISTITEM_START + 200)
-#define LISTITEM_PROPERTY_END (LISTITEM_PROPERTY_START + 2300)
+#define LISTITEM_PROPERTY_END (LISTITEM_PROPERTY_START + 2500)
#define LISTITEM_END (LISTITEM_PROPERTY_END)
#define MUSICPLAYER_PROPERTY_OFFSET 1300 // 200 id's reserved for musicplayer props.
@@ -830,8 +830,9 @@
#define LISTITEM_RATING_OFFSET 1700 // 200 id's reserved for listitem ratings.
#define LISTITEM_VOTES_OFFSET 1900 // 200 id's reserved for listitem votes.
#define LISTITEM_RATING_AND_VOTES_OFFSET 2100 // 200 id's reserved for listitem ratingandvotes.
+#define LISTITEM_DURATION_OFFSET 2300 // 200 id's reserved for listitem duration.
-#define CONDITIONAL_LABEL_START LISTITEM_END + 1 // 37501
+#define CONDITIONAL_LABEL_START LISTITEM_END + 1 // 37701
#define CONDITIONAL_LABEL_END 38500
// the multiple information vector
diff --git a/xbmc/pvr/PVRGUIChannelNavigator.cpp b/xbmc/pvr/PVRGUIChannelNavigator.cpp
index a08eaf966c..fbd8cdd403 100644
--- a/xbmc/pvr/PVRGUIChannelNavigator.cpp
+++ b/xbmc/pvr/PVRGUIChannelNavigator.cpp
@@ -179,10 +179,12 @@ namespace PVR
m_iChannelInfoJobId = -1;
}
- m_currentChannel = m_playingChannel;
-
- if (m_currentChannel)
- item.reset(new CFileItem(m_playingChannel));
+ if (m_currentChannel != m_playingChannel)
+ {
+ m_currentChannel = m_playingChannel;
+ if (m_playingChannel)
+ item.reset(new CFileItem(m_playingChannel));
+ }
}
if (item)
@@ -206,9 +208,12 @@ namespace PVR
CSingleLock lock(m_critSection);
m_playingChannel = channel;
- m_currentChannel = m_playingChannel;
-
- item.reset(new CFileItem(m_playingChannel));
+ if (m_currentChannel != m_playingChannel)
+ {
+ m_currentChannel = m_playingChannel;
+ if (m_playingChannel)
+ item.reset(new CFileItem(m_playingChannel));
+ }
}
if (item)
diff --git a/xbmc/pvr/PVRGUIInfo.cpp b/xbmc/pvr/PVRGUIInfo.cpp
index fad14fe027..eacb089e4f 100644
--- a/xbmc/pvr/PVRGUIInfo.cpp
+++ b/xbmc/pvr/PVRGUIInfo.cpp
@@ -26,6 +26,7 @@
#include "Application.h"
#include "ServiceBroker.h"
#include "cores/DataCacheCore.h"
+#include "guiinfo/GUIInfo.h"
#include "guiinfo/GUIInfoLabels.h"
#include "guilib/LocalizeStrings.h"
#include "settings/AdvancedSettings.h"
@@ -90,9 +91,6 @@ void CPVRGUIInfo::ResetProperties(void)
m_iTimeshiftEndTime = time_t(0);
m_iTimeshiftPlayTime = time_t(0);
m_iTimeshiftOffset = 0;
- m_strTimeshiftStartTime.clear();
- m_strTimeshiftEndTime.clear();
- m_strTimeshiftPlayTime.clear();
ResetPlayingTag();
ClearQualityInfo(m_qualityInfo);
@@ -264,9 +262,6 @@ void CPVRGUIInfo::UpdateTimeshift(void)
m_iTimeshiftPlayTime = 0;
m_iLastTimeshiftUpdate = 0;
m_iTimeshiftOffset = 0;
- m_strTimeshiftStartTime.clear();
- m_strTimeshiftEndTime.clear();
- m_strTimeshiftPlayTime.clear();
}
return;
}
@@ -309,20 +304,10 @@ void CPVRGUIInfo::UpdateTimeshift(void)
m_iTimeshiftOffset = now - m_iTimeshiftPlayTime;
- CDateTime tmp;
- tmp.SetFromUTCDateTime(m_iTimeshiftStartTime);
- m_strTimeshiftStartTime = tmp.GetAsLocalizedTime("", false);
-
- tmp.SetFromUTCDateTime(m_iTimeshiftEndTime);
- m_strTimeshiftEndTime = tmp.GetAsLocalizedTime("", false);
-
- tmp.SetFromUTCDateTime(m_iTimeshiftPlayTime);
- m_strTimeshiftPlayTime = tmp.GetAsLocalizedTime("", true);
-
m_bHasTimeshiftData = true;
}
-bool CPVRGUIInfo::TranslateCharInfo(DWORD dwInfo, std::string &strValue) const
+bool CPVRGUIInfo::TranslateCharInfo(const CFileItem *item, DWORD dwInfo, std::string &strValue) const
{
bool bReturn(true);
CSingleLock lock(m_critSection);
@@ -401,18 +386,6 @@ bool CPVRGUIInfo::TranslateCharInfo(DWORD dwInfo, std::string &strValue) const
case PVR_RADIO_NEXT_RECORDING_DATETIME:
m_radioTimersInfo.CharInfoNextTimerDateTime(strValue);
break;
- case PVR_EPG_EVENT_DURATION:
- CharInfoEpgEventDuration(strValue);
- break;
- case PVR_EPG_EVENT_ELAPSED_TIME:
- CharInfoEpgEventElapsedTime(strValue);
- break;
- case PVR_EPG_EVENT_REMAINING_TIME:
- CharInfoEpgEventRemainingTime(strValue);
- break;
- case PVR_EPG_EVENT_FINISH_TIME:
- CharInfoEpgEventFinishTime(strValue);
- break;
case PVR_NEXT_TIMER:
m_anyTimersInfo.CharInfoNextTimer(strValue);
break;
@@ -479,18 +452,6 @@ bool CPVRGUIInfo::TranslateCharInfo(DWORD dwInfo, std::string &strValue) const
case PVR_TOTAL_DISKSPACE:
CharInfoTotalDiskSpace(strValue);
break;
- case PVR_TIMESHIFT_START_TIME:
- CharInfoTimeshiftStartTime(strValue);
- break;
- case PVR_TIMESHIFT_END_TIME:
- CharInfoTimeshiftEndTime(strValue);
- break;
- case PVR_TIMESHIFT_PLAY_TIME:
- CharInfoTimeshiftPlayTime(strValue);
- break;
- case PVR_TIMESHIFT_OFFSET:
- CharInfoTimeshiftOffset(strValue);
- break;
default:
strValue.clear();
bReturn = false;
@@ -571,25 +532,24 @@ bool CPVRGUIInfo::TranslateBoolInfo(DWORD dwInfo) const
return bReturn;
}
-int CPVRGUIInfo::TranslateIntInfo(const CFileItem &item, DWORD dwInfo) const
+int CPVRGUIInfo::TranslateIntInfo(const CFileItem *item, DWORD dwInfo) const
{
int iReturn(0);
CSingleLock lock(m_critSection);
if (dwInfo == PVR_EPG_EVENT_PROGRESS)
{
- CPVREpgInfoTagPtr epgTag;
- const CPVRChannelPtr channel = item.GetPVRChannelInfoTag();
- if (channel)
- epgTag = channel->GetEPGNow();
- if (!epgTag)
- epgTag = item.GetEPGInfoTag();
-
- if (epgTag && epgTag != GetPlayingTag())
+ CPVREpgInfoTagPtr epgTag = CPVRItem(item).GetEpgInfoTag();
+ if (epgTag && epgTag != m_playingEpgTag)
iReturn = std::lrintf(epgTag->ProgressPercentage());
else
iReturn = std::lrintf(static_cast<float>(GetElapsedTime()) / m_iDuration * 100);
}
+ else if (dwInfo == PVR_TIMESHIFT_PROGRESS)
+ {
+ iReturn = std::lrintf(static_cast<float>(m_iTimeshiftPlayTime - m_iTimeshiftStartTime) /
+ (m_iTimeshiftEndTime - m_iTimeshiftStartTime) * 100);
+ }
else if (dwInfo == PVR_ACTUAL_STREAM_SIG_PROGR)
iReturn = (int) ((float) m_qualityInfo.iSignal / 0xFFFF * 100);
else if (dwInfo == PVR_ACTUAL_STREAM_SNR_PROGR)
@@ -601,11 +561,6 @@ int CPVRGUIInfo::TranslateIntInfo(const CFileItem &item, DWORD dwInfo) const
else
iReturn = 0xFF;
}
- else if (dwInfo == PVR_TIMESHIFT_PROGRESS)
- {
- iReturn = std::lrintf(static_cast<float>(m_iTimeshiftPlayTime - m_iTimeshiftStartTime) /
- (m_iTimeshiftEndTime - m_iTimeshiftStartTime) * 100);
- }
return iReturn;
}
@@ -654,6 +609,7 @@ bool CPVRGUIInfo::GetVideoLabel(const CFileItem *item, int iLabel, std::string &
}
case VIDEOPLAYER_CHANNEL_GROUP:
{
+ CSingleLock lock(m_critSection);
strValue = recording->IsRadio() ? m_strPlayingRadioGroup : m_strPlayingTVGroup;
return true;
}
@@ -827,6 +783,7 @@ bool CPVRGUIInfo::GetVideoLabel(const CFileItem *item, int iLabel, std::string &
}
case VIDEOPLAYER_CHANNEL_GROUP:
{
+ CSingleLock lock(m_critSection);
strValue = channel->IsRadio() ? m_strPlayingRadioGroup : m_strPlayingTVGroup;
return true;
}
@@ -853,52 +810,134 @@ bool CPVRGUIInfo::GetVideoLabel(const CFileItem *item, int iLabel, std::string &
return false;
}
-bool CPVRGUIInfo::GetSeekTimeLabel(int iSeekSize, std::string &strValue) const
+bool CPVRGUIInfo::GetMultiInfoLabel(const CFileItem *item, const GUIInfo &info, std::string &strValue) const
{
- strValue = StringUtils::SecondsToTimeString(GetElapsedTime() + iSeekSize, TIME_FORMAT_GUESS).c_str();
+ CSingleLock lock(m_critSection);
+
+ switch (info.m_info)
+ {
+ case PVR_EPG_EVENT_DURATION:
+ CharInfoEpgEventDuration(item, static_cast<TIME_FORMAT>(info.GetData1()), strValue);
+ break;
+ case PVR_EPG_EVENT_ELAPSED_TIME:
+ CharInfoEpgEventElapsedTime(item, static_cast<TIME_FORMAT>(info.GetData1()), strValue);
+ break;
+ case PVR_EPG_EVENT_REMAINING_TIME:
+ CharInfoEpgEventRemainingTime(item, static_cast<TIME_FORMAT>(info.GetData1()), strValue);
+ break;
+ case PVR_EPG_EVENT_FINISH_TIME:
+ CharInfoEpgEventFinishTime(item, static_cast<TIME_FORMAT>(info.GetData1()), strValue);
+ break;
+ case PVR_TIMESHIFT_START_TIME:
+ CharInfoTimeshiftStartTime(static_cast<TIME_FORMAT>(info.GetData1()), strValue);
+ break;
+ case PVR_TIMESHIFT_END_TIME:
+ CharInfoTimeshiftEndTime(static_cast<TIME_FORMAT>(info.GetData1()), strValue);
+ break;
+ case PVR_TIMESHIFT_PLAY_TIME:
+ CharInfoTimeshiftPlayTime(static_cast<TIME_FORMAT>(info.GetData1()), strValue);
+ break;
+ case PVR_TIMESHIFT_OFFSET:
+ CharInfoTimeshiftOffset(static_cast<TIME_FORMAT>(info.GetData1()), strValue);
+ break;
+ default:
+ return false;
+ }
return true;
}
-void CPVRGUIInfo::CharInfoEpgEventDuration(std::string &strValue) const
+bool CPVRGUIInfo::GetSeekTimeLabel(int iSeekSize, TIME_FORMAT format, std::string &strValue) const
+{
+ CSingleLock lock(m_critSection);
+ strValue = StringUtils::SecondsToTimeString(GetElapsedTime() + iSeekSize, format).c_str();
+ return true;
+}
+
+namespace
+{
+ int TimeFromDateTime(time_t datetime)
+ {
+ CDateTime time;
+ time.SetFromUTCDateTime(datetime);
+ return time.GetHour() * 60 * 60 + time.GetMinute() * 60 + time.GetSecond();
+ }
+} // unnamed namespace
+
+void CPVRGUIInfo::CharInfoTimeshiftStartTime(TIME_FORMAT format, std::string &strValue) const
+{
+ if (format == TIME_FORMAT_GUESS)
+ format = TIME_FORMAT_HH_MM;
+
+ strValue = StringUtils::SecondsToTimeString(TimeFromDateTime(m_iTimeshiftStartTime), format).c_str();
+}
+
+void CPVRGUIInfo::CharInfoTimeshiftEndTime(TIME_FORMAT format, std::string &strValue) const
{
- strValue = StringUtils::SecondsToTimeString(m_iDuration, TIME_FORMAT_GUESS).c_str();
+ if (format == TIME_FORMAT_GUESS)
+ format = TIME_FORMAT_HH_MM;
+
+ strValue = StringUtils::SecondsToTimeString(TimeFromDateTime(m_iTimeshiftEndTime), format).c_str();
}
-void CPVRGUIInfo::CharInfoTimeshiftStartTime(std::string &strValue) const
+void CPVRGUIInfo::CharInfoTimeshiftPlayTime(TIME_FORMAT format, std::string &strValue) const
{
- strValue = m_strTimeshiftStartTime;
+ strValue = StringUtils::SecondsToTimeString(TimeFromDateTime(m_iTimeshiftPlayTime), format).c_str();
}
-void CPVRGUIInfo::CharInfoTimeshiftEndTime(std::string &strValue) const
+void CPVRGUIInfo::CharInfoTimeshiftOffset(TIME_FORMAT format, std::string &strValue) const
{
- strValue = m_strTimeshiftEndTime;
+ strValue = StringUtils::SecondsToTimeString(m_iTimeshiftOffset, format).c_str();
}
-void CPVRGUIInfo::CharInfoTimeshiftPlayTime(std::string &strValue) const
+void CPVRGUIInfo::CharInfoEpgEventDuration(const CFileItem *item, TIME_FORMAT format, std::string &strValue) const
{
- strValue = m_strTimeshiftPlayTime;
+ int iDuration = 0;
+ CPVREpgInfoTagPtr epgTag = CPVRItem(item).GetEpgInfoTag();
+ if (epgTag && epgTag != m_playingEpgTag)
+ iDuration = epgTag->GetDuration();
+ else
+ iDuration = m_iDuration;
+
+ strValue = StringUtils::SecondsToTimeString(iDuration, format).c_str();
}
-void CPVRGUIInfo::CharInfoTimeshiftOffset(std::string &strValue) const
+void CPVRGUIInfo::CharInfoEpgEventElapsedTime(const CFileItem *item, TIME_FORMAT format, std::string &strValue) const
{
- strValue = StringUtils::SecondsToTimeString(m_iTimeshiftOffset, TIME_FORMAT_GUESS).c_str();
+ int iElapsed = 0;
+ CPVREpgInfoTagPtr epgTag = CPVRItem(item).GetEpgInfoTag();
+ if (epgTag && epgTag != m_playingEpgTag)
+ iElapsed = epgTag->Progress();
+ else
+ iElapsed = GetElapsedTime();
+
+ strValue = StringUtils::SecondsToTimeString(iElapsed, format).c_str();
}
-void CPVRGUIInfo::CharInfoEpgEventElapsedTime(std::string &strValue) const
+int CPVRGUIInfo::GetRemainingTime(const CFileItem *item) const
{
- strValue = StringUtils::SecondsToTimeString(GetElapsedTime(), TIME_FORMAT_GUESS).c_str();
+ int iRemaining = 0;
+ CPVREpgInfoTagPtr epgTag = CPVRItem(item).GetEpgInfoTag();
+ if (epgTag && epgTag != m_playingEpgTag)
+ iRemaining = epgTag->GetDuration() - epgTag->Progress();
+ else
+ iRemaining = m_iDuration - GetElapsedTime();
+
+ return iRemaining;
}
-void CPVRGUIInfo::CharInfoEpgEventRemainingTime(std::string &strValue) const
+void CPVRGUIInfo::CharInfoEpgEventRemainingTime(const CFileItem *item, TIME_FORMAT format, std::string &strValue) const
{
- strValue = StringUtils::SecondsToTimeString(m_iDuration - GetElapsedTime(), TIME_FORMAT_GUESS).c_str();
+ strValue = StringUtils::SecondsToTimeString(GetRemainingTime(item), format).c_str();
}
-void CPVRGUIInfo::CharInfoEpgEventFinishTime(std::string &strValue) const
+void CPVRGUIInfo::CharInfoEpgEventFinishTime(const CFileItem *item, TIME_FORMAT format, std::string &strValue) const
{
- CDateTime finishTime = CDateTime::GetCurrentDateTime();
- finishTime += CDateTimeSpan(0, 0, 0, m_iDuration - GetElapsedTime());
- strValue = finishTime.GetAsLocalizedTime("", false);
+ if (format == TIME_FORMAT_GUESS)
+ format = TIME_FORMAT_HH_MM;
+
+ CDateTime finish = CDateTime::GetCurrentDateTime();
+ finish += CDateTimeSpan(0, 0, 0, GetRemainingTime(item));
+ strValue = StringUtils::SecondsToTimeString(finish.GetHour() * 60 * 60 + finish.GetMinute() * 60 + finish.GetSecond(), format).c_str();
}
void CPVRGUIInfo::CharInfoBackendNumber(std::string &strValue) const
diff --git a/xbmc/pvr/PVRGUIInfo.h b/xbmc/pvr/PVRGUIInfo.h
index ab8e7ff53d..2f6213346c 100644
--- a/xbmc/pvr/PVRGUIInfo.h
+++ b/xbmc/pvr/PVRGUIInfo.h
@@ -31,6 +31,8 @@
#include "pvr/PVRTypes.h"
#include "pvr/addons/PVRClients.h"
+class GUIInfo;
+
namespace PVR
{
class CPVRGUIInfo : private CThread,
@@ -46,8 +48,8 @@ namespace PVR
void Notify(const Observable &obs, const ObservableMessage msg) override;
bool TranslateBoolInfo(DWORD dwInfo) const;
- bool TranslateCharInfo(DWORD dwInfo, std::string &strValue) const;
- int TranslateIntInfo(const CFileItem &item, DWORD dwInfo) const;
+ bool TranslateCharInfo(const CFileItem *item, DWORD dwInfo, std::string &strValue) const;
+ int TranslateIntInfo(const CFileItem *item, DWORD dwInfo) const;
/*!
* @brief Get a GUIInfoManager video label.
@@ -59,12 +61,22 @@ namespace PVR
bool GetVideoLabel(const CFileItem *item, int iLabel, std::string &strValue) const;
/*!
+ * @brief Get a GUIInfoManager multi info label.
+ * @param item The item to get the label for.
+ * @param info The GUI info (label id + additional data).
+ * @param strValue Will be filled with the requested label value.
+ * @return True if the requested label value was set, false otherwise.
+ */
+ bool GetMultiInfoLabel(const CFileItem *item, const GUIInfo &info, std::string &strValue) const;
+
+ /*!
* @brief Get a GUIInfoManager seek time label for the currently playing epg tag.
* @param iSeekSize The seconds to be seeked from the current playback position.
+ * @param format The time format for the label.
* @param strValue Will be filled with the requested label value.
* @return True if the label value was set, false otherwise.
*/
- bool GetSeekTimeLabel(int iSeekSize, std::string &strValue) const;
+ bool GetSeekTimeLabel(int iSeekSize, TIME_FORMAT format, std::string &strValue) const;
/*!
* @brief Get the total duration of the currently playing epg event or if no epg is
@@ -198,10 +210,10 @@ namespace PVR
void UpdateTimersToggle(void);
- void CharInfoEpgEventDuration(std::string &strValue) const;
- void CharInfoEpgEventElapsedTime(std::string &strValue) const;
- void CharInfoEpgEventRemainingTime(std::string &strValue) const;
- void CharInfoEpgEventFinishTime(std::string &strValue) const;
+ void CharInfoEpgEventDuration(const CFileItem *item, TIME_FORMAT format, std::string &strValue) const;
+ void CharInfoEpgEventElapsedTime(const CFileItem *item, TIME_FORMAT format, std::string &strValue) const;
+ void CharInfoEpgEventRemainingTime(const CFileItem *item, TIME_FORMAT format, std::string &strValue) const;
+ void CharInfoEpgEventFinishTime(const CFileItem *item, TIME_FORMAT format, std::string &strValue) const;
void CharInfoBackendNumber(std::string &strValue) const;
void CharInfoTotalDiskSpace(std::string &strValue) const;
void CharInfoSignal(std::string &strValue) const;
@@ -223,10 +235,12 @@ namespace PVR
void CharInfoService(std::string &strValue) const;
void CharInfoMux(std::string &strValue) const;
void CharInfoProvider(std::string &strValue) const;
- void CharInfoTimeshiftStartTime(std::string &strValue) const;
- void CharInfoTimeshiftEndTime(std::string &strValue) const;
- void CharInfoTimeshiftPlayTime(std::string &strValue) const;
- void CharInfoTimeshiftOffset(std::string &strValue) const;
+ void CharInfoTimeshiftStartTime(TIME_FORMAT format, std::string &strValue) const;
+ void CharInfoTimeshiftEndTime(TIME_FORMAT format, std::string &strValue) const;
+ void CharInfoTimeshiftPlayTime(TIME_FORMAT format, std::string &strValue) const;
+ void CharInfoTimeshiftOffset(TIME_FORMAT format, std::string &strValue) const;
+
+ int GetRemainingTime(const CFileItem *item) const;
/** @name GUIInfoManager data */
//@{
@@ -275,9 +289,6 @@ namespace PVR
time_t m_iTimeshiftEndTime;
time_t m_iTimeshiftPlayTime;
unsigned int m_iTimeshiftOffset;
- std::string m_strTimeshiftStartTime;
- std::string m_strTimeshiftEndTime;
- std::string m_strTimeshiftPlayTime;
CCriticalSection m_critSection;
diff --git a/xbmc/pvr/PVRManager.cpp b/xbmc/pvr/PVRManager.cpp
index 0125843d30..32f13df9d7 100644
--- a/xbmc/pvr/PVRManager.cpp
+++ b/xbmc/pvr/PVRManager.cpp
@@ -814,12 +814,12 @@ bool CPVRManager::TranslateBoolInfo(DWORD dwInfo) const
return IsStarted() && m_guiInfo ? m_guiInfo->TranslateBoolInfo(dwInfo) : false;
}
-bool CPVRManager::TranslateCharInfo(DWORD dwInfo, std::string &strValue) const
+bool CPVRManager::TranslateCharInfo(const CFileItem *item, DWORD dwInfo, std::string &strValue) const
{
- return IsStarted() && m_guiInfo ? m_guiInfo->TranslateCharInfo(dwInfo, strValue) : false;
+ return IsStarted() && m_guiInfo ? m_guiInfo->TranslateCharInfo(item, dwInfo, strValue) : false;
}
-int CPVRManager::TranslateIntInfo(const CFileItem &item, DWORD dwInfo) const
+int CPVRManager::TranslateIntInfo(const CFileItem *item, DWORD dwInfo) const
{
return IsStarted() && m_guiInfo ? m_guiInfo->TranslateIntInfo(item, dwInfo) : 0;
}
@@ -829,9 +829,14 @@ bool CPVRManager::GetVideoLabel(const CFileItem *item, int iLabel, std::string &
return IsStarted() && m_guiInfo ? m_guiInfo->GetVideoLabel(item, iLabel, strValue) : false;
}
-bool CPVRManager::GetSeekTimeLabel(int iSeekSize, std::string &strValue) const
+bool CPVRManager::GetMultiInfoLabel(const CFileItem *item, const GUIInfo &info, std::string &strValue) const
{
- return IsStarted() && m_guiInfo ? m_guiInfo->GetSeekTimeLabel(iSeekSize, strValue) : false;
+ return IsStarted() && m_guiInfo ? m_guiInfo->GetMultiInfoLabel(item, info, strValue) : false;
+}
+
+bool CPVRManager::GetSeekTimeLabel(int iSeekSize, TIME_FORMAT format, std::string &strValue) const
+{
+ return IsStarted() && m_guiInfo ? m_guiInfo->GetSeekTimeLabel(iSeekSize, format, strValue) : false;
}
bool CPVRManager::IsRecording(void) const
diff --git a/xbmc/pvr/PVRManager.h b/xbmc/pvr/PVRManager.h
index 3ff9cf8cea..3b24923d62 100644
--- a/xbmc/pvr/PVRManager.h
+++ b/xbmc/pvr/PVRManager.h
@@ -42,6 +42,7 @@
class CStopWatch;
class CVariant;
+class GUIInfo;
namespace PVR
{
@@ -163,10 +164,11 @@ namespace PVR
/*!
* @brief Get a GUIInfoManager character string.
+ * @param item The item to get the value for.
* @param dwInfo The string to get.
* @return The requested string or an empty one if it wasn't found.
*/
- bool TranslateCharInfo(DWORD dwInfo, std::string &strValue) const;
+ bool TranslateCharInfo(const CFileItem *item, DWORD dwInfo, std::string &strValue) const;
/*!
* @brief Get a GUIInfoManager integer.
@@ -174,7 +176,7 @@ namespace PVR
* @param dwInfo The integer to get.
* @return The requested integer or 0 if it wasn't found.
*/
- int TranslateIntInfo(const CFileItem &item, DWORD dwInfo) const;
+ int TranslateIntInfo(const CFileItem *item, DWORD dwInfo) const;
/*!
* @brief Get a GUIInfoManager boolean.
@@ -193,12 +195,22 @@ namespace PVR
bool GetVideoLabel(const CFileItem *item, int iLabel, std::string &strValue) const;
/*!
+ * @brief Get a GUIInfoManager multi info label.
+ * @param item The item to get the label for.
+ * @param info The GUI info (label id + additional data).
+ * @param strValue Will be filled with the requested label value.
+ * @return True if the requested label value was set, false otherwise.
+ */
+ bool GetMultiInfoLabel(const CFileItem *item, const GUIInfo &info, std::string &strValue) const;
+
+ /*!
* @brief Get a GUIInfoManager seek time label for the currently playing epg tag.
* @param iSeekSize The seconds to be seeked from the current playback position.
+ * @param format The time format for the label.
* @param strValue Will be filled with the requested label value.
* @return True if the label value was set, false otherwise.
*/
- bool GetSeekTimeLabel(int iSeekSize, std::string &strValue) const;
+ bool GetSeekTimeLabel(int iSeekSize, TIME_FORMAT format, std::string &strValue) const;
/*!
* @brief Check if a TV channel, radio channel or recording is playing.
diff --git a/xbmc/utils/StringUtils.cpp b/xbmc/utils/StringUtils.cpp
index fc4752d420..11cfcfcc30 100644
--- a/xbmc/utils/StringUtils.cpp
+++ b/xbmc/utils/StringUtils.cpp
@@ -865,26 +865,35 @@ long StringUtils::TimeStringToSeconds(const std::string &timeString)
std::string StringUtils::SecondsToTimeString(long lSeconds, TIME_FORMAT format)
{
- bool isNegative = lSeconds < 0;
- lSeconds = std::abs(lSeconds);
- int hh = lSeconds / 3600;
- lSeconds = lSeconds % 3600;
- int mm = lSeconds / 60;
- int ss = lSeconds % 60;
-
- if (format == TIME_FORMAT_GUESS)
- format = (hh >= 1) ? TIME_FORMAT_HH_MM_SS : TIME_FORMAT_MM_SS;
std::string strHMS;
- if (format & TIME_FORMAT_HH)
- strHMS += StringUtils::Format("%2.2i", hh);
- else if (format & TIME_FORMAT_H)
- strHMS += StringUtils::Format("%i", hh);
- if (format & TIME_FORMAT_MM)
- strHMS += StringUtils::Format(strHMS.empty() ? "%2.2i" : ":%2.2i", mm);
- if (format & TIME_FORMAT_SS)
- strHMS += StringUtils::Format(strHMS.empty() ? "%2.2i" : ":%2.2i", ss);
- if (isNegative)
- strHMS = "-" + strHMS;
+ if (format == TIME_FORMAT_SECS)
+ strHMS = StringUtils::Format("%i", lSeconds);
+ else if (format == TIME_FORMAT_MINS)
+ strHMS = StringUtils::Format("%i", lrintf(static_cast<float>(lSeconds) / 60.0f));
+ else if (format == TIME_FORMAT_HOURS)
+ strHMS = StringUtils::Format("%i", lrintf(static_cast<float>(lSeconds) / 3600.0f));
+ else
+ {
+ bool isNegative = lSeconds < 0;
+ lSeconds = std::abs(lSeconds);
+ int hh = lSeconds / 3600;
+ lSeconds = lSeconds % 3600;
+ int mm = lSeconds / 60;
+ int ss = lSeconds % 60;
+
+ if (format == TIME_FORMAT_GUESS)
+ format = (hh >= 1) ? TIME_FORMAT_HH_MM_SS : TIME_FORMAT_MM_SS;
+ if (format & TIME_FORMAT_HH)
+ strHMS += StringUtils::Format("%2.2i", hh);
+ else if (format & TIME_FORMAT_H)
+ strHMS += StringUtils::Format("%i", hh);
+ if (format & TIME_FORMAT_MM)
+ strHMS += StringUtils::Format(strHMS.empty() ? "%2.2i" : ":%2.2i", mm);
+ if (format & TIME_FORMAT_SS)
+ strHMS += StringUtils::Format(strHMS.empty() ? "%2.2i" : ":%2.2i", ss);
+ if (isNegative)
+ strHMS = "-" + strHMS;
+ }
return strHMS;
}