Help - Search - Members - Calendar
Full Version: Track Info Panel: randomly select image file
Hydrogenaudio Forums > Hosted Forums > foobar2000 > 3rd Party Plugins - (fb2k)
myvision
A small coding question for the PROs.

I want to display random artist images in a Track Info Panel. All my artist images are in one folder named like that: artist1.jpg artist2.jpg artist3.jpg eg. Foo Fighters1.jpg Foo Fighters2.jpg Foo Fighter3.jpg Tool1.jpg Tool2.jpg ...

Now I've done something like this:

CODE
$puts(ArtistImg,D:\Foobar2000\ArtistImages\%artist%$eval($mod($rand(),2)+1).*)


The problem is, that there must be 2 (or 3 or 4 dependent on the number in the code, here it is 2) pics of every artist in the folder.

Is there a way to find out how many artist images of the now-playing artist in the folder, and then random these pics.
So the "2" in my code must become a variable...

Does anybody have an idea or a code for me?

Thanks in advance and sorry for my bad english.
VeaaC
If you are using panels UI you can use $fileexists(File path) to check if a file exists. This can solve your problem, but you have to hardcode every possible amount of images, checking if 1,2,3,4.... are available.
myvision
Yes thank you, this was a thought of me, too. But I think of a solution which is more elegant...

This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2008 Invision Power Services, Inc.