Give this a shot:
if (number == '') { return '';}
var str = '' + number;
while (str.length < length) {
str = '0' + str;
}
return str;
}
function ifnotempty(value,sep){
return value.length > 0 ? value + sep : '';
}
function ifnotempty2(value1,value2,sep){
return value1.length > 0 ? value1 + sep :value2.length > 0 ? value2 + sep:'' ;
}
'Compilations/' + ifnotempty(album,folderseparator) + ifnotempty(disctotal,' - ') + ifnotempty(pad(trackno,2),' - ') + ifnotempty2(albumartist,artist,' - ') + title
It should return ~/Compilations/Album/Diskno - Trackno - Artist - Title.ext
It’s actually for jaikoz, but it might work:
a few remarks:
- I haven’t tried it myself, so if you try it, please do so with a couple of copied files, so it doesn’t corrupt your whole database, if I made a mistake.
- This will put ALL albums in a Compilations subfolder, since I didn’t figure out how to make it work with a compilations flag.
If someone has any corrections, or suggestions: please, don’t be shy.