It is currently March 28th, 2024, 11:29 pm

Cover size is wrong?

Get help with creating, editing & fixing problems with skins
User avatar
deXxterlab97
Posts: 93
Joined: February 5th, 2017, 4:50 am

Cover size is wrong?

Post by deXxterlab97 »

This is my main code

Code: Select all

[mPlayer]
Measure=Plugin
Plugin=NowPlaying
PlayerName=#PlayerName#
PlayerType=Cover

[MeterShape]
Meter=Shape
Shape=Rectangle 136, 1, (1+#ICoverSize#), (1+#ICoverSize#) | Fill Color 255,255,255,100 | StrokeWidth 3 | Stroke Color #CoverColor#
LeftMouseUpAction=!execute ["#PlayerPath#"]
ToolTipText=Launch media player

[MeterText]
Meter=STRING
Text="No cover art"
X=(#ICoverSize#/2)+135
Y=(#ICoverSize#/2)
StringAlign=CenterCenter
FontFace=#FontName#
FontColor=#FontColor#
FontSize=#FontSize#
AntiAlias=1

[MeterCover]
Meter=IMAGE
MeasureName=mPlayer
X=137
Y=2
W=#ICoverSize#
H=#ICoverSize#
PreserveAspectRatio=1
And this is my variable file

Code: Select all

[Variables]
CoverSize=100
ICoverSize=#CoverSize#*2
I use AIMP player

I have few questions:
1. I had to multiply the Cover Size by 2 to get actual size. Why is this an issue to me? It doesn't actually use the actual size but it's the size divided by 2. It's hard to explain but what I am trying to do is just making a border around my cover art. I can tell that the size that read is 200 but in reality it's only 100 wide/high as the bar I have above is 170pixel long and it's longer than the cover art. Though I am ok with multiplying it by 2

2. The above code doesn't really work. MeterShape gets drawn perfectly but not MeterCover
MeterCover is half the size of MeterShape. I tried putting W=#CoverSize#*2 and same to H but doesn't work

I did found a solution for that. But I would want to know what I am understanding wrong Because everything else I used are measured in pixels then why does this meter cover art gets measured in a weirdly?



My solution: I kept the Variable same

Code: Select all

[MeterShape]
Meter=Shape
Shape=Rectangle 136, 1, (1+#ICoverSize#*2), (1+#ICoverSize#*2) | Fill Color 255,255,255,100 | StrokeWidth 3 | Stroke Color #CoverColor#
LeftMouseUpAction=!execute ["#PlayerPath#"]
ToolTipText=Launch media player

[MeterText]
Meter=STRING
Text="No cover art"
X=(#ICoverSize#)+135
Y=(#ICoverSize#)
StringAlign=CenterCenter
FontFace=#FontName#
FontColor=#FontColor#
FontSize=#FontSize#
AntiAlias=1

[MeterCover]
Meter=IMAGE
MeasureName=mPlayer
X=137
Y=2
W=#ICoverSize#
H=#ICoverSize#
PreserveAspectRatio=1
But it took few tries and errors to figure that out.
Last edited by deXxterlab97 on April 15th, 2017, 2:35 am, edited 1 time in total.
deXxterlab97
User avatar
eclectic-tech
Rainmeter Sage
Posts: 5384
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

Re: Cover size is wrong?

Post by eclectic-tech »

All formulas that are outside of a measure, should be enclosed in parenthesis () or they may not be evaluated properly. :)

Enclose the variable 'ICoverSize' and your original code works as expected: ICoverSize=(#CoverSize#*2)

You should enclose the formula in [MeterText] also: X=((#ICoverSize#/2)+135) :sly:

Not all covers are the same size and with PreserveAspect=1 some will not fill the shape meter area... :uhuh:

Side Note: You could use LeftMouseUpAction=[!CommandMeasure mPlayer OpenPlayer] in the shape meter to have the plugin try to open the player. Notice there is no need for '!Execute' (it is deprecated), and you can use 1 less variable. ;-)
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Cover size is wrong?

Post by balala »

eclectic-tech wrote:All formulas that are outside of a measure, should be enclosed in parenthesis () or they may not be evaluated properly. :)
"Outside of a measure" is not complete. The correct sentence would be "outside of the Formula option of a Calc measure". This means that in the Formula option the parenthesis can be ignored, but eg on the MinValue or MaxValue of the same Calc measure, they can't.
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Cover size is wrong?

Post by jsmorley »

balala wrote:"Outside of a measure" is not complete. The correct sentence would be "outside of the Formula option of a Calc measure". This means that in the Formula option the parenthesis can be ignored, but eg on the MinValue or MaxValue of the same Calc measure, they can't.
Or calculations used in an IfCondition, which are also assumed to be formulas and don't require (parentheses).
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Cover size is wrong?

Post by balala »

jsmorley wrote:Or calculations used in an IfCondition, which are also assumed to be formulas and don't require (parentheses).
Right, I forgot this, sorry. But you're definitely right! Thanks for the correction.
User avatar
eclectic-tech
Rainmeter Sage
Posts: 5384
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

Re: Cover size is wrong?

Post by eclectic-tech »

Yes, there are many subtle requirements depending on where the formula resides... :?

I simply put EVERY formulas inside parenthesis, then I don't have to wonder why something is not working as expected. :D

Most days my typing gets ahead of my spelling and grammar... :oops:
User avatar
deXxterlab97
Posts: 93
Joined: February 5th, 2017, 4:50 am

Re: Cover size is wrong?

Post by deXxterlab97 »

eclectic-tech wrote: Side Note: You could use LeftMouseUpAction=[!CommandMeasure mPlayer OpenPlayer] in the shape meter to have the plugin try to open the player. Notice there is no need for '!Execute' (it is deprecated), and you can use 1 less variable. ;-)
openplayer doesn't work for me somehow, closeplayer works (and so does half the part of toggleplayer)
running aimp 4.13 build 1893 if that matters (latest)

and thanks for parenthesis, it works. other programming language seems ok with not having parenthesis, but not rainmeter :D
deXxterlab97
User avatar
eclectic-tech
Rainmeter Sage
Posts: 5384
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

Re: Cover size is wrong?

Post by eclectic-tech »

deXxterlab97 wrote:openplayer doesn't work for me somehow, closeplayer works (and so does half the part of toggleplayer)
running aimp 4.13 build 1893 if that matters (latest)

and thanks for parenthesis, it works. other programming language seems ok with not having parenthesis, but not rainmeter :D
"OpenPlayer" doesn't work for all the supported players so using a variable is the solution...

Glad to help!
User avatar
deXxterlab97
Posts: 93
Joined: February 5th, 2017, 4:50 am

Re: Cover size is wrong?

Post by deXxterlab97 »

eclectic-tech wrote:"OpenPlayer" doesn't work for all the supported players so using a variable is the solution...

Glad to help!
ah thanks a bunch
deXxterlab97