Support and General Use > Audio Playback, Database and Playlists
Problem filtering by year
amachronic:
--- Quote from: Bilgus on March 19, 2022, 12:23:14 AM ---Looked at it poked at it came away with:
Above my pay grade ???
--- End quote ---
(math pays off sometimes I guess lol)
But seriously, instead of an ad-hoc operator to solve this problem (which won't address the general issue) you just need to move the "filter clauses" to a separate group.
I call them filter clauses because tagtree wants them to be filters but the tagcache can't support that.
https://github.com/Rockbox/rockbox/blob/master/apps/tagtree.c#L1486
instead of prepending them to the main clause group with tagcache_search_add_clause like tagtree is currently doing there, you can create an entirely separate clause group in the tagcache, add a new function tagcache_search_add_filter_clause to add stuff to it, and evaluate that group in addition to the main one.
I think that would mean adding another check_clauses() above the current one here
https://github.com/Rockbox/rockbox/blob/master/apps/tagcache.c#L1382
like so
--- Code: --- /* check filter clauses first */
if (!check_clauses(tcs, idx, tcs->filter_clause, tcs->filter_clause_count))
continue;
if (!check_clauses(tcs, idx, tcs->clause, tcs->clause_count))
continue;
--- End code ---
That will solve the problem in this case and most simple cases. A more general solution will probably require an AST to represent the query expression and that's a lot of refactoring.
Bilgus:
Sounds to me that you have an idea, feel free to run with it.
Edit--
Filters can only be used with entries you can point at with a seek index into a db.tcd, virtual tags and number tags dont index into a tcd file AFAIU
Further I'm unsure how you decide the users intention without adding another operator or parens
amachronic:
OK, I'll put this stuff on the bugtracker then so it isn't forgotten.
re. the user's intention: right now the ANDs always bind more tightly than ORs so there is no ambiguity, it's just that tagnavi docs are very unclear about this, and it is too easy to get confused. Supporting parens would be better of course, and tie in nicely with AST-based queries.
ilmioalias:
--- Quote from: Bilgus on March 19, 2022, 03:17:13 AM ---@ilmioalias
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
--- End quote ---
Finally here i'am!
So, i created a tagnavi_user.config from the standard tagnavi.config and i added following lines to it:
--- Code: ---# Define the A to Z album artist sub menu
%menu_start "custom_albumartist" "Album Artists A to Z"
"Numeric" -> albumartist ? albumartist < "A" & filename !~ "_cmpl" -> year -> album -> title = "fmt_title"
"A" -> albumartist ? albumartist @^ "A|The A" & filename !~ "_cmpl" -> year -> album -> title = "fmt_title"
"B" -> albumartist ? albumartist @^ "B|The B" & filename !~ "_cmpl" -> year -> album -> title = "fmt_title"
"C" -> albumartist ? albumartist @^ "C|The C" & filename !~ "_cmpl" -> year -> album -> title = "fmt_title"
"D" -> albumartist ? albumartist @^ "D|The D" & filename !~ "_cmpl" -> year -> album -> title = "fmt_title"
"E" -> albumartist ? albumartist @^ "E|The E" & filename !~ "_cmpl" -> year -> album -> title = "fmt_title"
"F" -> albumartist ? albumartist @^ "F|The F" & filename !~ "_cmpl" -> year -> album -> title = "fmt_title"
"G" -> albumartist ? albumartist @^ "G|The G" & filename !~ "_cmpl" -> year -> album -> title = "fmt_title"
"H" -> albumartist ? albumartist @^ "H|The H" & filename !~ "_cmpl" -> year -> album -> title = "fmt_title"
"I" -> albumartist ? albumartist @^ "I|The I" & filename !~ "_cmpl" -> year -> album -> title = "fmt_title"
"J" -> albumartist ? albumartist @^ "J|The J" & filename !~ "_cmpl" -> year -> album -> title = "fmt_title"
"K" -> albumartist ? albumartist @^ "K|The K" & filename !~ "_cmpl" -> year -> album -> title = "fmt_title"
"L" -> albumartist ? albumartist @^ "L|The L" & filename !~ "_cmpl" -> year -> album -> title = "fmt_title"
"M" -> albumartist ? albumartist @^ "M|The M" & filename !~ "_cmpl" -> year -> album -> title = "fmt_title"
"N" -> albumartist ? albumartist @^ "N|The N" & filename !~ "_cmpl" -> year -> album -> title = "fmt_title"
"O" -> albumartist ? albumartist @^ "O|The O" & filename !~ "_cmpl" -> year -> album -> title = "fmt_title"
"P" -> albumartist ? albumartist @^ "P|The P" & filename !~ "_cmpl" -> year -> album -> title = "fmt_title"
"Q" -> albumartist ? albumartist @^ "Q|The Q" & filename !~ "_cmpl" -> year -> album -> title = "fmt_title"
"R" -> albumartist ? albumartist @^ "R|The R" & filename !~ "_cmpl" -> year -> album -> title = "fmt_title"
"S" -> albumartist ? albumartist @^ "S|The S" & filename !~ "_cmpl" -> year -> album -> title = "fmt_title"
"T" -> albumartist ? albumartist ^ "T" & albumartist !^ "The " & filename !~ "_cmpl" -> year -> album -> title = "fmt_title"
"U" -> albumartist ? albumartist @^ "U|The U" & filename !~ "_cmpl" -> year -> album -> title = "fmt_title"
"V" -> albumartist ? albumartist @^ "V|The V" & filename !~ "_cmpl" -> year -> album -> title = "fmt_title"
"W" -> albumartist ? albumartist @^ "W|The W" & filename !~ "_cmpl" -> year -> album -> title = "fmt_title"
"X" -> albumartist ? albumartist @^ "X|The X" & filename !~ "_cmpl" -> year -> album -> title = "fmt_title"
"Y" -> albumartist ? albumartist @^ "Y|The Y" & filename !~ "_cmpl" -> year -> album -> title = "fmt_title"
"Z" -> albumartist ? albumartist @^ "Z|The Z" & filename !~ "_cmpl" -> year -> album -> title = "fmt_title"
--- End code ---
Moreover i substituted standard "A to Z..." sub menu with the following one:
--- Code: ---# Define the A to Z sub menu
%menu_start "a2z" "A to Z..."
"Artists" ==> "custom_artist"
"Albums" ==> "custom_album"
"Album Artists" ==> "custom_albumartist"
"Tracks" ==> "custom_track"
--- End code ---
It works like a charm.
Thanks to all and excuse me for the delay.
Frankenpod:
I'm probably misunderstanding the tagnavi syntax (I used to understand it, wrote a custom tagnavi of my own, but stopped using it because it made the database build take even longer than it usually does, and have long since forgotten how it works again).
But In the above custom tagnavi, what happens with artists that start with "The" but the next part starts with "T", as in "The Temper Trap" or even "The The"?
Would this line correctly list them under "T"? I can't work out if it would. Wouldn't it exclude them because of them starting with "The"? I might be forgetting how the thing works.
"T" -> albumartist ? albumartist ^ "T" & albumartist !^ "The " & filename !~ "_cmpl" -> year -> album -> title = "fmt_title"
Should it not be
"T" -> albumartist ? albumartist @^ "T|The T" & albumartist !^ "The " & filename !~ "_cmpl" -> year -> album -> title = "fmt_title"
Navigation
[0] Message Index
[*] Previous page
Go to full version