HydrogenAudio

Hosted Forums => foobar2000 => General - (fb2k) => Topic started by: ultrared on 2013-07-28 17:07:05

Title: $if statement in Media Library/Album List/View
Post by: ultrared on 2013-07-28 17:07:05
I'm trying to set up some views, however $if statements are either not working or I've missed something in the documentation...

Ultimately, I want to create views for 'recently added' as well as 'new unsorted' etc., but here's a simple example of the issue I'm having:

Adding a new view with this script:

$if(%genre% HAS "Rock",%album artist%,)

..i would expect it to return all album artists which contain tagged mp3s with a genre containing Rock

However it returns all album artists which have any genre, ie. the same results as

$if(%genre%,%album artist%,)

I've tried different (needlessly complicated) approaches, but to no avail. Also tried different simple examples, all seem to do the same thing. Whenever there's a HAS or IS or whatever, it ignores it and just returns 'true' for the %variable% in the statement if on its own it would be 'true'.


What am I missing?


PS. Apologies if this is the wrong forum - Tech Support is not about 'How To' and General isn't about 'Tech Support'... Please move my post if needed.

Title: $if statement in Media Library/Album List/View
Post by: foosion on 2013-07-28 17:17:14
Queries are not supported in title formatting expressions. As far as the the $if function is concerned, $if(%genre% HAS "Rock",...), $if(blah%genre%meh,...) and $if(%genre%,...) are all the same. If you want to achieve the equivalent of the %genre$ HAS Rock query inside title formatting, you have to use $if($strstr(%genre%,Rock),%album artist%).
Title: $if statement in Media Library/Album List/View
Post by: ultrared on 2013-07-28 17:33:25
Thank you for the quick answer.. I didn't see that in the documentation anywhere

$if($strstr(%genre%,Rock),%album artist%) works.

This is going to leave me with a headache though, for something like this (a recently added view):

$if(%last_modified% DURING LAST 2 WEEKS,%album artist%)

Yes, I know that won't work - but, you can see what I want it to do.

Title: $if statement in Media Library/Album List/View
Post by: db1989 on 2013-07-28 21:05:03
I didn't see that in the documentation anywhere
http://wiki.hydrogenaudio.org/index.php?ti...tting_Reference (http://wiki.hydrogenaudio.org/index.php?title=Foobar2000:Title_Formatting_Reference)
A copy of which is included with the installer, alongside the document on query syntax (http://wiki.hydrogenaudio.org/index.php?title=Foobar2000:Query_syntax). Both make it clear which separate contexts they function in.

Quote
Ultimately, I want to create views for 'recently added' as well as 'new unsorted' etc.
This is why autoplaylists exist. They are constructed from query syntax. An example tutorial on how to use them: http://nujufoobar.blogspot.co.uk/2013/01/h...from-media.html (http://nujufoobar.blogspot.co.uk/2013/01/how-to-create-auto-playlist-from-media.html)

P.S. Yes, General is the correct forum for questions that can be answered by other users. Support is for problems/unintended behaviour that require attention from developers.
Title: $if statement in Media Library/Album List/View
Post by: ultrared on 2013-07-28 21:37:42
Thanks