summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorChristian Soffke <christian.soffke@gmail.com>2023-10-15 17:30:27 +0200
committerChristian Soffke <christian.soffke@gmail.com>2023-10-17 12:18:33 -0400
commite3b22935f233a2b95c1b14230bd669b8dd64a330 (patch)
tree5b8b6dee8416a56e6f483c1e6c8d477d525152fe /apps
parentf2af0711b01a5aa66a0533504bb88e142c67ef80 (diff)
downloadrockbox-e3b22935f233a2b95c1b14230bd669b8dd64a330.tar.gz
rockbox-e3b22935f233a2b95c1b14230bd669b8dd64a330.zip
Properties/Tagcache Track Info Retrieval: Skip files with errors
File names exceeding the max length will not be retrievable from the database. Skip such files, instead of cancelling the operation at that point. Change-Id: Ia6bc8a53be9ec181eb836956cc3d8b059b2d024f
Diffstat (limited to 'apps')
-rw-r--r--apps/plugins/properties.c18
-rw-r--r--apps/tagtree.c8
2 files changed, 17 insertions, 9 deletions
diff --git a/apps/plugins/properties.c b/apps/plugins/properties.c
index 53af4c5bab..ef9dc4c7f7 100644
--- a/apps/plugins/properties.c
+++ b/apps/plugins/properties.c
@@ -48,6 +48,7 @@ static int props_type = PROPS_FILE;
48static struct mp3entry id3; 48static struct mp3entry id3;
49#ifdef HAVE_TAGCACHE 49#ifdef HAVE_TAGCACHE
50static int mul_id3_count; 50static int mul_id3_count;
51static int skipped_count;
51#endif 52#endif
52 53
53static char str_filename[MAX_PATH]; 54static char str_filename[MAX_PATH];
@@ -374,11 +375,15 @@ static bool determine_file_or_dir(void)
374#ifdef HAVE_TAGCACHE 375#ifdef HAVE_TAGCACHE
375bool mul_id3_add(const char *file_name) 376bool mul_id3_add(const char *file_name)
376{ 377{
377 if (rb->mp3info(&id3, file_name)) 378 if (!file_name)
379 skipped_count++;
380 else if (rb->mp3info(&id3, file_name))
378 return false; 381 return false;
379 382 else
380 collect_id3(&id3, mul_id3_count == 0); 383 {
381 mul_id3_count++; 384 collect_id3(&id3, mul_id3_count == 0);
385 mul_id3_count++;
386 }
382 387
383 return true; 388 return true;
384} 389}
@@ -406,12 +411,15 @@ enum plugin_status plugin_start(const void* parameter)
406 if (!rb->strcmp(file, MAKE_ACT_STR(ACTIVITY_DATABASEBROWSER))) /* db table selected */ 411 if (!rb->strcmp(file, MAKE_ACT_STR(ACTIVITY_DATABASEBROWSER))) /* db table selected */
407 { 412 {
408 props_type = PROPS_MUL_ID3; 413 props_type = PROPS_MUL_ID3;
409 mul_id3_count = 0; 414 mul_id3_count = skipped_count = 0;
410 415
411 if (!rb->tagtree_subentries_do_action(&mul_id3_add) || mul_id3_count == 0) 416 if (!rb->tagtree_subentries_do_action(&mul_id3_add) || mul_id3_count == 0)
412 return PLUGIN_ERROR; 417 return PLUGIN_ERROR;
413 else if (mul_id3_count > 1) /* otherwise, the retrieved id3 can be used as-is */ 418 else if (mul_id3_count > 1) /* otherwise, the retrieved id3 can be used as-is */
414 finalize_id3(&id3); 419 finalize_id3(&id3);
420
421 if (skipped_count > 0)
422 rb->splashf(HZ*2, "Skipped %d", skipped_count);
415 } 423 }
416 else 424 else
417#endif 425#endif
diff --git a/apps/tagtree.c b/apps/tagtree.c
index 542b0bb120..a85f848c13 100644
--- a/apps/tagtree.c
+++ b/apps/tagtree.c
@@ -2258,7 +2258,8 @@ static bool tagtree_insert_selection(int position, bool queue,
2258 2258
2259/* Execute action_cb for all subentries of the current table's 2259/* Execute action_cb for all subentries of the current table's
2260 * selected item, handing over each entry's filename in the 2260 * selected item, handing over each entry's filename in the
2261 * callback function parameter. 2261 * callback function parameter. Parameter will be NULL for
2262 * entries whose filename couldn't be retrieved.
2262 */ 2263 */
2263bool tagtree_subentries_do_action(bool (*action_cb)(const char *file_name)) 2264bool tagtree_subentries_do_action(bool (*action_cb)(const char *file_name))
2264{ 2265{
@@ -2289,9 +2290,8 @@ bool tagtree_subentries_do_action(bool (*action_cb)(const char *file_name))
2289 last_tick = current_tick; 2290 last_tick = current_tick;
2290 } 2291 }
2291 2292
2292 if (!tagcache_retrieve(&tcs, tagtree_get_entry(tc, i)->extraseek, 2293 if (!action_cb(tagcache_retrieve(&tcs, tagtree_get_entry(tc, i)->extraseek,
2293 tcs.type, buf, sizeof buf) 2294 tcs.type, buf, sizeof buf) ? buf : NULL))
2294 || !action_cb(buf))
2295 { 2295 {
2296 ret = false; 2296 ret = false;
2297 break; 2297 break;