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: [Feature request] $directory(x,-n) count dir from root. (Read 1166 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

[Feature request] $directory(x,-n) count dir from root.

Currently foobar supports $directory(x,n) to supply a string containing the name of the directory n levels above the file played. Because foobar supports various mixes of embedded cue files, external cue files, music in archives (zip,rar,etc), and archives with and without subdirectories this produces highly unpredictable output. Imagine the following directory structue:
Code: [Select]
X:\music\[tvshows]\<tvshowname>\soundtrack1\disk1\disk1.flac
X:\music\[tvshows]\<tvshowname>\soundtrack1\disk2\disk2.flac
X:\music\[tvshows]\<tvshowname>\soundtrack2\disk.flac
X:\music\[games]\<gamename>\soundtrack\disk.flac
X:\music\[bands]\<bandname>\single1.rar|disk.flac
X:\music\[bands]\<bandname>\album3.zip|audio/disk1/disk.flac
X:\music\[bands]\<bandname>\album3.zip|audio/disk2/disk.flac

Now i would like to extract the <third folder> (and possible the [second one]) to show it in the playlist, easily add corresponding tags to the files, etc. For this you currently have to use ugly and probably unreliable monsters like:
Code: [Select]
$directory(%path%,$sub($len(%path%),$len($replace(%path%,\,,|,,/,)),n))
which counts the directories by the number of "\","|" and "/" contained in %path%. I think it would be far easier and look nicer if $directory(x,n), which counts down from the played file, could be supplied with a negative n value to ask it to count up from the root instead. Or if that seems like function overloading call the new function something else. From my technical knowledge i'd guess this shouldn't be too hard to implement?

Looking forward to your replies.
Regards, Lossycrypt.