adding track remaining time.

Posted on
Thu Mar 29, 2018 9:16 pm
philipbasile offline
Posts: 95
Joined: Jan 08, 2015
Location: NJ

adding track remaining time.

I'd like to show the number of seconds remaining on the current track thats playing.
The Sonos source could be amazon music or SiriusXM.
Is there anyway to get the remaining time left on the current track ?

thanks

philip

Posted on
Fri Mar 30, 2018 12:33 pm
Londonmark offline
Posts: 362
Joined: Feb 29, 2012

Re: adding track remaining time.

I managed this in a slightly approximate way with some simple scripts based on the length of the track and a trigger that fired every time a new track started. That updated a variable that was displayed on a control page.

It worked reasonably well if not perfectly but I then disabled it all when I was having some trouble with the status of my players not updating. Disabling didn’t help but I’ve never got round to getting it all working again - and I still have trouble with the statuses not updating!

So summary: it’s possible and not too hard but you have to be a bit creative.

Posted on
Sat Mar 31, 2018 7:50 pm
nlagaros offline
Posts: 1615
Joined: Dec 20, 2010

Re: adding track remaining time.

I added the Relative Time state, ZP_RELATIVE, in the latest release (v1.0.12). It will tell you how far into a track or program you are for supported sources. You'll have to calculate the remaining time yourself which can get tricky because not all sources will report duration of a track or program. If duration is available, it is in the ZP_DURATION state.

philipbasile wrote:
I'd like to show the number of seconds remaining on the current track thats playing.
The Sonos source could be amazon music or SiriusXM.
Is there anyway to get the remaining time left on the current track ?

thanks

philip

Posted on
Sat Mar 31, 2018 8:47 pm
philipbasile offline
Posts: 95
Joined: Jan 08, 2015
Location: NJ

Re: adding track remaining time.

Awesome, I'll try it tomorrow.

Posted on
Sun Apr 01, 2018 5:31 pm
philipbasile offline
Posts: 95
Joined: Jan 08, 2015
Location: NJ

Re: adding track remaining time.

I downloaded and upgraded to 1.0.12. Thank You !
I see two states DURATION and REMAINING.

DURATION seems to be the length of the song and REMAINING shows the second count from 0 to DURATION
So REMAINING isn't really remaining seconds its more like ELAPSED.
Am I missing something or is there a reason its called REMAINING ?

But the value you usually see in a player UI is remaining.
Can you create a new device state in the plugin that is DURATION-ELAPSED (REMAINING) ??

Also, FYI it does display the your REMAINING device state for both Amazon Music and Sirius XM.

Speaking of that, in Sonos it shows the source i.e. Amazon, Sirius, Spotify, etc
Can you add a device state for that ? Maybe called SERVICE ?

Awesome Plugin !
Thank You !

Philip

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 1 guest