It is currently April 28th, 2024, 2:33 am
Track Time Remaining?
-
- Posts: 27
- Joined: March 7th, 2017, 5:29 pm
Track Time Remaining?
has anyone figured out how to get the track time remaining for the nowplaying plugin? i've tried several measures to do so with no luck. i really just like having the option to have that vs the track time itself.
-
- Posts: 860
- Joined: August 22nd, 2016, 11:32 pm
- Location: Surrey, B.C., Canada
Re: Track Time Remaining?
Try looking at this https://docs.rainmeter.net/manual-beta/plugins/nowplaying/ it has all the information in there.
I would do a formula "Duration-Position=Timeleft"
I would do a formula "Duration-Position=Timeleft"
The only source of knowledge is experience. Albert Einstein
Deviant Art Page
Deviant Art Page
-
- Developer
- Posts: 22631
- Joined: April 19th, 2009, 11:02 pm
- Location: Fort Hunt, Virginia, USA
Re: Track Time Remaining?
Code: Select all
[Rainmeter]
Update=1000
DynamicWindowSize=1
AccurateText=1
[MeasureArtist]
Measure=Plugin
Plugin=NowPlaying
PlayerName=Winamp
PlayerType=Artist
[MeasureTitle]
Measure=Plugin
Plugin=NowPlaying
PlayerName=[MeasureArtist]
PlayerType=Title
[MeasurePosition]
Measure=Plugin
Plugin=NowPlaying
PlayerName=[MeasureArtist]
PlayerType=Position
[MeasureDuration]
Measure=Plugin
Plugin=NowPlaying
PlayerName=[MeasureArtist]
PlayerType=Duration
[MeasureMinutesRemaining]
Measure=Calc
Formula=Trunc((MeasureDuration - MeasurePosition)/60)
RegExpSubstitute=1
Substitute="^(.)$":"0\1"
[MeasureSecondsRemaining]
Measure=Calc
Formula=((MeasureDuration - MeasurePosition) % 60)
RegExpSubstitute=1
Substitute="^(.)$":"0\1"
[MeterPlayer]
Meter=String
MeasureName=MeasureArtist
MeasureName2=MeasureTitle
MeasureName3=MeasureDuration
MeasureName4=MeasurePosition
MeasureName5=MeasureMinutesRemaining
MeasureName6=MeasureSecondsRemaining
InlineSetting=Size | 11
InlineSetting2=Weight | 400
InlineSetting3=Color | 255,255,255,255
SolidColor=47,47,47,255
Padding=5,5,5,5
AntiAlias=1
Text=%1#CRLF#%2#CRLF#%3 | %4 | %5:%6
You do not have the required permissions to view the files attached to this post.
-
- Rainmeter Sage
- Posts: 16182
- Joined: October 11th, 2010, 6:27 pm
- Location: Gheorgheni, Romania
Re: Track Time Remaining?
Sorry CyberTheWorm and jsmorley, I just wrote my reply when you've posted yours, so I also post mine. I hope you don't mind...
The remaining time can be calculated subtracting the progress from the duration. But be careful, because the result will be expressed in seconds:
Now you have to convert this number into minutes and seconds (eventually hours, too). This conversion can be done by the following measures:
If you also need to calculate the number of hours, please let me know.
Note that I added the RegExpSubstitute and Substitute options to have both numbers with two digits (adding a 0 in front of the one digit number).
You have to use just a string meter to show the result, for example:
The following [MeasureProgress] and [MeasureDuration] measures will return the progress and the duration of the current track (I also post the parent [MeasurePlayer] measure, just add the appropriate PlayerName variable to the [Variables] section):Vetsus wrote:has anyone figured out how to get the track time remaining for the nowplaying plugin? i've tried several measures to do so with no luck. i really just like having the option to have that vs the track time itself.
Code: Select all
[MeasurePlayer]
Measure=Plugin
Plugin=NowPlaying
PlayerName=#PlayerName#
PlayerType=TITLE
[MeasureProgress]
Measure=Plugin
Plugin=NowPlaying
PlayerName=[MeasurePlayer]
PlayerType=POSITION
[MeasureDuration]
Measure=Plugin
Plugin=NowPlaying
PlayerName=[MeasurePlayer]
PlayerType=DURATION
Code: Select all
[MeasureRemaining]
Measure=Calc
Formula=( MeasureDuration - MeasureProgress )
Code: Select all
[MeasureRemainingMinutes]
Measure=Calc
Formula=( Floor ( MeasureRemaining / 60 ))
RegExpSubstitute=1
Substitute="^(.)$":"0\1"
[MeasureRemainingSeconds]
Measure=Calc
Formula=( MeasureRemaining % 60 )
RegExpSubstitute=1
Substitute="^(.)$":"0\1"
Note that I added the RegExpSubstitute and Substitute options to have both numbers with two digits (adding a 0 in front of the one digit number).
You have to use just a string meter to show the result, for example:
Code: Select all
[MeterRemaining]
MeasureName=MeasureRemainingMinutes
MeasureName2=MeasureRemainingSeconds
Meter=STRING
X=0
Y=0
Padding=15,5,15,5
FontColor=220,220,220
SolidColor=0,0,0,150
FontSize=8
FontFace=Segoe UI
StringStyle=BOLD
StringAlign=LEFT
AntiAlias=1
Text=Remained: %1:%2
-
- Developer
- Posts: 22631
- Joined: April 19th, 2009, 11:02 pm
- Location: Fort Hunt, Virginia, USA
Re: Track Time Remaining?
The more the merrier...
-
- Posts: 860
- Joined: August 22nd, 2016, 11:32 pm
- Location: Surrey, B.C., Canada
Re: Track Time Remaining?
LOL, I was just going to play and try and get the formula. You guys are just too fast.
The only source of knowledge is experience. Albert Einstein
Deviant Art Page
Deviant Art Page
-
- Developer
- Posts: 22631
- Joined: April 19th, 2009, 11:02 pm
- Location: Fort Hunt, Virginia, USA
Re: Track Time Remaining?
Only comment I would make balala, is that I think Trunc() is a better fit here than Floor(). We are never looking to "round" anything. I actually suspect either will always work, but Trunc() makes more sense to me.
-
- Rainmeter Sage
- Posts: 16182
- Joined: October 11th, 2010, 6:27 pm
- Location: Gheorgheni, Romania
Re: Track Time Remaining?
Actually there are no differences here between Trunc and Floor, while their arguments are positive.jsmorley wrote:Only comment I would make balala, is that I think Trunc() is a better fit here than Floor(). We are never looking to "round" anything. I actually suspect either will always work, but Trunc() makes more sense to me.
Take a look at the following example code:
Code: Select all
[MeasureTrunc]
Measure=Calc
Formula=( Trunc ( #Num# ))
[MeasureFloor]
Measure=Calc
Formula=( Floor ( #Num# ))
Trunc on the other hand, is returning the integer part of its argument (of Num, in this case). But the integer part of -2.24, is -2.
When the arguments are positive, both functions give the same result (eg for 2.24, both give 2).
Because here the argument (the remaining time) for sure is positive, doesn't matter which function are you using. It can be a question of personal preference, but doesn't matter too much.
-
- Posts: 27
- Joined: March 7th, 2017, 5:29 pm
Re: Track Time Remaining?
i'm unsure if i'm failing to do this right or if it doesn't work with spotify. is it confirmed that this works with spotify because it does not with mine...?balala wrote:Sorry CyberTheWorm and jsmorley, I just wrote my reply when you've posted yours, so I also post mine. I hope you don't mind...
The following [MeasureProgress] and [MeasureDuration] measures will return the progress and the duration of the current track (I also post the parent [MeasurePlayer] measure, just add the appropriate PlayerName variable to the [Variables] section):The remaining time can be calculated subtracting the progress from the duration. But be careful, because the result will be expressed in seconds:Code: Select all
[MeasurePlayer] Measure=Plugin Plugin=NowPlaying PlayerName=#PlayerName# PlayerType=TITLE [MeasureProgress] Measure=Plugin Plugin=NowPlaying PlayerName=[MeasurePlayer] PlayerType=POSITION [MeasureDuration] Measure=Plugin Plugin=NowPlaying PlayerName=[MeasurePlayer] PlayerType=DURATION
Now you have to convert this number into minutes and seconds (eventually hours, too). This conversion can be done by the following measures:Code: Select all
[MeasureRemaining] Measure=Calc Formula=( MeasureDuration - MeasureProgress )
If you also need to calculate the number of hours, please let me know.Code: Select all
[MeasureRemainingMinutes] Measure=Calc Formula=( Floor ( MeasureRemaining / 60 )) RegExpSubstitute=1 Substitute="^(.)$":"0\1" [MeasureRemainingSeconds] Measure=Calc Formula=( MeasureRemaining % 60 ) RegExpSubstitute=1 Substitute="^(.)$":"0\1"
Note that I added the RegExpSubstitute and Substitute options to have both numbers with two digits (adding a 0 in front of the one digit number).
You have to use just a string meter to show the result, for example:Code: Select all
[MeterRemaining] MeasureName=MeasureRemainingMinutes MeasureName2=MeasureRemainingSeconds Meter=STRING X=0 Y=0 Padding=15,5,15,5 FontColor=220,220,220 SolidColor=0,0,0,150 FontSize=8 FontFace=Segoe UI StringStyle=BOLD StringAlign=LEFT AntiAlias=1 Text=Remained: %1:%2
-
- Rainmeter Sage
- Posts: 16182
- Joined: October 11th, 2010, 6:27 pm
- Location: Gheorgheni, Romania
Re: Track Time Remaining?
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#p94631Vetsus wrote:i'm unsure if i'm failing to do this right or if it doesn't work with spotify. is it confirmed that this works with spotify because it does not with mine...?
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...