It is currently November 13th, 2018, 3:34 am

NowPlaying returns wrong State value

Report bugs with the Rainmeter application and suggest features.
Xopa
Posts: 1
Joined: October 27th, 2017, 11:46 pm

NowPlaying returns wrong State value

Xopa » October 28th, 2017, 12:11 am

Hello. I am using latest Rainmeter (r2947) and iTunes 12.6.2. Here is my simple music player script:

Code: Select all

[Rainmeter]
Update=1000
AccurateText=1

[MeasurePlayer]
Measure=Plugin
Plugin=NowPlaying
PlayerName=iTunes
PlayerType=State

[MeterPlaying]
Measure=Calc
Formula=MeasurePlayer = 1 ? 1 : 0
IfEqualValue=0
IfEqualAction=[!ShowMeter MeterButtonPlay][!HideMeter MeterButtonPause]
IfAboveValue=0
IfAboveAction=[!HideMeter MeterButtonPlay][!ShowMeter MeterButtonPause]

[MeterButtonBack]
Meter=Image
ImageName=#@#back.png
X=10
Y=10
W=20
H=20
LeftMouseDownAction=[!CommandMeasure "MeasurePlayer" "Previous"][!CommandMeasure "MeasurePlayer" "Play"]

[MeterButtonPlay]
Meter=Image
ImageName=#@#play.png
X=40
Y=10
W=20
H=20
LeftMouseDownAction=[!HideMeter MeterButtonPlay][!ShowMeter MeterButtonPause][!CommandMeasure "MeasurePlayer" "Play"][!Update]

[MeterButtonPause]
Meter=Image
ImageName=#@#pause.png
X=40
Y=10
W=20
H=20
LeftMouseDownAction=[!HideMeter MeterButtonPause][!ShowMeter MeterButtonPlay][!CommandMeasure "MeasurePlayer" "Pause"][!Update]
Hidden=1

[MeterButtonNext]
Meter=Image
ImageName=#@#next.png
X=70
Y=10
W=20
H=20
LeftMouseDownAction=[!CommandMeasure "MeasurePlayer" "Next"][!CommandMeasure "MeasurePlayer" "Play"]
According to documentation (https://docs.rainmeter.net/manual/plugins/nowplaying/), State value equals to 0 when music is stopped, 1 - playing, 2 - paused. So what I am doing is checking it in order to change "play" icon to "pause" and vice versa. But if you pause a song from iTunes itself and then click on previous/next button you'll encounter unwanted behaviour:
Untitled.png
As you see, state value switches to 1, while song is paused (stopped?) and this breaks the logic of my script. Is it a bug of NowPlaying.dll? Please help me in finding another way of checking player state.
You do not have the required permissions to view the files attached to this post.
User avatar
CyberTheWorm
Posts: 602
Joined: August 22nd, 2016, 11:32 pm
Location: Surrey, B.C., Canada

Re: NowPlaying returns wrong State value

CyberTheWorm » October 28th, 2017, 4:06 am

I do this but have an image for play and pause

Code: Select all

[MeasureState]
Measure=Plugin
Plugin=NowPlaying.dll
PlayerName=[MeasurePlayer]
PlayerType=State
Substitute="0":"#@#Images\play.png","1":"#@#Images\pause.png","2":"#@#Images\play.png"
The only source of knowledge is experience. Albert Einstein
Deviant Art Page