Help with xlabel syntax? Thread last updated on 2008-02-22 07:57:16

Posted by member 134680 on 2008-02-21 10:30:22

Ok, here is the deal. I am trying to do a coverart thing for my latest theme... its being a PITA but so far I have this:
I am using a winamp plugin called whatsplaying to write the current playing song to a text file in the theme dir. I am then using an evar in litestep as follows:
coverart "[beforeLast(firstLine('$themedir$whatsplaying.txt'),'\')]\folder.jpg"

Using xlabel with "text" value produces the correct text string, a full file path to the image.jpg for the coverart.
Now, when I use this same evar for an onlick to refresh a label for the image (for testing, will auto it later) with this:
!execute [!ParseEvars] [!LabelRefresh tabsystray_ tabsystray_image $coverart$]
I get nothing. The label becomes invisible instead.
Is there some weird syntax I have to change? am I forgetting something?
If I can get this to work, its GG.
-Ash

Posted by member 212670 on 2008-02-21 10:45:47 link

Try using something like...
!ParseEvars !LabelRefresh yourlabel yourlabelImage "%[beforeLast(firstLine('$themedir$whatsplaying.txt'),'')]%\folder.jpg"


Note the surrounding %[...]% syntax.

If you want to share the evar with some other function, instead try !ParseEvars !SetEvar yourlabelImage "%[...}%" and then you can use $yourlabelImage$ (or %#...%# depending) for the value.

(edited because I misunderstood something you wanted. :P)

Posted by member 134680 on 2008-02-21 11:05:03 link

Hmm, no luck there. It is most strange.
Im pretty sure it has to do with parsing evars though.
-Ash

Posted by member 212670 on 2008-02-21 11:11:27 link

Try in a command...
!ParseEvars !SetEvar yourlabelImage "%[beforeLast(firstLine('$themedir$whatsplaying.txt'),'')]%\folder.jpg"

and then...
!alert "$yourlabelImage$"

...to see if the var is being properly set.

Posted by member 134680 on 2008-02-21 11:17:11 link

Its coming up with the info as if parseevars has not been done. For some reason it isnt parsing the evars.
-Ash

Posted by member 212670 on 2008-02-21 11:22:35 link

Don't know what to tell ya... I just tested the above in a command with a test.txt, using the above bangs, and it worked perfectly. (btw, you probably don't need the beforeLast part.)

Posted by member 134680 on 2008-02-21 11:27:37 link

Seems I found the error.
It has to do with the !execute [!blah blah] stuff. Doesnt like the [] even though documentation says to use it.
Thanks for the help!
-Ash

Posted by member 212670 on 2008-02-21 11:28:01 link

Update:

Ok, here's a potential problem. When the path is being written to the text file, does it include the quotes? You do NOT want the quotes written to the file. Just the path. Not sure if that winamp addon will let you format the quotes out or what, but I just tried it with a quoted line in my test.txt and it failed.

edit - ok, if you got it, cool.

Posted by member 134680 on 2008-02-21 11:33:33 link

update: seems that the execute command was actually breaking the parsevars, rather than the brackects.
Will need to make creative use of timer. :D
-Ash

Posted by member 93947 on 2008-02-22 07:57:16 link

I'll paste you the code i use ( you could have asked me straight away ;):
WinampButtonText "[if(winampPlaying)][line('$WINAMP_OUTFILE$', '2')][line('$WINAMP_OUTFILE$', '1')][elseif(winampPaused)]ResumeWinamp[else]StartWinamp![endif]"

;; displays artist and stuff on the label, guess you got that

WINAMP_COVERPATH "%[beforeLast(line('$WINAMP_OUTFILE$','4'), '')]%/.folder.png" ;; strips the .mp3 filename and adds /.folder

;;This bang refreshes the label
!ParseEvars !LabelRefresh CoverLabel CoverOverImage "$WINAMP_COVERPATH$"

i actually use a lua script (suprise, suprise) to check if the image actually exists:
-- wa is some class for winamp stuff, wa.tip is the label that displays the cover art. When the artist/song label changes its text, it runs !luaexec wa:update()

function wa:update() -- update function
lslua.exec("!ParseEvars !SetEvar CurrentCover '$WINAMP_COVERPATH$'") -- save to a evar so i can check if the file exists
if lfs.attributes(evar.CurrentCover) then -- file exists
if evar.CoverOverImage ~= evar.CurrentCover then
lslua.exec("!ParseEvars !LabelRefresh CoverLabel CoverOverImage %[exportedevar('CurrentCover')]%")
end
self.tip:show()
else
self.tip:hide()
end
end