1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Is it possible to add two time values?

Discussion in 'MediaPortal 1 Skins' started by 123vak123, October 9, 2017.

  1. 123vak123

    123vak123 Portal Pro

    Joined:
    December 13, 2010
    Messages:
    57
    Likes Received:
    6
    Gender:
    Male
    Location:
    Minsk
    Ratings:
    +28 / 1
    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.
     
    • Thank You! Thank You! x 1
  2. Google AdSense Guest Advertisement



    to hide all adverts.
  3. ajs
    • Team MediaPortal

    ajs Development Group

    Joined:
    February 29, 2008
    Messages:
    6,826
    Likes Received:
    1,737
    Gender:
    Male
    Occupation:
    IT
    Location:
    Kyiv
    Ratings:
    +3,254 / 28
    Home Country:
    Ukraine Ukraine
    Show System Specs
    Try:
    #(date.add(cdate(#time), date.add(cdate(#currentremaining),0)))


    --
    WBR, ajs
     
    • Thank You! Thank You! x 1
  4. 123vak123

    123vak123 Portal Pro

    Joined:
    December 13, 2010
    Messages:
    57
    Likes Received:
    6
    Gender:
    Male
    Location:
    Minsk
    Ratings:
    +28 / 1
    Home Country:
    Belarus Belarus
    Thank you. Unfortunately, it did not help

    08-15-21.png
     
    • Thank You! Thank You! x 1
  5. ajs
    • Team MediaPortal

    ajs Development Group

    Joined:
    February 29, 2008
    Messages:
    6,826
    Likes Received:
    1,737
    Gender:
    Male
    Occupation:
    IT
    Location:
    Kyiv
    Ratings:
    +3,254 / 28
    Home Country:
    Ukraine Ukraine
    Show System Specs
    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: October 11, 2017 at 07:54
    • Thank You! Thank You! x 2
  6. ajs
    • Team MediaPortal

    ajs Development Group

    Joined:
    February 29, 2008
    Messages:
    6,826
    Likes Received:
    1,737
    Gender:
    Male
    Occupation:
    IT
    Location:
    Kyiv
    Ratings:
    +3,254 / 28
    Home Country:
    Ukraine Ukraine
    Show System Specs
    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
     
    • Thank You! Thank You! x 1
  7. 123vak123

    123vak123 Portal Pro

    Joined:
    December 13, 2010
    Messages:
    57
    Likes Received:
    6
    Gender:
    Male
    Location:
    Minsk
    Ratings:
    +28 / 1
    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
     

    Attached Files:

    • 11-49-46.png
      11-49-46.png
      File size:
      1.2 MB
      Uploaded:
      Wednesday
      Views:
      14
    • Thank You! Thank You! x 1
  8. 123vak123

    123vak123 Portal Pro

    Joined:
    December 13, 2010
    Messages:
    57
    Likes Received:
    6
    Gender:
    Male
    Location:
    Minsk
    Ratings:
    +28 / 1
    Home Country:
    Belarus Belarus
    Extracting seconds from #currentremaining returns 0, but I can not analyze this zero either as a number or as a string
     
    • Thank You! Thank You! x 1
  9. ajs
    • Team MediaPortal

    ajs Development Group

    Joined:
    February 29, 2008
    Messages:
    6,826
    Likes Received:
    1,737
    Gender:
    Male
    Occupation:
    IT
    Location:
    Kyiv
    Ratings:
    +3,254 / 28
    Home Country:
    Ukraine Ukraine
    Show System Specs
    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
     
    • Thank You! Thank You! x 2
Loading...

Users Viewing Thread (Users: 0, Guests: 0)

  • About The Project

    The vision of the MediaPortal project is to create a free open source media centre application, which supports all advanced media centre functions, and is accessible to all Windows users.

    In reaching this goal we are working every day to make sure our software is one of the best.

             

  • Like Us On Facebook

  • Support MediaPortal!

    The team works very hard to make sure the community is running the best HTPC-software. We give away MediaPortal for free but hosting and software is not for us.

    Care to support our work with a few bucks? We'd really appreciate it!