It is currently September 16th, 2024, 10:41 am

Hide/Change Cover on Update (WebNowPlaying)

General topics related to Rainmeter.
Aryx
Posts: 41
Joined: December 20th, 2023, 9:18 am

Hide/Change Cover on Update (WebNowPlaying)

Post by Aryx »

I'll be vague, since I have not experimented with WebNowPlaying a lot. Apologies in advance.
I made a skin (obviously), and am experiencing a difficulty - if I Refresh or Close the Media's Source, even then the last media's cover is retained. This behaviour does not happen when next track/previous track is played.

Is it something I am doing wrong or is the plugin at fault?

Code: Select all

[MeasureCover]
Measure=Plugin
Plugin=WebNowPlaying
PlayerType=Cover
;<Don't know if OnChangeAction is needed or not, but, since it was not updating, I thought - Why not?>
OnChangeAction=[!UpdateMeter M_Cover]
Group=Info

;<They are dynamic in nature, but, uneeded for the question. For the time being, use any values.>
[M_Background]
Meter=Shape
X=0
Y=(#MinY#+1)
W=(#CMinWH#)
H=(#CMinWH#)
Shape=Rectangle 0,0,#CMinWH#,#CMinWH# | Fill Color 0,1,0,1
DynamicVariables=1

[M_Cover]
Meter=IMAGE
MeasureName=MeasureCover
X=([BG:X])
Y=([BG:Y])
W=([BG:W])
H=([BG:H])
PreserveAspectRatio=1

;<... Uneeded Code ... Mouse Clicks and Scrolls, etc.>

Container=M_Fake_Background
DynamicVariables=1
Group=Cover
What I want - If there is no media playing, display a default or no cover.
Sorry, if this has been asked already been asked.
User avatar
eclectic-tech
Rainmeter Sage
Posts: 5516
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

Re: Hide/Change Cover on Update (WebNowPlaying)

Post by eclectic-tech »

That is normal behavior for the plugin; it saves the cover image in Rainmeter's temp area and will display that image until it is replaced.

When playing, your [M_Cover] meter uses the MeasureName=MeasureCover; this will take precedent over any ImageName setting in the meter.

You can override that by testing the Duration measure's String value; It is "00:00" when no video is playing.
Use an IfMatch to check for that string value and take actions to change the cover meter to use your ImageName={youtnocoverimage} and set the MeasureName="" when nothing is playing.

Something like this:

Code: Select all

[Duration]
Measure=Plugin
Plugin=WebNowPlaying
PlayerType=Duration
RegExpSubstitute=1
Substitute="(?<!\d)(\d)(?!\d)":"0\1"
DynamicVariables=1
IfMatch="00:00"
IfMatchAction=[!SetOption M_Cover MeasureName ""][!SetOption M_Cover ImageName "#@#Images\NoCover.png"][!UpdateMeter M_Cover][!Redraw]
IfNotMatchAction=[!SetOption M_Cover MeasureName "MeasureCover"][!SetOption M_Cover ImageName ""][!UpdateMeter M_Cover][!Redraw]

...

[M_Cover]
Meter=Image
MeasureName=MeasureCover
X=([BG:X])
Y=([BG:Y])
W=([BG:W])
H=([BG:H])
PreserveAspectRatio=1
ImageName=

The downside of this method is that your nocover image will appear for second when the video changes images.
Aryx
Posts: 41
Joined: December 20th, 2023, 9:18 am

Re: Hide/Change Cover on Update (WebNowPlaying)

Post by Aryx »

A short and simple solution. Worked like a charm!
I don't really mind the downside to be honest - as long as it was getting updated.
Thank you!
User avatar
eclectic-tech
Rainmeter Sage
Posts: 5516
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

Re: Hide/Change Cover on Update (WebNowPlaying)

Post by eclectic-tech »

Happy to help