Rockbox.org home
Downloads
Release release
Dev builds dev builds
Extras extras
themes themes
Documentation
Manual manual
Wiki wiki
Device Status device status
Support
Forums forums
Mailing lists mailing lists
IRC IRC
Development
Bugs bugs
Patches patches
Dev Guide dev guide
Search



Donate

Rockbox Technical Forums


Login with username, password and session length
Home Help Search Staff List Login Register
News:

Thank You for your continued support and contributions!

+  Rockbox Technical Forums
|-+  Support and General Use
| |-+  Audio Playback, Database and Playlists
| | |-+  Problem filtering by year
« previous next »
  • Print
Pages: 1 [2]

Author Topic: Problem filtering by year  (Read 1502 times)

Offline amachronic

  • Developer
  • Member
  • *
  • Posts: 269
Re: Problem filtering by year
« Reply #15 on: March 19, 2022, 07:02:58 AM »
Quote from: Bilgus on March 19, 2022, 12:23:14 AM
Looked at it poked at it came away with:
Above my pay grade ???
(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: [Select]
            /* 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;


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

Online Bilgus

  • Developer
  • Member
  • *
  • Posts: 876
Re: Problem filtering by year
« Reply #16 on: March 19, 2022, 07:41:25 AM »
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

« Last Edit: March 19, 2022, 08:04:09 AM by Bilgus »
Logged

Offline amachronic

  • Developer
  • Member
  • *
  • Posts: 269
Re: Problem filtering by year
« Reply #17 on: March 19, 2022, 10:52:43 AM »
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.
Logged

Offline ilmioalias

  • Member
  • *
  • Posts: 6
Re: Problem filtering by year
« Reply #18 on: January 19, 2023, 09:46:50 AM »
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


Finally here i'am!
So, i created a tagnavi_user.config from the standard tagnavi.config and i added following lines to it:
Code: [Select]
# 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"

Moreover i substituted standard "A to Z..." sub menu with the following one:
Code: [Select]
# 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"

It works like a charm.

Thanks to all and excuse me for the delay.
Logged

Offline Frankenpod

  • Member
  • *
  • Posts: 641
Re: Problem filtering by year
« Reply #19 on: January 19, 2023, 08:05:22 PM »
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"
« Last Edit: January 19, 2023, 08:23:39 PM by Frankenpod »
Logged

  • Print
Pages: 1 [2]
« previous next »
+  Rockbox Technical Forums
|-+  Support and General Use
| |-+  Audio Playback, Database and Playlists
| | |-+  Problem filtering by year
 

  • SMF 2.0.19 | SMF © 2021, Simple Machines
  • Rockbox Privacy Policy
  • XHTML
  • RSS
  • WAP2

Page created in 0.028 seconds with 18 queries.