It is currently March 29th, 2024, 5:53 am

Some problems regarding NowPlaying ("state" and "play")

Get help with creating, editing & fixing problems with skins
ingridd
Posts: 17
Joined: June 20th, 2021, 1:38 am

Some problems regarding NowPlaying ("state" and "play")

Post by ingridd »

hello! recently, I have been working on a NowPlaying meter on my skin, and there are several problems I have encountered so far.

Firstly, I had wanted to make a sort of a button to play the song on Spotify. below is the original code used to make that button.

Code: Select all

[MeasureNowPlaying]
Measure=NowPlaying
PlayerName=Spotify
PlayerType=Title

;--- other meters ---

[MeterPlay]
Meter=Image
Hidden=1
SolidColor=0,0,0,1
DynamicVariables=1
ImageName=#@#play.png
ImageAlpha=100
PreserveAspectRatio=1
W=20
X=130
Y=85
MouseOverAction=[!SetOption "MeterPlay" ImageAlpha "200"]
MouseLeaveAction=[!SetOption "MeterPlay" ImageAlpha "100"]
LeftMouseUpAction=[!CommandMeasure "MeasureNowPlaying" "Play"]
However, the problem with that is if the song was already playing, it would pause the song, which wasn't what I had in mind.
Since this happened, what I did next was that I decided I could do with one button that played if pressed when the song was paused (and vice versa). I modified my code a bit so that the image for the button itself would change. However, what happened next was the image for the button which was supposed to change depending on the state of the player did not change regardless as to whether the song was played or paused. I thought maybe this had to do with the state not updating, so I included the state inside one of my meters (the "NPHead"), and turns out the state actually doesn't get updated. below is my code used to do that

Code: Select all

[Rainmeter]
Update=16

[MeterBackground]
Meter=Shape
Shape=Rectangle 0,0,300,115 | Fill Color 255,255,255,0 | Stroke Color 255,255,255,0
SolidColor=0,0,0,1
MouseOverAction=[!SetOption "MeterNPLine" Shape "Rectangle ([MeterNPHead:X]+90), 10, 2, 105 | Fill Color 255,255,255,100 | Stroke Color 255,255,255,150"][!UpdateMeter "MeterNPLine"][!ShowMeter MeterPlay][!Redraw]
MouseLeaveAction=[!SetOption "MeterNPLine" Shape "Rectangle ([MeterNPHead:X]+90), 10, 2, 75 | Fill Color 255,255,255,100 | Stroke Color 255,255,255,150"][!UpdateMeter "MeterNPLine"][!HideMeter MeterPlay][!Redraw]

[MeasureNowPlaying]
Measure=NowPlaying
PlayerName=Spotify
PlayerType=Title

[MeasureArtist]
Measure=NowPlaying
PlayerName=[MeasureNowPlaying]
PlayerType=Artist

[MeasureState]
Measure=NowPlaying
PlayerName=[MeasureNowPlaying]
PlayerType=State
IfCondition=(MeasureState=1)
IfTrueAction=[!SetOption "MeterPlay" "ImageName" "#@#pause.png"][!UpdateMeter "MeterPlay"][!Redraw]
IfFalseAction=[!SetOption "MeterPlay" "ImageName" "#@#play.png"][!UpdateMeter "MeterPlay"][!Redraw]

[MeterNPHead]
Meter=String
Text=Now#CRLF#Playing#CRLF#[MeasureState]
StringCase=lower
FontColor=255,255,255,150
FontFace=Montserrat Medium
AntiAlias=1
FontSize=14
DynamicVariables=1
SolidColor=0,0,0,1
Y=20

[MeterNPLine]
Meter=Shape
DynamicVariables=1
Shape=Rectangle ([MeterNPHead:X]+90), 10, 2, 75 | Fill Color 255,255,255,100 | Stroke Color 255,255,255,150
SolidColor=0,0,0,1

[MeterNPName]
Meter=String
MeasureName=MeasureNowPlaying
FontColor=255,255,255,150
ClipString=1
W=170
H=40
FontFace=Montserrat Medium
AntiAlias=1
FontSize=20
DynamicVariables=1
X=100
Y=10
SolidColor=0,0,0,1

[MeterNPArtist]
Meter=String
Text=by [MeasureArtist]
ClipString=1
W=170
H=20
FontColor=255,255,255,150
FontFace=Montserrat Medium
AntiAlias=1
FontSize=11
DynamicVariables=1
X=105
Y=55
SolidColor=0,0,0,1

[MeterPlay]
Meter=Image
Hidden=1
SolidColor=0,0,0,1
DynamicVariables=1
ImageName=#@#play.png
ImageAlpha=100
PreserveAspectRatio=1
W=20
X=130
Y=85
MouseOverAction=[!SetOption "MeterPlay" ImageAlpha "200"]
MouseLeaveAction=[!SetOption "MeterPlay" ImageAlpha "100"]
LeftMouseUpAction=[!CommandMeasure "MeasureNowPlaying" "PlayPause"]
Right now, I would be happy if there is a solution to any of the two problems as mentioned, which would help me complete my meter.
Any help would be appreciated!
(sorry for the messy code btw, no idea how to make it into code block)

Thanks in advance ;-) :D
Last edited by SilverAzide on June 20th, 2021, 2:32 am, edited 1 time in total.
Reason: Use the Code button to post code instead of Snippet. Code is the "</>" button.
User avatar
death.crafter
Rainmeter Sage
Posts: 1399
Joined: April 24th, 2021, 8:13 pm

Re: Some problems regarding NowPlaying ("state" and "play")

Post by death.crafter »

ingridd wrote: June 20th, 2021, 2:12 am Thanks in advance ;-) :D
Spotify doesn't support state in NowPlaying. But WebNowPlaying and spicetify-cli does.

First you have to install spicetify.
Follow this guide: https://github.com/khanhas/spicetify-cli/wiki/Guide-for-Rainmeter-user

Then get the WebNowPlaying plugin (just install the example rmskin.)
Link: https://github.com/tjhrulz/WebNowPlaying/releases/tag/0.5.0

And then follow the skin and the readme : https://github.com/tjhrulz/WebNowPlaying.

If further problem arises fell free to reply.
from the Realm of Death
ingridd
Posts: 17
Joined: June 20th, 2021, 1:38 am

Re: Some problems regarding NowPlaying ("state" and "play")

Post by ingridd »

death.crafter wrote: June 20th, 2021, 4:22 am Spotify doesn't support state in NowPlaying. But WebNowPlaying and spicetify-cli does.

First you have to install spicetify.
Follow this guide: https://github.com/khanhas/spicetify-cli/wiki/Guide-for-Rainmeter-user

Then get the WebNowPlaying plugin (just install the example rmskin.)
Link: https://github.com/tjhrulz/WebNowPlaying/releases/tag/0.5.0

And then follow the skin and the readme : https://github.com/tjhrulz/WebNowPlaying.

If further problem arises fell free to reply.

thank you for your reply! i didn't realise that "state" isnt supported for spotify, so i will definitely try your suggestion out and let you know
how it turns out.

other than that, do you have any idea why LeftMouseUpAction = !CommandMeasure "MeterPlay" "Play" caused the Spotify player to pause when it is playing, although it should not have caused that?

thank you again for your help~
User avatar
death.crafter
Rainmeter Sage
Posts: 1399
Joined: April 24th, 2021, 8:13 pm

Re: Some problems regarding NowPlaying ("state" and "play")

Post by death.crafter »

ingridd wrote: June 20th, 2021, 7:38 am thank you for your reply! i didn't realise that "state" isnt supported for spotify, so i will definitely try your suggestion out and let you know
how it turns out.

other than that, do you have any idea why LeftMouseUpAction = !CommandMeasure "MeterPlay" "Play" caused the Spotify player to pause when it is playing, although it should not have caused that?

thank you again for your help~
Given the fact that spotify is not fully supported and it keeps changing, play and playpause work pretty much the same.

But then again it shouldn't matter. Reasons obvious.
from the Realm of Death
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Some problems regarding NowPlaying ("state" and "play")

Post by balala »

ingridd wrote: June 20th, 2021, 7:38 am other than that, do you have any idea why LeftMouseUpAction = !CommandMeasure "MeterPlay" "Play" caused the Spotify player to pause when it is playing, although it should not have caused that?
Beside death.crafter's reply, note that I'm not sure it caused that, because although in the first posted code you have the option as asked above (LeftMouseUpAction=[!CommandMeasure "MeasureNowPlaying" "Play"]), in the second code posted in the same post, you have the option this way: LeftMouseUpAction=[!CommandMeasure "MeasureNowPlaying" "PlayPause"], which means not the Play parameter of the bang caused the player to pause, but the PlayPause.
User avatar
death.crafter
Rainmeter Sage
Posts: 1399
Joined: April 24th, 2021, 8:13 pm

Re: Some problems regarding NowPlaying ("state" and "play")

Post by death.crafter »

balala wrote: June 20th, 2021, 9:59 am Beside death.crafter's reply, note that I'm not sure it caused that, because although in the first posted code you have the option as asked above (LeftMouseUpAction=[!CommandMeasure "MeasureNowPlaying" "Play"]), in the second code posted in the same post, you have the option this way: LeftMouseUpAction=[!CommandMeasure "MeasureNowPlaying" "PlayPause"], which means not the Play parameter of the bang caused the player to pause, but the PlayPause.
Actually no. "play" and "playpause" do the same thing (tried myself).

This should be changed in the docs. But both work so not that critical.
from the Realm of Death
User avatar
Active Colors
Moderator
Posts: 1251
Joined: February 16th, 2012, 3:32 am
Location: Berlin, Germany

Re: Some problems regarding NowPlaying ("state" and "play")

Post by Active Colors »

death.crafter wrote: June 20th, 2021, 10:14 am Actually no. "play" and "playpause" do the same thing (tried myself).

This should be changed in the docs. But both work so not that critical.
No. Probably it is like that in your player. In AIMP when you play already playing track it will be played from the start. Don't touch the docs :twisted:
User avatar
death.crafter
Rainmeter Sage
Posts: 1399
Joined: April 24th, 2021, 8:13 pm

Re: Some problems regarding NowPlaying ("state" and "play")

Post by death.crafter »

Active Colors wrote: June 20th, 2021, 11:59 am No. Probably it is like that in your player. In AIMP when you play already playing track it will be played from the start. Don't touch the docs :twisted:
Umm you missed the player specified by the OP :P
from the Realm of Death
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Some problems regarding NowPlaying ("state" and "play")

Post by balala »

death.crafter wrote: June 20th, 2021, 10:14 am Actually no. "play" and "playpause" do the same thing (tried myself).
No, at all. I never seen anything like this. But let's note first the following: I'm using ONLY Windows 10's Music Groove and Movies & TV to play media files. However since Windows Media Player is still present on my system this is the only player I can try out with. But at least with WMP, everything works well: Play starts playing the current track, Pause pauses it, while PlayPause does what is has to do (plays and pauses according to the state). I don't have installed and won't install neither Spotify, nor AIMP (nor any other player), however would be extremely weird if Play was pausing the player (or am I wrong?).
But take into account that, as has been said, Spotify is just a partly supported player, so might have such problems. I posted my reply only because saw the mentioned difference between the two codes of OP.
User avatar
death.crafter
Rainmeter Sage
Posts: 1399
Joined: April 24th, 2021, 8:13 pm

Re: Some problems regarding NowPlaying ("state" and "play")

Post by death.crafter »

balala wrote: June 20th, 2021, 2:51 pm No, at all. I never seen anything like this. But let's note first the following: I'm using ONLY Windows 10's Music Groove and Movies & TV to play media files. However since Windows Media Player is still present on my system this is the only player I can try out with. But at least with WMP, everything works well: Play starts playing the current track, Pause pauses it, while PlayPause does what is has to do (plays and pauses according to the state).
But take into account that, as has been said, Spotify is just a partly supported player, so might have such problems. I posted my reply only because saw the mentioned difference between the two codes of OP.
Actually I stated it wrong. The OP's question was Spotify oriented and I really haven't used any other media player than Spotify. So I just said the edit of docs regarding Spotify.
balala wrote: June 20th, 2021, 2:51 pm I don't have installed and won't install neither Spotify, nor AIMP (nor any other player), however would be extremely weird if Play was pausing the player (or am I wrong?).
Extremely true. And I am wondering why wouldn't they add the information I mentioned above in the docs. After all WebNowPlaying is an excellent plugin and combined with spicetify-cli it brings full support to Spotify, which probably is one of the most widely used music app.
from the Realm of Death