It is currently April 16th, 2024, 7:25 am

NowPlaying:How to display 2 instances of title

Get help with creating, editing & fixing problems with skins
Dwarlorf
Posts: 16
Joined: March 23rd, 2020, 8:31 am

NowPlaying:How to display 2 instances of title

Post by Dwarlorf »

I'm trying to split the PlayerType title and have it display 2 different values. A lot of my song titles also show features of other artists that participate on the track. I want to split these so that I can display the song title and the featuring(s) separately.
Image
'Song : ' should only display the songtitle and 'Feat : ' should display any features on that track. Both are part of PlayerType title.
Also see my other topic for more insight in what I'm trying to do. I hope my explanation is clear enough to understand.

As I understand it I cannot use PlayerType title twice and have it show different values? Is there a workaround or some other way achieve this?
Last edited by Dwarlorf on April 8th, 2020, 7:40 am, edited 1 time in total.
mak_kawa
Posts: 908
Joined: December 30th, 2015, 9:47 am

Re: NowPlaying:How to display 2 instances of title

Post by mak_kawa »

Hi Dwarlorf

I am still a noob for RegExp, so if I am missing something and/or misunderstanding what you say, sorry.

Generally speaking, you can use RegExp capturing in substitution. For example, when the source string is "Ebony Eyes (feat. Smokey Robinson)", splitting code is as follows;

Code: Select all

[Rainmeter]
Update=1000
BackgroundMode=2
SolidColor=192,192,192,192

[Variables]
Source=Ebony Eyes (feat. Smokey Robinson)

[SplitTitle]
Measure=String
String=#Source#
RegExpSubstitute=1
Substitute="^(.*) \(feat\. .*\).*$":"\1"

[SplitFeature]
Measure=String
String=#Source#
RegExpSubstitute=1
Substitute="^.* \(feat\. (.*)\).*$":"\1"

[TitleMeter]
Meter=String
MeasureName=SplitTitle
MeasureName2=SplitFeature
X=5
Y=5
W=300
H=60
Text=Source:#Source##CRLF#Song: %1#CRLF#Feat. :%2
Untitled-1.png
Of course, you have to add all supposed RegExp substitutions for other case of "featuring".
And...above RegExp description is "verbose" one. Possibly it can be expressed more simple/short/optimized. :-)
You do not have the required permissions to view the files attached to this post.
Dwarlorf
Posts: 16
Joined: March 23rd, 2020, 8:31 am

Re: NowPlaying:How to display 2 instances of title

Post by Dwarlorf »

Well, my issue isn't so much that I can't get the Regex substitute to work (I managed with some help in my other topic, I'm probably just as big a noob at it as you ;-) ) but getting the right input and displaying it. But maybe my question or explanation is not clear enough.

Having said that what you wrote could lead to the result I'm looking for. In your example you use Ebony Eyes (feat. Smokey Robinson) as a source at Variables. But I need that source to be PlayerType= Title from the NowPlaying measure so that it takes its input from Foobar2000. Maybe this explanation is a clearer example of what I want to achieve than my starting post.

Based on your reply I tried it this way:

Code: Select all

[Variables]
Source=PlayerType=TITLE
and

Code: Select all

[Variables]
Source="PlayerType=TITLE"
But I don't think variables work that way? (I'm terrible at programming. It's mostly mimicry and loads of trial & error what I do)
User avatar
balala
Rainmeter Sage
Posts: 16141
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: NowPlaying:How to display 2 instances of title

Post by balala »

Dwarlorf wrote: March 28th, 2020, 10:29 am I'm trying to split the PlayerType title and have it display 2 different values. A lot of my song titles also show features of other artists that participate on the track. I want to split these so that I can display the song title and the featuring(s) separately.
My idea is to make a proper substitution on the NowPlaying measure with the PlayerType=TITLE option, in a way to get the title split into two, with a new line character.
So, try to add the following two options to the appropriate NowPlaying measure:

Code: Select all

[MeasureTitle]
Measure=NowPlaying
PlayerName=[MeasurePlayer]
PlayerType=TITLE
RegExpSubstitute=1
Substitute="(?i)(.*)((\(?)ft|feat.*)":"\1#CRLF#\2","\(":"","\)":""
where obviously [MeasurePlayer] is the parent NowPlaying measure.
The String meter has to show this measure:

Code: Select all

[MeterTitle]
Meter=String
MeasureName=MeasureTitle
...
Text=%1
Dwarlorf
Posts: 16
Joined: March 23rd, 2020, 8:31 am

Re: NowPlaying:How to display 2 instances of title

Post by Dwarlorf »

balala wrote: March 28th, 2020, 7:17 pm My idea is to make a proper substitution on the NowPlaying measure with the PlayerType=TITLE option, in a way to get the title split into two, with a new line character.
Thanks for the input. Much appreciated. That does the job functionally. The downside is that it makes rows jump. As soon as there's a feature it adds another row with that feature. Is there some way to have the rows not jump when a song without a feature is playing and it changes into a song with a feature and vice versa? So that it basically keeps the layout as shown in the image of my topic start. I'll look into it myself as well ofcourse.

Maybe it helps if I post my skin as I have it so far.

Code: Select all

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

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

[Variables]

[MeterString]
Meter=STRING
MeasureName=MeasurePlayer
MeasureName2=MeasureArtist
MeasureName3=MeasureAlbum
MeasureName4=MeasureYear
MeasureName5=MeasureNumber
MeasureName12=MeasureFeat
MeasureName6=MeasureDuration
MeasureName7=MeasureProgress
MeasureName8=MeasureState
MeasureName9=MeasureVolume

X=30R
Y=180R
H=500

FontColor=250,250,250,210
FontFace=Sansation
FontSize=18
StringStyle=Normal
StringAlign=LEFTCENTER
AntiAlias=1

Text=#CRLF#Artist   : %2#CRLF#Album : %3#CRLF#Year     : %4#CRLF#Track    : %5#CRLF#Song    : %1#CRLF#Length  : %6#CRLF#Progress : #CRLF##CRLF#Status    : %8#CRLF#Volume  : 

[MeasurePlayer]			;Song
Measure=NowPlaying
PlayerName=CAD
PlayerType=TITLE
RegExpSubstitute=1
Substitute="(?i)(.*)((\(?).ft\..*$|\(ft.*$|.feat\..*$|.featuring.*$|ft\..*$|\sft\s.|.feat\s.*)":"\1#CRLF#\2","\(":"","\)":""

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

[MeasureAlbum]			;Album
Measure=NowPlaying
PlayerName=[MeasurePlayer]
PlayerType=ALBUM

[MeasureYear]			;Year
Measure=NowPlaying
PlayerName=[MeasurePlayer]
PlayerType=YEAR
RegExpSubstitute=1
Substitute="^([0])$":""

[MeasureNumber] 		;Track
Measure=NowPlaying
PlayerName=[MeasurePlayer]
PlayerType=NUMBER
RegExpSubstitute=1
Substitute="^([1-9])$":"0\1","^([0])$":""

[MeasureDuration]		;Length
Measure=NowPlaying
PlayerName=[MeasurePlayer]
PlayerType=DURATION
Formula=(((MeasureDuration = 0) )
Substitute="00:00":""

[MeasureProgress]		;Progress
Measure=NowPlaying
PlayerName=[MeasurePlayer]
PlayerType=PROGRESS

[MeterLine]
Meter=LINE
X=30
Y=208
W=200
H=70
LineCount=1
LineColor=250,250,250,210
AutoScale=1
AntiAlias=1

[MeasureState]			;Status
Measure=NowPlaying
PlayerName=[MeasurePlayer]
PlayerType=STATE
Substitute="0":"Foobar is off/not playing","1":"Foobar is playing","2":"Foobar is paused"

[MeasureVolume]			;Volume
Measure=NowPlaying
PlayerName=[MeasurePlayer]
PlayerType=VOLUME

[MeterProgress]
MeasureName=MeasureProgress
Meter=BAR
Y=240
X=138
W=250
H=15
BarColor=250,250,250,210
SolidColor=150,150,150,255
BarOrientation=Horizontal

[MeterVolume]
MeasureName=MeasureVolume
Meter=BAR
Y=336
X=134
W=250
H=15
BarColor=250,250,250,210
SolidColor=150,150,150,255
BarOrientation=Horizontal
User avatar
balala
Rainmeter Sage
Posts: 16141
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: NowPlaying:How to display 2 instances of title

Post by balala »

Dwarlorf wrote: March 28th, 2020, 10:00 pm The downside is that it makes rows jump. As soon as there's a feature it adds another row with that feature. Is there some way to have the rows not jump when a song without a feature is playing and it changes into a song with a feature and vice versa? So that it basically keeps the layout as shown in the image of my topic start.
No, there is not. I thought this is the idea of what you wanna achieve: if the title (the value returned by the [MeasureTitle] measure) has a feature (feat, feat., ft. or something similar) string, this to go to a new line, otherwise everything to be kept on one line. Not thisis what you asked for? Am I misunderstood your request (might be!)?
Dwarlorf
Posts: 16
Joined: March 23rd, 2020, 8:31 am

Re: NowPlaying:How to display 2 instances of title

Post by Dwarlorf »

balala wrote: March 29th, 2020, 5:43 pm No, there is not. I thought this is the idea of what you wanna achieve: if the title (the value returned by the [MeasureTitle] measure) has a feature (feat, feat., ft. or something similar) string, this to go to a new line, otherwise everything to be kept on one line. Not this is what you asked for? Am I misunderstood your request (might be!)?
In essence it is what I'm looking for but not quite (see below). I rather not have the lay-out change.

My ideal situation:
  • I prefer to have a line called Feat.: that's set (just like Artist: , Album: and those others you see on the left of the picture).
  • If that's somehow possible I would like to filter out all instances of feat, ft so that the line Feat.: only displays the featuring artists.
The end result I'm looking for is this (photoshopped):
Image
  • If there's no feature on the song I would like the line behind the Feat: to be empty.
But if that's not possible I'll either settle with your solution or think of something else.
User avatar
balala
Rainmeter Sage
Posts: 16141
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: NowPlaying:How to display 2 instances of title

Post by balala »

Dwarlorf wrote: March 30th, 2020, 7:36 am But if that's not possible I'll either settle with your solution or think of something else.
But it definitely is possible. Just have to add some extra String measures.
Remove the RegExpSubstitute=1 and the Substitute options from the [MeasureTitle] measure.
Add the following two String measures:

Code: Select all

[MeasureJustTitle]
Measure=String
String=[MeasureTitle]
RegExpSubstitute=1
Substitute="(?i)(.*)((\(?)ft|feat.*)":"\1","\(":"","\)":""
DynamicVariables=1

[MeasureFeature]
Measure=String
String=[MeasureTitle]
RegExpSubstitute=1
Substitute="(?i)(.*)((\(?)ft|feat.*)":"\2","\(":"","\)":""
DynamicVariables=1
As you probably figured it out, [MeasureJustTitle] is returning the title, while [MeasureFeature] is returning the feature. If there is no feature, [MeasureJustTitle] is returning the whole title, while [MeasureFeature] is returning the same (the whole title). But you said this should be empty if there is no feature. To get this to work this way, one more String measure will be needed. If the above solution (with the [MeasureFeature] returning the whole title if there is no feature) is acceptable, this is ok, otherwise please let me know, to modify (complicate) the measure appropriately.
Now you can use these two measures as you want in String meters, for instance.
Dwarlorf
Posts: 16
Joined: March 23rd, 2020, 8:31 am

Re: NowPlaying:How to display 2 instances of title

Post by Dwarlorf »

I just realized I used the wrong subforum for this and my other topic, so my apologies. Maybe it can be moved?
balala wrote: March 30th, 2020, 2:24 pm As you probably figured it out, [MeasureJustTitle] is returning the title, while [MeasureFeature] is returning the feature. If there is no feature, [MeasureJustTitle] is returning the whole title, while [MeasureFeature] is returning the same (the whole title).
I've been able to incorporate your suggestions into my skin so that's one 'problem' out of the way, thank you. The downside is that it also shows the words ft., feat, etc. in [MeasureJustTitle] which isn't necessary anymore. I wasn't able to modify the Regex in such a way that it does not show them.

And I reverted the substitute regex you used in [MeasureJustTitle] to my old one. This because I realized that as an unwanted side effect it removed every ( and ) and there are a few songs that actually use them. For instance the James Brown song "I Got You (I Feel Good)"

(For reference I will add the complete code of my skin as it is now at the bottom of this post)
balala wrote: March 30th, 2020, 2:24 pm But you said this should be empty if there is no feature. To get this to work this way, one more String measure will be needed. If the above solution (with the [MeasureFeature] returning the whole title if there is no feature) is acceptable, this is ok, otherwise please let me know, to modify (complicate) the measure appropriately.
Now you can use these two measures as you want in String meters, for instance.
I would really like to have it show nothing when there's no feature.

To do this I figured that I somehow had to compare [MeasureTitle] with [MeasureFeature] because when there's no feature the value of both measures are the same. I managed by using a third measure ([MeasureNoFeat]) and a meter using IfMatch to compare [MeasureFeature] with [MeasureTitle] like this:

Code: Select all

[MeasureNoFeat]
Measure=String
String=[MeasureFeature]
IfMatch=[MeasureTitle]
IfMatchAction=[!SetOption ShowStringMatch Text ""]
IfNotMatchAction=[!SetOption ShowStringMatch Text "No Match"]
DynamicVariables=1

[ShowStringMatch]
Meter=String
X=5
Y=430
SolidColor=250,250,250,210
W=75
H=20

But I can't figure out how I can achieve the same IfMatch effect combined with a substitution in the measure [MeasureFeat] so that it shows either the features or nothing if there's no featuring.So I guess I still need your help with that, if you don't mind.

Complete Skin code:

Code: Select all

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

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

[Variables]

[MeterString]
Meter=STRING
MeasureName=MeasurePlayer
MeasureName2=MeasureArtist
MeasureName3=MeasureAlbum
MeasureName4=MeasureYear
MeasureName5=MeasureTrack
MeasureName6=MeasureLength
MeasureName7=MeasureJustTitle
MeasureName8=MeasureFeature
MeasureName9=MeasureProgress
MeasureName10=MeasureStatus
MeasureName11=MeasureVolume
MeasureName12=MeasureNoFeat

X=30R
Y=180R
H=500

FontColor=250,250,250,210
FontFace=Sansation
FontSize=18
StringStyle=Normal
StringAlign=LEFTCENTER
AntiAlias=1

Text=#CRLF#Artist   : %2#CRLF#Album : %3#CRLF#Year     : %4#CRLF#Track    : %5#CRLF#Length : %6#CRLF#Title      : %7#CRLF#Feat.     : %12#CRLF#Progress : #CRLF##CRLF#Volume  :#CRLF#Status    : %10#CRLF#

[MeasurePlayer]
Measure=NowPlaying
PlayerName=CAD

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

[MeasureAlbum]
Measure=NowPlaying
PlayerName=[MeasurePlayer]
PlayerType=ALBUM

[MeasureYear]
Measure=NowPlaying
PlayerName=[MeasurePlayer]
PlayerType=YEAR
RegExpSubstitute=1
Substitute="^([0])$":""

[MeasureTrack]
Measure=NowPlaying
PlayerName=[MeasurePlayer]
PlayerType=NUMBER
RegExpSubstitute=1
Substitute="^([1-9])$":"0\1","^([0])$":""

[MeasureTitle]			;Title&Feat.&NoFeat.
Measure=NowPlaying
PlayerName=[MeasurePlayer]
PlayerType=TITLE

[MeasureJustTitle]		;Title
Measure=String
String=[MeasureTitle]
RegExpSubstitute=1
Substitute="(?i).ft\..*$|\(ft.*$|.feat\..*$|.featuring.*$|ft\..*$|\sft\s.|.feat\s.*$":""
;Substitute="(?i)(.*)((\(?)ft\..*|\(ft.*|feat\..*|featuring.*|ft\..*|\sft\s.|.feat\s.*)":"\1","\(":"","\)":""
DynamicVariables=1

[MeasureFeature]		;Feat.
Measure=String
String=[MeasureTitle]
RegExpSubstitute=1
Substitute="(?i)(.*)((\(?).ft\..*|\(ft.*|.feat\..*|.featuring.*|ft\..*|\sft\s.|.feat\s.*)":"\2","\(":"","\)":""
DynamicVariables=1

[MeasureNoFeat]
Measure=String
String=[MeasureFeature]
IfMatch=[MeasureTitle]
IfMatchAction=[!SetOption ShowStringMatch Text "Match"]
IfNotMatchAction=[!SetOption ShowStringMatch Text "No Match"]
DynamicVariables=1

[ShowStringMatch]
Meter=String
X=5
Y=430
SolidColor=250,250,250,210
W=75
H=20

[MeasureLength]		;Length
Measure=NowPlaying
PlayerName=[MeasurePlayer]
PlayerType=DURATION
Formula=(((MeasureDuration = 0) )
Substitute="00:00":""

[MeasureProgress]		;Progress
Measure=NowPlaying
PlayerName=[MeasurePlayer]
PlayerType=PROGRESS

[MeterLine]
Meter=LINE
X=30
Y=222
W=200
H=70
LineCount=1
LineColor=250,250,250,210
AutoScale=1
AntiAlias=1

[MeasureStatus]			;Status
Measure=NowPlaying
PlayerName=[MeasurePlayer]
PlayerType=STATE
Substitute="0":"Foobar is off/not playing","1":"Foobar is playing","2":"Foobar is paused"

[MeasureVolume]			;Volume
Measure=NowPlaying
PlayerName=[MeasurePlayer]
PlayerType=VOLUME

[MeterProgress]
MeasureName=MeasureProgress
Meter=BAR
Y=256
X=138
W=250
H=15
BarColor=250,250,250,210
SolidColor=150,150,150,255
BarOrientation=Horizontal

[MeterVolume]
MeasureName=MeasureVolume
Meter=BAR
Y=320
X=134
W=250
H=15
BarColor=250,250,250,210
SolidColor=150,150,150,255
BarOrientation=Horizontal
User avatar
balala
Rainmeter Sage
Posts: 16141
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: NowPlaying:How to display 2 instances of title

Post by balala »

Dwarlorf wrote: April 1st, 2020, 4:51 pm I've been able to incorporate your suggestions into my skin so that's one 'problem' out of the way, thank you. The downside is that it also shows the words ft., feat, etc. in [MeasureJustTitle] which isn't necessary anymore. I wasn't able to modify the Regex in such a way that it does not show them.
I see what are you talking about, but in order to can help you furtherly, I'd need those (probably) mp3 files you are working with. Would be much easier for me to work with those. So, if you could send me one (or one having and other not having features) file having the described problems, it would help extremely much to can furtherly help.
Is this possible?