[prev in list] [next in list] [prev in thread] [next in thread] 

List:       rockbox-cvs
Subject:    Properties/Tagcache Track Info Retrieval: Skip files with errors
From:       rockbox-gerrit-noreply--- via rockbox-cvs <rockbox-cvs () lists ! haxx ! se>
Date:       2023-10-17 16:18:33
Message-ID: 202310171618.39HGIXqS2461175 () archos ! rockbox ! org
[Download RAW message or body]

commit e3b22935f233a2b95c1b14230bd669b8dd64a330
Author: Christian Soffke <christian.soffke@gmail.com>
Date:   Sun Oct 15 17:30:27 2023 +0200

    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

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;
 static struct mp3entry id3;
 #ifdef HAVE_TAGCACHE
 static int mul_id3_count;
+static int skipped_count;
 #endif
 
 static char str_filename[MAX_PATH];
@@ -374,11 +375,15 @@ static bool determine_file_or_dir(void)
 #ifdef HAVE_TAGCACHE
 bool mul_id3_add(const char *file_name)
 {
-    if (rb->mp3info(&id3, file_name))
+    if (!file_name)
+        skipped_count++;
+    else if (rb->mp3info(&id3, file_name))
         return false;
-
-    collect_id3(&id3, mul_id3_count == 0);
-    mul_id3_count++;
+    else
+    {
+        collect_id3(&id3, mul_id3_count == 0);
+        mul_id3_count++;
+    }
 
     return true;
 }
@@ -406,12 +411,15 @@ enum plugin_status plugin_start(const void* parameter)
     if (!rb->strcmp(file, MAKE_ACT_STR(ACTIVITY_DATABASEBROWSER))) /* db table selected */
     {
         props_type = PROPS_MUL_ID3;
-        mul_id3_count = 0;
+        mul_id3_count = skipped_count = 0;
 
         if (!rb->tagtree_subentries_do_action(&mul_id3_add) || mul_id3_count == 0)
             return PLUGIN_ERROR;
         else if (mul_id3_count > 1) /* otherwise, the retrieved id3 can be used as-is */
             finalize_id3(&id3);
+
+        if (skipped_count > 0)
+            rb->splashf(HZ*2, "Skipped %d", skipped_count);
     }
     else
 #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,
 
 /* Execute action_cb for all subentries of the current table's
  * selected item, handing over each entry's filename in the
- * callback function parameter.
+ * callback function parameter. Parameter will be NULL for
+ * entries whose filename couldn't be retrieved.
  */
 bool tagtree_subentries_do_action(bool (*action_cb)(const char *file_name))
 {
@@ -2289,9 +2290,8 @@ bool tagtree_subentries_do_action(bool (*action_cb)(const char *file_name))
                 last_tick = current_tick;
             }
 
-            if (!tagcache_retrieve(&tcs, tagtree_get_entry(tc, i)->extraseek,
-                                   tcs.type, buf, sizeof buf)
-                || !action_cb(buf))
+            if (!action_cb(tagcache_retrieve(&tcs, tagtree_get_entry(tc, i)->extraseek,
+                                             tcs.type, buf, sizeof buf) ? buf : NULL))
             {
                 ret = false;
                 break;
-- 
rockbox-cvs mailing list
rockbox-cvs@lists.haxx.se
https://lists.haxx.se/mailman/listinfo/rockbox-cvs
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic