INTERACT FORUM

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1]   Go Down

Author Topic: Next Track Time function  (Read 524 times)

smart

  • Recent member
  • *
  • Posts: 27
Next Track Time function
« on: January 02, 2025, 07:15:03 pm »

Next Track Time function, please add
Logged

smart

  • Recent member
  • *
  • Posts: 27
Re: Next Track Time function
« Reply #2 on: January 05, 2025, 08:58:23 pm »

not added
formatdate(math(PlaylistTime(0,0) + replace(now(), /,, .)), H:mm:s)
Logged

zybex

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 2720
Re: Next Track Time function
« Reply #3 on: January 06, 2025, 03:20:22 am »

That's because Now() and FormatDate() work with "number of days since 1900", but PlaylistTime() returns values in milliseconds. A conversion is needed:

formatdate(math(PlaylistTime(0,0)/86400000 + replace(now(), /,, .)), HH:mm:ss)

This however doesn't really work well as the timestamps keep advancing while the current track is playing. This is because PlaylistTime() doesn't take into consideration the current track elapsed time. A Feature request is needed, perhaps a new mode for PlaylistTime().
Logged

zybex

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 2720
Re: Next Track Time function
« Reply #4 on: January 06, 2025, 03:27:23 am »

@Matt

It looks like a new PlaylistTime() mode is needed to estimate a track start time on a playlist. This needs to take into consideration the current playback position on the current track.

I see 2 ways to do this:

1. Add a mode 5 that returns the current position (total elapsed time) on the playlist. This would be the sum of all previous playlist entries, plus the current track play position.

2. Add a mode 5 (or 6) that returns the track start time relative to the current play position. This would be negative for all tracks up to (and including) the currently playing track, and positive for the subsequent tracks.

I also added a couple of related feature requests.
Logged

smart

  • Recent member
  • *
  • Posts: 27
Re: Next Track Time function
« Reply #5 on: January 06, 2025, 05:23:35 am »

A Feature request is needed, perhaps a new mode for PlaylistTime().
Yes, you're right
Logged

smart

  • Recent member
  • *
  • Posts: 27
Re: Next Track Time function
« Reply #6 on: January 06, 2025, 05:39:08 am »

maybe

PlaylistTime + fix (record) the first track start time
Logged

Matt

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 42504
  • Shoes gone again!
Re: Next Track Time function
« Reply #7 on: January 06, 2025, 06:48:36 am »

All we have today is the set of files in the current view and the selected file number. We're not tracking the actual "playback track". This makes adding modes that return the current play position tricky. I sort of think a discrete expression function should be used for that. Thanks.
Logged
Matt Ashland, JRiver Media Center

zybex

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 2720
Re: Next Track Time function
« Reply #8 on: January 06, 2025, 07:29:55 am »

I sort of think a discrete expression function should be used for that.

It won't be possible to calculate the next track starting time without knowing how long the current track still has to play.
Logged

smart

  • Recent member
  • *
  • Posts: 27
Re: Next Track Time function
« Reply #9 on: January 06, 2025, 08:18:21 am »

need a new function
record the playback time of the first track in the playlist

FirstTrackTime() + PlaylistTime()
Logged

markf2748

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 861
Re: Next Track Time function
« Reply #10 on: January 06, 2025, 12:23:12 pm »

need a new function
record the playback time of the first track in the playlist

FirstTrackTime() + PlaylistTime()
Predictions of the future based on FirstTrackTime (or any Start time for that matter) will be inaccurate if playback has been paused and then continued.  You need to calculate estimated times forward from current moment, assuming no interruptions in the future.  That requires durations of the remaining tracks and position (hence remaining time) in currently playing (or paused) track, as zybex succinctly pointed out.  Since MC displays live position in the Playerbar Position Slider, one might think that piece could be made available.  But you also need to know which track is currently playing in order to calculate remaining time of currently playing track (if not available directly from Position Slider) and current position in the Playlist.  Matt suggested a separate function to identify currently playing (or paused  :) ) track, which might be generally useful.  It could then be called internally as well by the function which the OP requested.
Logged

smart

  • Recent member
  • *
  • Posts: 27
Re: Next Track Time function
« Reply #11 on: Yesterday at 09:15:06 am »

You need to calculate estimated times forward from current moment, assuming no interruptions in the future.  That requires durations of the remaining tracks and position (hence remaining time) in currently playing (or paused) track, as zybex succinctly pointed out.
Yes, you're right
Logged
Pages: [1]   Go Up