Is it possible to add two time values? (1 Viewer)

123vak123

Portal Pro
December 13, 2010
207
161
Minsk
Home Country
Belarus Belarus
In most skins in 'videoFullScreen.xml' and 'videoOSD.xml' #duration tag displays information about the duration of the video. But I would like to display information about the end time of the video. For this it is necessary to add two time values: the current time (#time) and the remaining playback time (#currentremaining). Can I do this in MediaPortal?

I read the page in WiKi (Skin Logic Expressions) about the function date.add. But there are no specific examples and my knowledge is not enough to realize what I want.
 

123vak123

Portal Pro
December 13, 2010
207
161
Minsk
Home Country
Belarus Belarus
Thank you. Unfortunately, it did not help

08-15-21.png
 

ajs

Development Group
  • Team MediaPortal
  • February 29, 2008
    15,492
    10,369
    Kyiv
    Home Country
    Ukraine Ukraine
    Hmmmm... try:
    #(date.add('h',date.extract('h',cdate(#currentremaining)),cdate(#time)))
    if work jast add minutes an seconds :)
    Like:
    #(date.add('m',date.extract('m',cdate(#currentremaining)),date.add('s',date.extract('s',cdate(#currentremaining)),date.add('h',date.extract('h',cdate(#currentremaining)),cdate(#time)))))
    Check brackets and wiki for minutes and seconds
    --
    WBR, ajs
     
    Last edited:

    ajs

    Development Group
  • Team MediaPortal
  • February 29, 2008
    15,492
    10,369
    Kyiv
    Home Country
    Ukraine Ukraine
    If not work, then need add new Skin function like:
    ctimestamp() - convert string time to timestamp

    And usage like: #(string.format('HH:mm:ss',date.add(cdate(#time), ctimestamp(#currentremaining))))


    --
    WBR, ajs
     

    123vak123

    Portal Pro
    December 13, 2010
    207
    161
    Minsk
    Home Country
    Belarus Belarus
    "#(date.add('n',date.extract('n',cdate(#currentremaining)),date.add('s',date.extract('s',cdate(#currentremaining)),date.add('h',date.extract('h',cdate(#currentremaining)),cdate(#time)))))" - works only if the number of hours is more than 1. If hours is less than 1, then "date.extract('h',cdate(#currentremaining))" returns minutes, "date.extract('n',cdate(#currentremaining))" - seconds, "date.extract('s',cdate(#currentremaining))" - 0 (error ?) :)

    If hours is less than 1:
    #(date.add('n',date.extract('h',cdate(#currentremaining)), date.add('h',date.extract('s',cdate(#currentremaining)),cdate(#time))))) - work fine
     

    Attachments

    • 11-49-46.png
      11-49-46.png
      1.2 MB

    ajs

    Development Group
  • Team MediaPortal
  • February 29, 2008
    15,492
    10,369
    Kyiv
    Home Country
    Ukraine Ukraine
    otherwise I do not know how to do this with the current functions. Is it possible to analyze the hour or not with #iif or #switch
    See wiki for logic Function and date function... ;)

    --
    WBR, ajs
     

    ajs

    Development Group
  • Team MediaPortal
  • February 29, 2008
    15,492
    10,369
    Kyiv
    Home Country
    Ukraine Ukraine
    Added:
    Code:
    ctimespan(value)
    Convert value to ctimespan. If value is not a valid ctimespan, reutrns an error.
     

    Users who are viewing this thread

    Top Bottom