In my Foobar config I have a progress bar the width of the entire config. I want to add a little visual mark at the point where a track will be submitted to Audioscrobbler/Last.fm. The "rules" for this are quite clear:
QUOTE
1-The track must be submitted once it has finished playing. Whether it has finished playing naturally or has been manually stopped by the user is irrelevant.
2-The track must have been played for a duration of at least 240 seconds or half the track's total length, whichever comes first. Skipping or pausing the track is irrelevant as long as the appropriate amount has been played.
3-The total playback time for the track must be more than 30 seconds. Do not submit tracks shorter than this.
4-Unless the client has been specially configured, it should not attempt to interpret filename information to obtain metadata instead of tags (ID3, etc).
2-The track must have been played for a duration of at least 240 seconds or half the track's total length, whichever comes first. Skipping or pausing the track is irrelevant as long as the appropriate amount has been played.
3-The total playback time for the track must be more than 30 seconds. Do not submit tracks shorter than this.
4-Unless the client has been specially configured, it should not attempt to interpret filename information to obtain metadata instead of tags (ID3, etc).
No I'm stuck at 2. My code thus far is:
CODE
$ifgreater(
$div(%length_seconds%,2),
240,
$drawrect($mul(240,$div(%_width%,%length_seconds%)),$sub(%_height%,205),1,10,brushColor-255-255-255 penColor-255-255-255),
$drawrect($div(%_width%,2),$sub(%_height%,205),1,10,brushColor-255-255-255 penColor-255-255-255)
)
$div(%length_seconds%,2),
240,
$drawrect($mul(240,$div(%_width%,%length_seconds%)),$sub(%_height%,205),1,10,brushColor-255-255-255 penColor-255-255-255),
$drawrect($div(%_width%,2),$sub(%_height%,205),1,10,brushColor-255-255-255 penColor-255-255-255)
)
"Mathematically" this code is correct (I strongly believe):
-First it checks what is greater: 1/2 of the song or 240 seconds.
-If 1/2 song>240 seconds, it's going to draw a line at the 240 seconds (4.00 minutes) point,
-otherwise it'll draw a line at the 1/2 song point.
But if this is executed:
CODE
$drawrect($mul(240,$div(%_width%,%length_seconds%)),$sub(%_height%,205),1,10,brushColor-255-255-255 penColor-255-255-255)
The line is always at more or less the same point, which is 240 or 480 pixels from the left of the screen. I believe this is because $div(%_width%,%length_seconds%) always produces a whole number.
Here lies my problem: is this correct, and if so, can I "fix" (work around) it?
Thanks in advance for your help.
