Library Filter in Foobar

So, following up on my latest Foobar post, my needs went further. I use two notebooks — on has a 1TB HDD and all my music is stored locally, the other one has only 256GB and I access the music either through a backup on my network drive or I just use the iTunes library (for the music bought in the iTunes Store). To streamline my music listening I added all three sources into Foobar as library sources. But now virtually all my songs are duplicated and while it doesn't stop Foobar from playing through full albums, it still spews out 'file not found' errors, which is certainly unneccessary. So I was roaming the internet in search for a smart way to automatically ignore disconnected drives and hide temporarily unavailable songs. No luck. So I just sat down and wrote another Filter which now resides on my Foobar homescreen:

lib

As I know when to use which library, I just select the one I want to use at the moment, and all is well. To achieve this result I used this query:

$if($strstr(%path%,iTunes),iTunes,$if($strstr(%path%,192),Backup,$if($strstr(%path%,C:\),C:\)))

It's dead simple, it contains three enclosed if's: twice a $if(cond,then,else) and once an $if(cond,then). Inside all three if's the cond equals to $strstr(path,string), where path = %path% (the path to the file) and string is something unique that can only be found in the path of the specific library. For iTunes it's iTunes, for the network drive it's 192, for the local library it's C:\ (well, that one is not really unique, but it's evaluated after iTunes, so whatever).

Also, for this (and the script from the previous post) to work make sure to correct the filter precedence in Preferences:

prec

Share
Pin
Like
Send
Share
Send
Send
Share
Anton Zujev
Ostrava, Czechia