Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: A working $if string to show artwork (Read 1304 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

A working $if string to show artwork

Hey guys, I would love to be able to show my artwork but it isn't working.
By breaking down these strings it works singular, but in this format it doesn't.
$if2($replace(%path%,%filename_ext%,)BK\,$replace(%path%,%filename_ext%,)..\BK\)
or
$if2($directory_path(%path%)\BK\,$directory_path(%path%)\..\BK\)

I like to organize my library by having the tracks in the folder of each CD and some even got their own CAT, and other albums have like 10+ CD's which I don't want to dumb into 1 folder.
Someone on Reddit helped me to make these strings and told me this would be the way but it doesn't work and you should ask a developer if it could be possible to implement this feature.

For the moment I made 2 different windows with SMP > thumbs.js and splitted the string, it just isn't really optimized and clumsy.
$directory_path(%path%)\BK\
$directory_path(%path%)\..\BK\
preferably I would also want it to work with an $if3 string.
$if3($directory_path(%path%)\BK\,$directory_path(%path%)\..\BK\,$directory_path(%path%)\...\BK\)

If there would be another good way I would love to hear the suggestions but so far thumb.js has some good features.
Thank you for your time and have a wonderful day!

Re: A working $if string to show artwork

Reply #1
$if functions can't do that. You can't magically make them become sentient enough to determine what your intent is and your string is in fact a folder path and it needs to check the filesystem if it exists or not. It would need a special $is_folder function or something which is unlikely to ever happen.

I guess the thumbs.js script could be modified to handle multiple folders. Infact very old versions of the same script for components pre-dating SMP used to have that functionality but it was removed - mainly because the input box had a limitation on the number of characters it could accept. That limitation no longer exists so adding it back should be easy enough. I'll think about it.

 

Re: A working $if string to show artwork

Reply #2
Close foobar2000 and open user-components\foo_spider_monkey_panel\samples\complete\js\helpers.js in a text editor. Replace the existing _getFiles function on line 260 with this.

Code: [Select]
function _getFiles(str, exts, newest_first) {
let files = [];
const folders = str.split('|').map((item) => item.trim());
for (const folder of folders) {
if (_isFolder(folder)) {
let e = new Enumerator(fso.GetFolder(folder).Files);
for (; !e.atEnd(); e.moveNext()) {
const path = e.item().Path;
if (!exts || exts.includes(_getExt(path))) {
files.push(path);
}
}
}
}
if (newest_first) {
return _.orderBy(files, (item) => {
return _lastModified(item);
}, 'desc');
} else {
files.srt();
return files;
}
}

You can now open foobar, right click the thumbs panel>Set custom folder and separate multiple folders with a | character. Using $if won't work. If folders don't exist/are empty, they will be ignored.

Re: A working $if string to show artwork

Reply #3
highly appreciated for the support, I will add this to info to my foobar folder in case I need it for something else.

Someone on the reddit came up with a string that actually propperly works somehow.
$directory_path(%path%)\$if($stricmp($left(%directory%,3),CD-),..\,$if($stricmp($left(%directory%,5),Part-),..\..\))BK\

If there would be an update about it would also be really nice but right now it isn't necassary at least for my case,
But i will try your solution another day to see if there are other benefits with this.
Thank you again, marc2k3
Have a good one!