IPB

Welcome Guest ( Log In | Register )

> foobar2000 General Forum Rules

This is NOT a tech support forum.
Tech support questions go to foobar2000 Tech Support forum instead.

See also: Hydrogenaudio Terms of Service.

 
Reply to this topicStart new topic
$if statement in Media Library/Album List/View
ultrared
post Jul 28 2013, 17:07
Post #1





Group: Members
Posts: 3
Joined: 28-July 13
Member No.: 109341



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.

Go to the top of the page
+Quote Post
foosion
post Jul 28 2013, 17:17
Post #2





Group: FB2K Moderator (Donating)
Posts: 4414
Joined: 24-February 03
Member No.: 5153



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%).


--------------------
http://foosion.foobar2000.org/ - my components for foobar2000
Go to the top of the page
+Quote Post
ultrared
post Jul 28 2013, 17:33
Post #3





Group: Members
Posts: 3
Joined: 28-July 13
Member No.: 109341



Thank you for the quick answer.. I didn't see that in the documentation anywhere sad.gif

$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.

Go to the top of the page
+Quote Post
db1989
post Jul 28 2013, 21:05
Post #4





Group: Super Moderator
Posts: 5275
Joined: 23-June 06
Member No.: 32180



QUOTE (ultrared @ Jul 28 2013, 17:33) *
I didn't see that in the documentation anywhere sad.gif
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.

This post has been edited by db1989: Jul 28 2013, 21:06
Go to the top of the page
+Quote Post
ultrared
post Jul 28 2013, 21:37
Post #5





Group: Members
Posts: 3
Joined: 28-July 13
Member No.: 109341



Thanks smile.gif
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



RSS Lo-Fi Version Time is now: 31st July 2014 - 20:39