It is currently July 7th, 2020, 2:01 am

Help with now playing state on player

Help with creating, editing & fixing problems with skins
naughtywitch
Posts: 2
Joined: June 24th, 2020, 8:44 am

Help with now playing state on player

Post by naughtywitch »

so i'm using mazio player skin (https://www.deviantart.com/jlynnxx/art/Mazio-Music-Player-Rainmeter-Skin-377356409), the skin is work flawlessly but there is something that really bother me, the problem is when i press play button directly on spotify the button on the skin won't change but if i press the button on the skin it work just fine. is there any code that i need to put on .ini file to make the skin play button follow the spotify player button ?

just in case someone need the code

Code: Select all

[Variables]
@Include=#ROOTCONFIGPATH#@Resources\Variables.inc

[MeasurePlayer]
Measure=Plugin
Plugin=NowPlaying.dll
PlayerName=#Player#

[Play]
Meter=IMAGE
ImageName=#ROOTCONFIGPATH#@Resources\07.png
ImageTint=#Color1#,255
X=80
Y=50
W=40
H=42

[Play2]
Meter=IMAGE
ImageName=#ROOTCONFIGPATH#@Resources\07.png
SolidColor=0,0,0,0
X=80
Y=50
W=40
H=42
LeftMouseUpAction=[!CommandMeasure "MeasurePlayer" "Play"] [!HideMeter "Play"] [!HideMeter "Play2"] [!ShowMeter "Pause"] [!ShowMeter "Pause2"]

[Pause]
Meter=IMAGE
ImageName=#ROOTCONFIGPATH#@Resources\09.png
ImageTint=#Color1#,255
Hidden=1
X=80
Y=50
W=40
H=42

[Pause2]
Meter=IMAGE
ImageName=#ROOTCONFIGPATH#@Resources\9.png
SolidColor=0,0,0,0
Hidden=1
X=80
Y=50
W=40
H=42
LeftMouseUpAction=[!CommandMeasure "MeasurePlayer" "Pause"] [!HideMeter "Pause"] [!HideMeter "Pause2"] [!ShowMeter "Play"] [!ShowMeter "Play2"]

[Next]
Meter=IMAGE
ImageName=#ROOTCONFIGPATH#@Resources\11.png
ImageTint=#Color1#,255
X=160
Y=60
W=20
H=20
LeftMouseUpAction=[!CommandMeasure "MeasurePlayer" "Next"]

[Previous]
Meter=IMAGE
ImageName=#ROOTCONFIGPATH#@Resources\06.png
ImageTint=#Color1#,255
X=15
Y=60
W=20
H=20
LeftMouseUpAction=[!CommandMeasure "MeasurePlayer" "Previous"]
User avatar
balala
Rainmeter Sage
Posts: 10968
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Help with now playing state on player

Post by balala »

naughtywitch wrote:
June 24th, 2020, 9:16 am
so i'm using mazio player skin (https://www.deviantart.com/jlynnxx/art/Mazio-Music-Player-Rainmeter-Skin-377356409), the skin is work flawlessly but there is something that really bother me, the problem is when i press play button directly on spotify the button on the skin won't change but if i press the button on the skin it work just fine. is there any code that i need to put on .ini file to make the skin play button follow the spotify player button ?
This kind of stuffs should be done with a NowPlaying plugin measure, which has to have set the PlayerType=State option. Unfortunately for Spotify this option doesn't work, because as you can see in the list of the supported players, Spotify is just partially supported, only the Artist and Title PlayerTypes are supported, State isn't. So, you can't do what you want with NowPlaying measures.
A while ago there has been a Spotify plugin, but in meantime the author renounced to maintain it. Then a new plugin has also been released, but since I'm not using Spotify, I can say exactly neither if it is still out there, or if it exists. Probably someone else, who is using Spotify will be needed here, to advice you. Sorry...

And one more comment: the @Include=#ROOTCONFIGPATH#@Resources\Variables.inc option, used into the [Variables] section, is not the best form of this option, even if it does work in your case. The better form of this option is the following one: @Include=#@#Variables.inc. This is how you have to refer to the @Resources folder.
User avatar
Yincognito
Posts: 1866
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Help with now playing state on player

Post by Yincognito »

naughtywitch wrote:
June 24th, 2020, 9:16 am
so i'm using mazio player skin (https://www.deviantart.com/jlynnxx/art/Mazio-Music-Player-Rainmeter-Skin-377356409), the skin is work flawlessly but there is something that really bother me, the problem is when i press play button directly on spotify the button on the skin won't change but if i press the button on the skin it work just fine. is there any code that i need to put on .ini file to make the skin play button follow the spotify player button ?
To add to what balala said, the way one should approach this is to store the last playing artist / title combo, and then compare it with the current playing artist / title in order to have some action happening if these are different from each other. At least that's the way I do it in my skin. Unfortunately, this will only work when changing the playing track entirely (like playing the previous/next track, alternating between stopping and playing states), but not for alternating between the play/pause states, since there is no change in the track name then.
naughtywitch
Posts: 2
Joined: June 24th, 2020, 8:44 am

Re: Help with now playing state on player

Post by naughtywitch »

well i think i need to reconfigure my skin then or maybe looking for another way to solve this, thanks for the helps and tips!. I really appreciate that
User avatar
balala
Rainmeter Sage
Posts: 10968
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Help with now playing state on player

Post by balala »

naughtywitch wrote:
June 26th, 2020, 5:45 am
well i think i need to reconfigure my skin then or maybe looking for another way to solve this,
I still recommend to look for a specific plugin for Spotify. I suppose there is one, but unfortunately don't know it, especially that me personally don't use Spotify.
User avatar
CyberTheWorm
Posts: 704
Joined: August 22nd, 2016, 11:32 pm
Location: Surrey, B.C., Canada

Re: Help with now playing state on player

Post by CyberTheWorm »

I have been making a skin and this seems to work with Spotify

Code: Select all

[Rainmeter]
Update=1000
ContextTitle=Edit Media Player

[Metadata]
Name=Media Player
Author=CyberTheWorm
Information=Displays Artist and Track | Right click to edit Media Player
Version=1.0.0
License=Creative Commons Attribution - Non - Commercial - Share Alike 3.0

[Variables]
MyPlayer=Spotify

;-------------- Measures -------------------------

[MeasurePlayer]
Measure=NowPlaying
PlayerName=#MyPlayer#
PlayerType=Title
Substitute="":"N\A"

[MeasureArtist]
Measure=NowPlaying
PlayerName=[MeasurePlayer]
PlayerType=Artist
Substitute="":"N\A"

[MeasureState]
Measure=NowPlaying
PlayerName=[MeasurePlayer]
PlayerType=State
Substitute="0":"Play","1":"Pause","2":"Play"

[MeasureAlbum]
Measure=NowPlaying
PlayerName=#MyPlayer#
PlayerType=Album
Substitute="":"N\A"
;--------------------  Meters -------------------------

[MeterShapeRectangle]
Meter=Shape
X=0
Y=0
Shape=Rectangle 3,3,200,100 | Fill Color 32,32,32,255 | StrokeWidth 6 | StrokeColor 0,0,0,220

[MeterArtist]
X=100
Y=8
W=180
MeasureName=MeasureArtist
Meter=String
FontColor=255,255,255,255
AntiAlias=1
StringAlign=Center
CLipString=1
Text="%1"
ToolTipText=%1

[MeterTitle]
X=100
Y=18r
W=180
MeasureName=MeasurePlayer
Meter=String
FontColor=255,255,255,255
AntiAlias=1
StringAlign=Center
CLipString=1
Text=%1
ToolTipText=%1

[MeterAlbum]
X=100
Y=18r
W=180
MeasureName=MeasureAlbum
Meter=String
FontColor=255,255,255,255
AntiAlias=1
StringAlign=Center
CLipString=1
Text=%1
ToolTipText=%1

[MeterPrev]
Meter=String
X=20
Y=18r
FontColor=255,255,255,255
AntiAlias=1
StringAlign=Left
Text="Back"
LeftMouseUpAction=!CommandMeasure "MeasurePlayer" "Previous"
ToolTipText=Left Mouse Click Play/Previous Track

[MeterPlay]
Meter=String
MeasureName=MeasureState
X=100
Y=0r
FontColor=255,255,255,255
AntiAlias=1
StringAlign=Center
Text="%1"
LeftMouseUpAction=[!CommandMeasure "MeasurePlayer" "PlayPause"][!Refresh][!Refresh]
ToolTipText=Left Mouse Click Play/Pause Track

[MeterNext]
Meter=String
X=180
Y=0r
FontColor=255,255,255,255
AntiAlias=1
StringAlign=Right
Text="Next"
LeftMouseUpAction=!CommandMeasure "MeasurePlayer" "Next"
ToolTipText=Left Mouse Click Play/Next Track

[MeterPlayer]
Meter=String
X=100
Y=20r
FontColor=255,255,255,255
AntiAlias=1
StringAlign=Center
Text=#MyPlayer#
The only source of knowledge is experience. Albert Einstein
Deviant Art Page
User avatar
Yincognito
Posts: 1866
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Help with now playing state on player

Post by Yincognito »

CyberTheWorm wrote:
June 26th, 2020, 3:48 pm
I have been making a skin and this seems to work with Spotify

Code: Select all

[Rainmeter]
Update=1000
ContextTitle=Edit Media Player

[Metadata]
Name=Media Player
Author=CyberTheWorm
Information=Displays Artist and Track | Right click to edit Media Player
Version=1.0.0
License=Creative Commons Attribution - Non - Commercial - Share Alike 3.0

[Variables]
MyPlayer=Spotify

;-------------- Measures -------------------------

[MeasurePlayer]
Measure=NowPlaying
PlayerName=#MyPlayer#
PlayerType=Title
Substitute="":"N\A"

[MeasureArtist]
Measure=NowPlaying
PlayerName=[MeasurePlayer]
PlayerType=Artist
Substitute="":"N\A"

[MeasureState]
Measure=NowPlaying
PlayerName=[MeasurePlayer]
PlayerType=State
Substitute="0":"Play","1":"Pause","2":"Play"

[MeasureAlbum]
Measure=NowPlaying
PlayerName=#MyPlayer#
PlayerType=Album
Substitute="":"N\A"
;--------------------  Meters -------------------------

[MeterShapeRectangle]
Meter=Shape
X=0
Y=0
Shape=Rectangle 3,3,200,100 | Fill Color 32,32,32,255 | StrokeWidth 6 | StrokeColor 0,0,0,220

[MeterArtist]
X=100
Y=8
W=180
MeasureName=MeasureArtist
Meter=String
FontColor=255,255,255,255
AntiAlias=1
StringAlign=Center
CLipString=1
Text="%1"
ToolTipText=%1

[MeterTitle]
X=100
Y=18r
W=180
MeasureName=MeasurePlayer
Meter=String
FontColor=255,255,255,255
AntiAlias=1
StringAlign=Center
CLipString=1
Text=%1
ToolTipText=%1

[MeterAlbum]
X=100
Y=18r
W=180
MeasureName=MeasureAlbum
Meter=String
FontColor=255,255,255,255
AntiAlias=1
StringAlign=Center
CLipString=1
Text=%1
ToolTipText=%1

[MeterPrev]
Meter=String
X=20
Y=18r
FontColor=255,255,255,255
AntiAlias=1
StringAlign=Left
Text="Back"
LeftMouseUpAction=!CommandMeasure "MeasurePlayer" "Previous"
ToolTipText=Left Mouse Click Play/Previous Track

[MeterPlay]
Meter=String
MeasureName=MeasureState
X=100
Y=0r
FontColor=255,255,255,255
AntiAlias=1
StringAlign=Center
Text="%1"
LeftMouseUpAction=[!CommandMeasure "MeasurePlayer" "PlayPause"][!Refresh][!Refresh]
ToolTipText=Left Mouse Click Play/Pause Track

[MeterNext]
Meter=String
X=180
Y=0r
FontColor=255,255,255,255
AntiAlias=1
StringAlign=Right
Text="Next"
LeftMouseUpAction=!CommandMeasure "MeasurePlayer" "Next"
ToolTipText=Left Mouse Click Play/Next Track

[MeterPlayer]
Meter=String
X=100
Y=20r
FontColor=255,255,255,255
AntiAlias=1
StringAlign=Center
Text=#MyPlayer#
So [MeasureState] works as expected, changing its value correctly? You may want to post which version of Spotify you tested this with, maybe it has some relevance.

That being said, I just tried the Mazio skin posted by the OP with Winamp (which is fully supported) and there is indeed a problem with the button in the skin not updating when controlling the state of the player from the player itself. In other words, the culprit might be the code in the skin and not necessarily the fact that the OP uses Spotify.
User avatar
balala
Rainmeter Sage
Posts: 10968
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Help with now playing state on player

Post by balala »

Yincognito wrote:
June 26th, 2020, 4:07 pm
That being said, I just tried the Mazio skin posted by the OP with Winamp (which is fully supported) and there is indeed a problem with the button in the skin not updating when controlling the state of the player from the player itself. In other words, the culprit might be the code in the skin and not necessarily the fact that the OP uses Spotify.
Yeah, on the code of Mazio skin (same for both, the Dark.ini and Lite.ini), there is nothing which could set the appropriate image for the button. In fact none of the codes has a measure with a PlayerType=State option, so there is nothing to detect the state of the player, regardless of the set player. When you click the play button it changes to pause and vice-versa, if you click the pause button, it changes to play (the [Play2] and [Pause2] meters), so practically two different image meters shown alternatively. But this nothing to do with the real state of the player.
Otherwise beside this I have a problem with how the whole code is written. For example the image of the buttons are set as, for instance, ImageName=#ROOTCONFIGPATH#@Resources\07.png, which I disagree with. The correct from of this option would be ImageName=#@#07.png, as you know. Not that the existing form of the option doesn't work, but the ImageName=#@#07.png form is much better, for the probably known reasons...
User avatar
Yincognito
Posts: 1866
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Help with now playing state on player

Post by Yincognito »

balala wrote:
June 26th, 2020, 6:00 pm
Yeah, on the code of Mazio skin (same for both, the Dark.ini and Lite.ini), there is nothing which could set the appropriate image for the button. In fact none of the codes has a measure with a PlayerType=State option, so there is nothing to detect the state of the player, regardless of the set player. When you click the play button it changes to pause and vice-versa, if you click the pause button, it changes to play (the [Play2] and [Pause2] meters), so practically two different image meters shown alternatively. But this nothing to do with the real state of the player.
Otherwise beside this I have a problem with how the whole code is written. For example the image of the buttons are set as, for instance, ImageName=#ROOTCONFIGPATH#@Resources\07.png, which I disagree with. The correct from of this option would be ImageName=#@#07.png, as you know. Not that the existing form of the option doesn't work, but the ImageName=#@#07.png form is much better, for the probably known reasons...
Yep, and if I get this right, there isn't any image for the "stop" icon either. Not that it would be hard to photoshop one, after all is just a square with some emboss / shadow on it, but the images exist only for play and pause.
User avatar
balala
Rainmeter Sage
Posts: 10968
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Help with now playing state on player

Post by balala »

Yincognito wrote:
June 26th, 2020, 6:44 pm
Yep, and if I get this right, there isn't any image for the "stop" icon either. Not that it would be hard to photoshop one, after all is just a square with some emboss / shadow on it, but the images exist only for play and pause.
Yep, as said, this is not a skin written in the best possible way. Additionally it is quite old (has been published at the middle of 2013, so it has 7 years). But since I'm not the author, I definitely won't update it.