yeah, i do know that is says in the docs that it doesn't support that. but there are players which have found the runaround to that. so my player does display those for spotify. i would assume it should be able to calculate it the same way... however if i use the progress portion it give me -1:-1 for the values. if i change that and you use position portion of the measure i then get 00:00. neither of which are obviously correct.balala wrote:I wrote that code with the NowPlaying plugin. NowPlaying just partially supports Spotify, but on the forum you can find a plugin for Spotify: https://forum.rainmeter.net/viewtopic.php?p=94631#p94631
According to the manual, the NowPlaying plugin doesn't support the duration and position with Spotify, just the Artist and the Title, so probably my code doesn't work with Spotify. I don't use Spotify, so I can't even try it. Probably someone will help you here to adapt this to work with the SpotifyPlugin.
Sorry...
It is currently April 28th, 2024, 12:08 pm
Track Time Remaining?
-
- Posts: 27
- Joined: March 7th, 2017, 5:29 pm
Re: Track Time Remaining?
-
- Rainmeter Sage
- Posts: 5407
- Joined: April 12th, 2012, 9:40 pm
- Location: Cedar Point, Ohio, USA
Re: Track Time Remaining?
The Spotify plugin returns the duration and progress in different formats from what the NowPlaying plugin returns...Vetsus wrote:yeah, i do know that is says in the docs that it doesn't support that. but there are players which have found the runaround to that. so my player does display those for spotify. i would assume it should be able to calculate it the same way... however if i use the progress portion it give me -1:-1 for the values. if i change that and you use position portion of the measure i then get 00:00. neither of which are obviously correct.
Not sure what value is returned for Position... but different calculations would be needed to get the results for time remaining.Spotify Plugin wrote:Length
Length of the track currently playing in seconds
Position
Current song position
Progress
Returns current track progress(between 0 and 1)
In order to help, you need to post your skin code. (I also do not use Spotify, but someone may be able to find a solution after seeing your code.)
:: My DA Gallery :: Rainmeter DA Gallery :: Rainmeter Workshops :: Rainmeter Documentation :: BBCode Guide ::
-
- Posts: 27
- Joined: March 7th, 2017, 5:29 pm
Re: Track Time Remaining?
i'm sorry, i didn't see this until obviously awhile later so i'm hoping i can still get some help with this. the code i'm using seems like it should be fairly identical or similar in some way other than it's using the spotify plugin vs the nowplaying plugin. but here is the code for the track progress or track time, as well as the track length:
Code: Select all
[Measure_TrackTime]
Measure=Plugin
Plugin=SpotifyPlugin.dll
PlayerName=Spotify
Type=Position
Substitute="00:00":"N\A"
[Measure_TrackLength]
Measure=Plugin
Plugin=SpotifyPlugin.dll
PlayerName=Spotify
Type=Length
Substitute="00:00":"N\A"
-
- Rainmeter Sage
- Posts: 16183
- Joined: October 11th, 2010, 6:27 pm
- Location: Gheorgheni, Romania
Re: Track Time Remaining?
Although I still don't use Spotify (as well as neither eclectic-tech doesn't), I will try however a reply. Don't take this as a fact, I'm not sure it'll entirely work, but if you won't get a better reply, maybe it worth a try...Vetsus wrote:but here is the code for the track progress or track time, as well as the track length:
According to the above posted code, it seems that the Spotify plugin returns the position and the length in the MM:SS format (I think this, due to the Substitute options, posted on both measures). First remove those two Substitute options (or at least comment them out, with some semicolons).
Then you'll need some measures, to convert the returned string format of the duration and progress, into seconds. Add the following measures to your code:
Code: Select all
[Measure_TrackTimeMinutes]
Measure=String
String=[Measure_TrackTime]
DynamicVariables=1
RegExpSubstitute=1
Substitute="^(\d+):(\d+)$":"\1"
[Measure_TrackTimeSeconds]
Measure=String
String=[Measure_TrackTime]
DynamicVariables=1
RegExpSubstitute=1
Substitute="^(\d+):(\d+)$":"\2"
[Measure_TrackLengthMinutes]
Measure=String
String=[Measure_TrackLength]
DynamicVariables=1
RegExpSubstitute=1
Substitute="^(\d+):(\d+)$":"\1"
[Measure_TrackLengthSeconds]
Measure=String
String=[Measure_TrackLength]
DynamicVariables=1
RegExpSubstitute=1
Substitute="^(\d+):(\d+)$":"\2"
Now with two Calc measures, you can calculate the number seconds of both (the position and the length):
Code: Select all
[Measure_TrackTime_InSeconds]
Measure=Calc
Formula=( 60 * [Measure_TrackTimeMinutes] + [Measure_TrackTimeSeconds] )
DynamicVariables=1
[Measure_TrackLength_InSeconds]
Measure=Calc
Formula=( 60 * [Measure_TrackLengthMinutes] + [Measure_TrackLengthSeconds] )
DynamicVariables=1
Code: Select all
[MeasureRemaining_InSeconds]
Measure=Calc
Formula=( Measure_TrackLength_InSeconds - Measure_TrackTime_InSeconds )
Code: Select all
[MeasureRemaining_Minutes]
Measure=Calc
Formula=( Floor ( MeasureRemaining_InSeconds / 60 ))
RegExpSubstitute=1
Substitute="^(\d{1})$":"0\1"
[MeasureRemaining_Seconds]
Measure=Calc
Formula=( MeasureRemaining_InSeconds - 60 * MeasureRemaining_Minutes )
RegExpSubstitute=1
Substitute="^(\d{1})$":"0\1"
Because I could try this code only with the NowPlaying plugin, I'm not very sure it'll work with the SpotifyPlugin. But try it, then please let me know if it does.
About this, just mention that if you check the "Notify me when a reply is posted" checkbox below the field where you write your reply, you'll get an emaile, once someone replied to your message. Very easy and convenient, to not miss a reply...Vetsus wrote:i'm sorry, i didn't see this until obviously awhile later so i'm hoping i can still get some help with this.
-
- Posts: 27
- Joined: March 7th, 2017, 5:29 pm
Re: Track Time Remaining?
it certainly worked. however that's a lot of extra code just to get it to work....
-
- Rainmeter Sage
- Posts: 16183
- Joined: October 11th, 2010, 6:27 pm
- Location: Gheorgheni, Romania
Re: Track Time Remaining?
Yeah, it is. But I suppose if you say it worked, you succeeded , right?Vetsus wrote:it certainly worked. however that's a lot of extra code just to get it to work....