INTERACT FORUM

Windows => JRiver Media Center 33 for Windows => Topic started by: smart on January 02, 2025, 07:15:03 pm

Title: Next Track Time function
Post by: smart on January 02, 2025, 07:15:03 pm
Next Track Time function, please add
(https://i124.fastpic.org/big/2025/0103/4d/4a311f326b3784d05173658dee6f374d.jpg)
Title: Re: Next Track Time function
Post by: zybex on January 05, 2025, 07:48:47 am
This can be done with PlaylistTime() function:
https://wiki.jriver.com/index.php/Date_and_Time_Functions#PlaylistTime
https://yabb.jriver.com/interact/index.php/topic,129172.msg896419.html#msg896419
https://yabb.jriver.com/interact/index.php/topic,133477.0.html
Title: Re: Next Track Time function
Post by: smart on January 05, 2025, 08:58:23 pm
not added
formatdate(math(PlaylistTime(0,0) + replace(now(), /,, .)), H:mm:s)
Title: Re: Next Track Time function
Post by: zybex 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().
Title: Re: Next Track Time function
Post by: zybex 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.
Title: Re: Next Track Time function
Post by: smart on January 06, 2025, 05:23:35 am
A Feature request is needed, perhaps a new mode for PlaylistTime().
Yes, you're right
Title: Re: Next Track Time function
Post by: smart on January 06, 2025, 05:39:08 am
maybe

PlaylistTime + fix (record) the first track start time
Title: Re: Next Track Time function
Post by: Matt 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.
Title: Re: Next Track Time function
Post by: zybex 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.
Title: Re: Next Track Time function
Post by: smart 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()
Title: Re: Next Track Time function
Post by: markf2748 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.
Title: Re: Next Track Time function
Post by: smart on January 15, 2025, 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
Title: Re: Next Track Time function
Post by: smart on February 10, 2025, 04:28:03 am
Hello, is the solution still not found?