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: $if statement in Media Library/Album List/View (Read 2220 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

$if statement in Media Library/Album List/View

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.


$if statement in Media Library/Album List/View

Reply #1
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%).

 

$if statement in Media Library/Album List/View

Reply #2
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.


$if statement in Media Library/Album List/View

Reply #3
I didn't see that in the documentation anywhere
http://wiki.hydrogenaudio.org/index.php?ti...tting_Reference
A copy of which is included with the installer, alongside the document on 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

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.

$if statement in Media Library/Album List/View

Reply #4
Thanks