It is currently October 21st, 2019, 4:13 am

How to add track list plus current position in the list?

Help with creating, editing & fixing problems with skins
anbr07
Posts: 43
Joined: July 17th, 2016, 12:19 pm

How to add track list plus current position in the list?

anbr07 » December 12th, 2018, 9:37 pm

Now i have the title, artist, and time/total time of the track. What do i have to add, an where, to also have something like 5/12 to indicate that track 5 of 12 ist currently paying (example)? I suppose, this should be possible.

Code: Select all

[Rainmeter]
Update=1000
AccurateText=1
DynamicWindowSize=1

[Metadata]
Name=
Author=
Information=
Version=
License=Creative Commons Attribution - Non - Commercial - Share Alike 3.0

[Variables]

[MeterCover]
Meter=Image
MeasureName=MeasureCover
X=0R
Y=0r
W=120
H=120
PreserveAspectRatio=1

[MeterString]
MeasureName=MeasurePlayer
MeasureName2=MeasureArtist
MeasureName3=MeasurePosition
MeasureName4=MeasureDuration
Meter=STRING
X=0R
Y=60r
H=120
Padding=15,5,15,5
FontColor=220,220,220
SolidColor=0,0,0,150
FontSize=8
FontFace=Segoe UI
StringStyle=BOLD
StringAlign=LEFTCENTER
AntiAlias=1
Text=%1#CRLF#%2#CRLF##CRLF#%3 (%4)

[MeasurePlayer]
Measure=NowPlaying
PlayerName=foobar2000
PlayerType=TITLE

[MeasureArtist]
Measure=NowPlaying
PlayerName=[MeasurePlayer]
PlayerType=ARTIST

[MeasureCover]
Measure=NowPlaying
PlayerName=[MeasurePlayer]
PlayerType=COVER

[MeasureDuration]
Measure=NowPlaying
PlayerName=[MeasurePlayer]
PlayerType=DURATION

[MeasurePosition]
Measure=NowPlaying
PlayerName=[MeasurePlayer]
PlayerType=POSITION

[MeasureStatus]
Measure=NowPlaying
PlayerName=[MeasurePlayer]
PlayerType=STATUS
IfCondition=(#CURRENTSECTION#=0)
IfTrueAction=[!HideFade "#CURRENTCONFIG#"]
IfFalseAction=[!ShowFade "#CURRENTCONFIG#"]
Last edited by balala on December 13th, 2018, 7:40 am, edited 1 time in total.
User avatar
Jeff
Posts: 57
Joined: September 3rd, 2018, 11:18 am

Re: How to add track list plus current position in the list?

Jeff » December 14th, 2018, 1:24 am

I... don't think it's possible with native Rainmeter, since the NowPlaying plugin was made to fit as much as it can in common to all the player there, they either didn't find the right things or gave up. You can get the current track number in the playlist (PlayerType=Number) and that's all, I can't think of a way to get the total.
I've seen people with Spicetify do it using JavaScript, but that's a bit beside the point since WebNowPlaying isn't Rainmeter (yet... plz tj, plz jeff, plz plz webnowplaying4rainmeter)

It doesn't seem like the total track playing number fuc-ing things is present in the SDK and other NowPlaying libraries in the repo, which is a big bummer
https://github.com/rainmeter/rainmeter/tree/39c2ed8bf0eefe411dbb8d94a8d82659dac341ab/Library/NowPlaying/SDKs
https://github.com/rainmeter/rainmeter/blob/39c2ed8bf0eefe411dbb8d94a8d82659dac341ab/Library/MeasureNowPlaying.cpp

Also a bit of suggestions on the code, you can remove AccurateText since you don't use Inline Strings. If you wanna keep AccurateText, you can have your stuff like

Code: Select all

[MeterString]
Meter=STRING

MeasureName  = MeasurePlayer
MeasureName2 = MeasureArtist
MeasureName3 = MeasurePosition
MeasureName4 = MeasureDuration
X=0R
Y=60r
H=120
SolidColor=0,0,0,150
Padding=15,5,15,5

InlineSetting  = Face   | Segoe UI
InlineSetting2 = Size   | 8
InlineSetting3 = Color  | 220,220,220
InlineSetting4 = Weight | 700
StringAlign=LEFTCENTER
AntiAlias=1

Text=%1#CRLF#%2#CRLF##CRLF#%3 (%4)
It looks better dosen't it 👀
User avatar
Brian
Developer
Posts: 1910
Joined: November 24th, 2011, 1:42 am
Location: Utah

Re: How to add track list plus current position in the list?

Brian » December 14th, 2018, 8:02 am

Jeff wrote:
December 14th, 2018, 1:24 am
Also a bit of suggestions on the code, you can remove AccurateText since you don't use Inline Strings.
Just to clearify, AccurateText has nothing to do with inline strings.
https://docs.rainmeter.net/manual/skins/rainmeter-section/#AccurateText

It simply uses a better method to "measuring" the dimensions of a drawn string when calculating the width and height the string. With it "off", the string meter will add small amounts of padding when rendering the string to the screen. You can easily see the difference if you include a background color to the meter with SolidColor.

Example:

Code: Select all

[Rainmeter]
AccurateText=1

[Test]
Meter=String
FontColor=FFFFFF
SolidColor=000000
Text=Testing...
Load this, then change AccurateText to 0 and refresh the skin to see the difference.

-Brian
User avatar
Jeff
Posts: 57
Joined: September 3rd, 2018, 11:18 am

Re: How to add track list plus current position in the list?

Jeff » December 14th, 2018, 5:21 pm

Didn't AccurateText=0 use the same padding and character spacing as GDI+ and because of that the boundig box can't update? Oh damn, well... TIL
  It's actually interesting, thanks for that  
User avatar
Brian
Developer
Posts: 1910
Joined: November 24th, 2011, 1:42 am
Location: Utah

Re: How to add track list plus current position in the list?

Brian » December 14th, 2018, 8:16 pm

Jeff wrote:
December 14th, 2018, 5:21 pm
Didn't AccurateText=0 use the same padding and character spacing as GDI+ and because of that the boundig box can't update?
Partially.

Didn't AccurateText=0 use the same padding and character spacing as GDI+ : Yes, AccurateText=0 does use a similar padding and character spacing as GDI+. We did this so that skins made before the change still "looked" and were spaced similarly to previous versions. When converting the String meter to DirectWrite/D2D, we noticed we could use a different method to get the exact "bounding box" of the string, which is why we have the option in the first place.

and because of that the boundig box can't update? : I am not sure what we mean by "can't update". The bounding box has always been updated (presuming no W or H is defined), when the string is updated. Could you explain?

-Brian
User avatar
Jeff
Posts: 57
Joined: September 3rd, 2018, 11:18 am

Re: How to add track list plus current position in the list?

Jeff » December 15th, 2018, 12:25 am

AccurateText = 0 and 2 inline settings, the black box (that i call bounding box), which is SolidColor on the string, is big dum dum and dosen't change to the size of the actual real value of the text
Image
With AccurateText = 1 that thing is fixed ofc but this is what I'm reffering to when I say the bounding box (original box lenght before inline options are applied) is not updated
anbr07
Posts: 43
Joined: July 17th, 2016, 12:19 pm

Re: How to add track list plus current position in the list?

anbr07 » December 15th, 2018, 12:35 pm

So it's not possible? What does that code change? Does it look differently then? I'm not experienced with Rainmeter, so i do not want to mess up things.
User avatar
Jeff
Posts: 57
Joined: September 3rd, 2018, 11:18 am

Re: How to add track list plus current position in the list?

Jeff » December 15th, 2018, 5:28 pm

I went off track quiet a bit, to TLDR, only the 5 is possible, there's no way yet to get the 12
User avatar
Brian
Developer
Posts: 1910
Joined: November 24th, 2011, 1:42 am
Location: Utah

Re: How to add track list plus current position in the list?

Brian » December 17th, 2018, 6:48 am

@anbr07: Sorry to hijack your thread. Jeff is right, there is no way to get the exact information you are asking for. The only information available is the current track number (assuming it is included in the metadata of the music file currently being played). There is no option with the NowPlaying plugin to get the total amount of tracks on a playlist/album.

For the current track number, see PlayerType=Number here: https://docs.rainmeter.net/manual/measures/nowplaying/#PlayerType



@Jeff: Congratulations, you found a bug. While most inline settings were not ignored by AccurateText=0, the CharacterSpacing inline setting was applied, then overwritten by the GDI+ emulation code we use to adjust the padding and spacing.

While the obvious solution is to swap that parts that set the character spacing, we will have to evaluate any side effects before doing so.

-Brian
anbr07
Posts: 43
Joined: July 17th, 2016, 12:19 pm

Re: How to add track list plus current position in the list?

anbr07 » December 20th, 2018, 5:48 pm

Brian, thanks for the tip. But i have no clues how and where to add the two lines. Maybe you like to give me a hint.