Support and General Use > Audio Playback, Database and Playlists

Problem filtering by year

<< < (3/4) > >>

looking at your original sample above I'd say likely the really long line is blowing the stack
but really IDK, the tagcache code is complicated

The problem here is how the tagtree constructs database queries. Due to the way the tagcache evaluates queries it can only deal with boolean expressions in "disjunctive normal form", which have this general form:

--- Code: ---(a0 && ... && aN) || (b0 && .. && bN) || ...

--- End code ---
or at least, "clauses" are dealt with in this fashion. This is further complicated by "filters" which (I think) become an additional AND at the outermost level but idk.

Each "level" of the menu in the tagtree corresponds to a new query (so albumartist -> year -> album -> title has four levels). When you are viewing the albums under a certain year you're at the 3rd level, and the tagtree will add clauses and filters corresponding to your selections at the 1st and 2nd levels:

--- Code: ---FILTERS
  albumartist = "The A.."
  year = 2005

--- End code ---
(For some reason the tagcache cannot "filter" on numeric tags, so the year becomes a clause.)

Now to ensure it only finds stuff matching your actual query, the tagtree will append the entire conditional from the tagnavi file:

--- Code: ---FILTERS
  albumartist = "The A..."
  year = 2005 & albumartist ^ "A" | albumartist ^ "The A"

--- End code ---
Now it is easy to see why the year gets ignored: the AND applies only to the left side of the disjunction and the right side is always true because we selected an albumartist that begins with "The A" already. If we selected an albumartist beginning with "A" then the query would work correctly because the right hand side would be false, forcing the year check to be taken into account. If you swap the order of the terms in the tagnavi file, like this:

--- Code: ---"A"   -> albumartist ? albumartist ^ "The A" | albumartist ^ "A" -> year -> album  ->  title = "f_browse"

--- End code ---
then the tagtree's final clause will end up being

--- Code: ---  year = 2005 & albumartist ^ "The A" | albumartist ^ "A"

--- End code ---
which make the menu work properly for albumartists beginning with "The A" but break all albumartists beginning with "A".

It's not too hard to fix the tagtree in theory but I won't be able to spend time on it anytime soon. Bilgus maybe you'd like to take a shot at it?

Looked at it poked at it came away with:
Above my pay grade ???

I think I've a solution, add a new clause operator
'@^' begins with one of

--- Code: ---"L" -> albumartist ? albumartist @^ "L|The L" & filename !~ "_cmpl" -> year -> album  ->  title = "f_browse"
--- End code ---

Its in


when all is said and done could you post that script to the wiki, or even here to the forum so someone else might use
of all this time we've spent

Ps can 'T' be shortened to this?

--- Code: ---"T"   -> albumartist ? albumartist ^ "T" & albumartist !^ "The " & filename !~ "_cmpl" -> year -> album  ->  title = "f_browse"
--- End code ---


[0] Message Index

[#] Next page

[*] Previous page

Go to full version