Dwarlorf wrote: ↑April 7th, 2020, 8:37 amIf added some extra features but am once again stuck at regex. (It's just not for me). If you could help me with the final regex code that would be very appreciated.
When Status = 1 (Foobar is on) but State is 0 (Stopped) all the other values (title, Album, Year, etc) are not shown but I would really like them to show their values. (I wonder why this is not the standard implementation in Rainmeter)
This has nothing to do with regex, actually - it's just about being a bit creative. Both status and state have numerical values too, so it's just a question of adding some IfConditions in the last measure (so that the values of the other measures are known by then), along with storing the last artist, song, etc. in corresponding variables while playing and use them instead of the actual measures in the meters, both when playing/paused (since it makes no difference anyway, they are the same values as the measures in this case) but
also when the player is stopped (its state is 0), since then they would preserve the info from the last time when playing/paused and be different from the empty values of the corresponding measures. Of course, if the player is already stopped when the skin is initializing / loading, there won't be any "last values" to use, so in that case they will be empty - but that's only one drawback, and it will probably not matter anyway afterwards, after some song gets to be played even for 1 sec.
Dwarlorf wrote: ↑April 7th, 2020, 8:37 amWhen Status = 0 (Foobar is off) I would like the value of State to show nothing (instead of Stopped).
Solved similarly to the issue above.
Dwarlorf wrote: ↑April 7th, 2020, 8:37 amAnd a not essential bonus question (I'm not sure if I want to implement it): is there a way to have the Progress and Volume solid colors to be transparent when Status = 0 (Foobar is off)?
Sure. I let them just a bit opaque, in order to know they're there - feel free to change it if you deem it so. The difference between their "enabled status" colors and their "disabled status" ones is sufficient in my view to not need full transparency, but as I said, the alpha color is subject to change, if you like.
The full code (I made some other relatively significant changes in some areas, so you know what to do in this case: where you don't know,
ask):
Code: Select all
[Variables]
SW=1
LW=90
RW=440
CW=14
LastArtist=""
LastAlbum=""
LastYear=""
LastTrack=""
LastLength=""
LastTitle=""
LastFeaturing=""
LastState=""
[Rainmeter]
Update=1000
AccurateText=2
DynamicWindowSize=1
[Metadata]
Name=
Author=
Information=
Version=
License=Creative Commons Attribution - Non - Commercial - Share Alike 3.0
---Measures---
[MeasurePlayer]
Measure=NowPlaying
PlayerName=CAD
PlayerType=FILE
[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="^0$":"","^(\d+)$":"000\1","^\d*(\d{2})$":"\1"
[MeasureLength]
Measure=NowPlaying
PlayerName=[MeasurePlayer]
PlayerType=DURATION
RegExpSubstitute=1
Substitute="(?:^00:00$|^0$)":""
[MeasureTitle]
Measure=NowPlaying
PlayerName=[MeasurePlayer]
PlayerType=TITLE
RegExpSubstitute=1
Substitute="(?siU)^(.*)[\(\s]+?(?:featuring|feat|ft)[\.\s]+?(.*)[\)\s]*?$":"\1","(?:^$|^\\1$)":" "
[MeasureFeaturing]
Measure=NowPlaying
PlayerName=[MeasurePlayer]
PlayerType=TITLE
RegExpSubstitute=1
Substitute="(?siU)^(.*)[\(\s]+?(?:featuring|feat|ft)[\.\s]+?(.*)[\)\s]*?$":"\2","(?:^$|^\\2$|^[MeasureTitle:EscapeRegExp]$)":" "
DynamicVariables=1
[MeasureProgress]
Measure=NowPlaying
PlayerName=[MeasurePlayer]
PlayerType=PROGRESS
[MeasureRepeat]
Measure=NowPlaying
PlayerName=[MeasurePlayer]
PlayerType=REPEAT
RegExpSubstitute=1
Substitute="^0$":"","^1$":"On"
[MeasureShuffle]
Measure=NowPlaying
PlayerName=[MeasurePlayer]
PlayerType=SHUFFLE
RegExpSubstitute=1
Substitute="^0$":"","^1$":"On"
[MeasureState]
Measure=NowPlaying
PlayerName=[MeasurePlayer]
PlayerType=STATE
RegExpSubstitute=1
Substitute="^0$":"Stopped","^1$":"Playing","^2$":"Paused"
[MeasureVolume]
Measure=NowPlaying
PlayerName=[MeasurePlayer]
PlayerType=VOLUME
[MeasureStatus]
Measure=NowPlaying
PlayerName=[MeasurePlayer]
PlayerType=STATUS
RegExpSubstitute=1
Substitute="^0$":"Foobar is off ","^1$":"Foobar is on"
IfCondition=(MeasureStatus=0)
IfTrueAction=[!SetVariable LastState ""][!SetOptionGroup BarGroup SolidColor "150,150,150,64"][!SetOptionGroup BarGroup BarColor "250,250,250,64"]
IfFalseAction=[!SetVariable LastState [MeasureState]][!SetOptionGroup BarGroup SolidColor "150,150,150,255"][!SetOptionGroup BarGroup BarColor "250,250,250,255"]
IfCondition2=(MeasureStatus=1) && (MeasureState=0)
IfFalseAction2=[!SetVariable LastArtist [MeasureArtist]][!SetVariable LastAlbum [MeasureAlbum]][!SetVariable LastYear [MeasureYear]][!SetVariable LastTrack [MeasureTrack]][!SetVariable LastLength [MeasureLength]][!SetVariable LastTitle [MeasureTitle]][!SetVariable LastFeaturing [MeasureFeaturing]]
IfConditionMode=1
DynamicVariables=1
---Styles---
[SBase]
FontColor=250,250,250,250
FontFace=Sansation
FontSize=16
FontWeight=100
StringAlign=Left
AntiAlias=1
ClipString=1
[SLeftCol]
X=0
Y=(Max([MeterArtistLabel:H],[MeterArtistValue:H])-[MeterArtistLabel:H])R
W=#LW#
[SRightCol]
X=0R
Y=([MeterArtistLabel:H]-[MeterArtistValue:H])r
W=#RW#
FontSize=18
---Meters---
[MeterSeparator0]
Meter=Shape
MeterStyle=SBase | SLeftCol
W=(#LW#+#RW#)
H=(#SW#)
Padding=0,(Max([MeterArtistLabel:H],[MeterArtistValue:H])*0.25),0,(Max([MeterArtistLabel:H],[MeterArtistValue:H])*0.25)
Shape=Line 0,(#SW#/2),(#LW#+#RW#),(#SW#/2) | StrokeWidth #SW# | Stroke Color 255,255,255,255
DynamicVariables=1
[MeterArtistLabel]
Meter=STRING
MeterStyle=SBase | SLeftCol
Text="Artist"
DynamicVariables=1
[MeterArtistValue]
Meter=STRING
MeterStyle=SBase | SRightCol
Text=": #LastArtist#"
DynamicVariables=1
[MeterAlbumLabel]
Meter=STRING
MeterStyle=SBase | SLeftCol
Text="Album"
DynamicVariables=1
[MeterAlbumValue]
Meter=STRING
MeterStyle=SBase | SRightCol
Text=": #LastAlbum#"
DynamicVariables=1
[MeterYearLabel]
Meter=STRING
MeterStyle=SBase | SLeftCol
Text="Year"
DynamicVariables=1
[MeterYearValue]
Meter=STRING
MeterStyle=SBase | SRightCol
Text=": #LastYear#"
DynamicVariables=1
[MeterTrackLabel]
Meter=STRING
MeterStyle=SBase | SLeftCol
Text="Track"
DynamicVariables=1
[MeterTrackValue]
Meter=STRING
MeterStyle=SBase | SRightCol
Text=": #LastTrack#"
DynamicVariables=1
[MeterLengthLabel]
Meter=STRING
MeterStyle=SBase | SLeftCol
Text="Length"
DynamicVariables=1
[MeterLengthValue]
Meter=STRING
MeterStyle=SBase | SRightCol
Text=": #LastLength#"
DynamicVariables=1
[MeterTitleLabel]
Meter=STRING
MeterStyle=SBase | SLeftCol
Text="Song"
DynamicVariables=1
[MeterTitleValue]
Meter=STRING
MeterStyle=SBase | SRightCol
Text=": #LastTitle#"
DynamicVariables=1
[MeterFeaturingLabel]
Meter=STRING
MeterStyle=SBase | SLeftCol
Text="Featuring"
DynamicVariables=1
[MeterFeaturingValue]
Meter=STRING
MeterStyle=SBase | SRightCol
Text=": #LastFeaturing#"
DynamicVariables=1
[MeterProgressLabel]
Meter=STRING
MeterStyle=SBase | SLeftCol
Text="Progress"
DynamicVariables=1
[MeterProgressColon]
Meter=STRING
MeterStyle=SBase | SRightCol
W=#CW#
Text=":"
DynamicVariables=1
[MeterProgressValueTopGap]
Meter=Image
MeterStyle=SBase | SRightCol
Y=0r
W=250
H=([MeterArtistValue:H]*0.35)
DynamicVariables=1
[MeterProgressValue]
Group=BarGroup
Meter=BAR
MeterStyle=SBase | SRightCol
X=0r
Y=0R
W=250
H=([MeterArtistValue:H]*0.5)
SolidColor=150,150,150,255
BarColor=250,250,250,210
BarOrientation=Horizontal
MeasureName=MeasureProgress
DynamicVariables=1
[MeterProgressValueBottomGap]
Meter=Image
MeterStyle=SBase | SRightCol
X=0r
Y=0R
W=250
H=([MeterArtistValue:H]*0.15)
DynamicVariables=1
[MeterSeparator1]
Meter=Shape
MeterStyle=SBase | SLeftCol
W=(#LW#+#RW#)
H=(#SW#)
Padding=0,(Max([MeterArtistLabel:H],[MeterArtistValue:H])*0.25),0,(Max([MeterArtistLabel:H],[MeterArtistValue:H])*0.25)
Shape=Line 0,(#SW#/2),(#LW#+#RW#),(#SW#/2) | StrokeWidth #SW# | Stroke Color 255,255,255,255
DynamicVariables=1
[MeterRepeatLabel]
Meter=STRING
MeterStyle=SBase | SLeftCol
Text="Repeat"
DynamicVariables=1
[MeterRepeatValue]
Meter=STRING
MeterStyle=SBase | SRightCol
MeasureName=MeasureRepeat
Text=": %1"
DynamicVariables=1
[MeterShuffleLabel]
Meter=STRING
MeterStyle=SBase | SLeftCol
Text="Shuffle"
DynamicVariables=1
[MeterShuffleValue]
Meter=STRING
MeterStyle=SBase | SRightCol
MeasureName=MeasureShuffle
Text=": %1"
DynamicVariables=1
[MeterStateLabel]
Meter=STRING
MeterStyle=SBase | SLeftCol
Text="State"
DynamicVariables=1
[MeterStateValue]
Meter=STRING
MeterStyle=SBase | SRightCol
Text=": #LastState#"
DynamicVariables=1
[MeterVolumeLabel]
Meter=STRING
MeterStyle=SBase | SLeftCol
Text="Volume"
DynamicVariables=1
[MeterVolumeColon]
Meter=STRING
MeterStyle=SBase | SRightCol
W=#CW#
Text=":"
DynamicVariables=1
[MeterVolumeValueTopGap]
Meter=Image
MeterStyle=SBase | SRightCol
Y=0r
W=250
H=([MeterArtistValue:H]*0.35)
DynamicVariables=1
[MeterVolumeValue]
Group=BarGroup
Meter=BAR
MeterStyle=SBase | SRightCol
X=0r
Y=0R
W=250
H=([MeterArtistValue:H]*0.5)
SolidColor=150,150,150,255
BarColor=250,250,250,210
BarOrientation=Horizontal
MeasureName=MeasureVolume
DynamicVariables=1
[MeterVolumeValueBottomGap]
Meter=Image
MeterStyle=SBase | SRightCol
X=0r
Y=0R
W=250
H=([MeterArtistValue:H]*0.15)
DynamicVariables=1
[MeterSeparator2]
Meter=Shape
MeterStyle=SBase | SLeftCol
W=(#LW#+#RW#)
H=(#SW#)
Padding=0,(Max([MeterArtistLabel:H],[MeterArtistValue:H])*0.25),0,(Max([MeterArtistLabel:H],[MeterArtistValue:H])*0.25)
Shape=Line 0,(#SW#/2),(#LW#+#RW#),(#SW#/2) | StrokeWidth #SW# | Stroke Color 255,255,255,255
DynamicVariables=1
[MeterStatusLabel]
Meter=STRING
MeterStyle=SBase | SLeftCol
Text="Status"
DynamicVariables=1
[MeterStatusValue]
Meter=STRING
MeterStyle=SBase | SRightCol
MeasureName=MeasureStatus
Text=": %1"
DynamicVariables=1
[MeterSeparator3]
Meter=Shape
MeterStyle=SBase | SLeftCol
W=(#LW#+#RW#)
H=(#SW#)
Padding=0,(Max([MeterArtistLabel:H],[MeterArtistValue:H])*0.25),0,(Max([MeterArtistLabel:H],[MeterArtistValue:H])*0.25)
Shape=Line 0,(#SW#/2),(#LW#+#RW#),(#SW#/2) | StrokeWidth #SW# | Stroke Color 255,255,255,255
DynamicVariables=1
Enjoy!