Rockbox open source high quality audio player as a Music Player Daemon
mpris rockbox mpd libadwaita audio rust zig deno
2
fork

Configure Feed

Select the types of activity you want to include in your feed.

tagtree/tagcache add new clause operator contains_oneof

new operators @~, *~
contains_oneof and not_contains_oneof

genre @~ "metal|core"
black metal, death metal, grindcore, mathcore

genre ~ "jazz" & genre *~ "rock|pop|fusion"
included: jazz, free jazz, cool jazz, etc.
excluded: jazz rock, jazz pop, jazz fusion

Change-Id: If9590c8607b58373a98f5c9ea537f54df78d5a2f

authored by

Nyx Guan and committed by
Solomon Peachy
012245c5 b31becd4

+33 -4
+28
apps/tagcache.c
··· 239 239 [clause_ends_with] = "clause_ends_with", 240 240 [clause_not_ends_with] = "clause_not_ends_with", 241 241 [clause_oneof] = "clause_oneof", 242 + [clause_contains_oneof] = "clause_contains_oneof", 242 243 [clause_begins_oneof] = "clause_begins_oneof", 243 244 [clause_ends_oneof] = "clause_ends_oneof", 244 245 [clause_not_oneof] = "clause_not_oneof", 246 + [clause_not_contains_oneof] = "clause_not_contains_oneof", 245 247 [clause_not_begins_oneof] = "clause_not_begins_oneof", 246 248 [clause_not_ends_oneof] = "clause_not_ends_oneof", 247 249 [clause_logical_or] = "clause_logical_or" ··· 1397 1399 return false; 1398 1400 } 1399 1401 1402 + inline static bool str_contains_oneof(const char *str, char *list) 1403 + { 1404 + logf_clauses("%s %s %s", str, __func__, list); 1405 + const char *sep; 1406 + int l, len = strlen(str); 1407 + 1408 + while (*list) 1409 + { 1410 + sep = strchr(list, '|'); 1411 + l = sep ? (intptr_t)sep - (intptr_t)list : (int)strlen(list); 1412 + list[l] = '\0'; 1413 + if (l <= len && strcasestr(str, list) != NULL) { 1414 + if (sep) list[l] = '|'; 1415 + return true; 1416 + } 1417 + if (sep) list[l] = '|'; 1418 + list += sep ? l + 1 : l; 1419 + } 1420 + 1421 + return false; 1422 + } 1423 + 1400 1424 static bool check_against_clause(long numeric, const char *str, 1401 1425 const struct tagcache_search_clause *clause) 1402 1426 { ··· 1462 1486 case clause_not_begins_oneof: 1463 1487 return !str_begins_ends_oneof(str, clause->str, 1464 1488 clause->type == clause_not_begins_oneof); 1489 + case clause_contains_oneof: 1490 + return str_contains_oneof(str, clause->str); 1491 + case clause_not_contains_oneof: 1492 + return !str_contains_oneof(str, clause->str); 1465 1493 default: 1466 1494 logf("Incorrect tag: %d", clause->type); 1467 1495 }
+3 -4
apps/tagcache.h
··· 72 72 73 73 enum clause { clause_none, clause_is, clause_is_not, clause_gt, clause_gteq, 74 74 clause_lt, clause_lteq, clause_contains, clause_not_contains, 75 - clause_begins_with, clause_not_begins_with, clause_ends_with, 76 - clause_not_ends_with, clause_oneof, 77 - clause_begins_oneof, clause_ends_oneof, clause_not_oneof, 78 - clause_not_begins_oneof, clause_not_ends_oneof, 75 + clause_begins_with, clause_not_begins_with, clause_ends_with, clause_not_ends_with, 76 + clause_oneof, clause_begins_oneof, clause_ends_oneof, clause_contains_oneof, 77 + clause_not_oneof, clause_not_begins_oneof, clause_not_ends_oneof, clause_not_contains_oneof, 79 78 clause_logical_or }; 80 79 81 80 struct tagcache_stat {
+2
apps/tagtree.c
··· 481 481 CLAUSE('!', '^', clause_not_begins_with), 482 482 CLAUSE('$', ' ', clause_ends_with), 483 483 CLAUSE('!', '$', clause_not_ends_with), 484 + CLAUSE('@', '~', clause_contains_oneof), 484 485 CLAUSE('@', '^', clause_begins_oneof), 485 486 CLAUSE('@', '$', clause_ends_oneof), 486 487 CLAUSE('@', ' ', clause_oneof), 488 + CLAUSE('*', '~', clause_not_contains_oneof), 487 489 CLAUSE('*', '^', clause_not_begins_oneof), 488 490 CLAUSE('*', '$', clause_not_ends_oneof), 489 491 CLAUSE('!', '@', clause_not_oneof),