discomfitor pushed a commit to branch master.

http://git.enlightenment.org/apps/empc.git/commit/?id=0cb070190ffd3c29dbe8e1e471c8259ae239c71a

commit 0cb070190ffd3c29dbe8e1e471c8259ae239c71a
Author: Mike Blumenkrantz <[email protected]>
Date:   Sun Dec 28 15:54:34 2014 -0500

    optimize apm insertions when using filenames
---
 src/modules/auto_playlist_manager.c | 25 ++++++++++++++++++++++++-
 1 file changed, 24 insertions(+), 1 deletion(-)

diff --git a/src/modules/auto_playlist_manager.c 
b/src/modules/auto_playlist_manager.c
index 141ae7c..0ed7e53 100644
--- a/src/modules/auto_playlist_manager.c
+++ b/src/modules/auto_playlist_manager.c
@@ -235,7 +235,7 @@ run_adds(void)
                   EINA_LIST_REVERSE_FOREACH(sub, lll, subi)
                     {
                        Empd_Empdd_Song *ss = elm_object_item_data_get(subi);
-                       int ret;
+                       int ret, pos = 1;
 
                        /* find item that goes before this one and place this 
after */
                        ret = strcmp(ss->uri, file);
@@ -244,6 +244,18 @@ run_adds(void)
                        post_add(1, file);
                        empd_empdd_add_id_list_call(empd_proxy, file, 
ss->song_pos + 1);
                        done = EINA_TRUE;
+                       while (eina_list_next(l))
+                         {
+                            char *f2;
+
+                            pos++;
+                            f2 = eina_list_data_get(eina_list_next(l));
+                            if (!is_same_path(file, a, f2, NULL)) break;
+                            empd_empdd_add_id_list_call(empd_proxy, file, 
ss->song_pos + pos);
+                            post_add(1, f2);
+                            adds = eina_list_remove_list(adds, 
eina_list_next(l));
+                            free(f2);
+                         }
                        break;
                     }
                }
@@ -251,8 +263,19 @@ run_adds(void)
           }
         if (!done)
           {
+             char *f2;
+
              empd_empdd_add_list_call(empd_proxy, file);
              post_add(0, file);
+             while (eina_list_next(l))
+               {
+                  f2 = eina_list_data_get(eina_list_next(l));
+                  if (!is_same_path(file, a, f2, NULL)) break;
+                  empd_empdd_add_list_call(empd_proxy, f2);
+                  post_add(0, f2);
+                  adds = eina_list_remove_list(adds, eina_list_next(l));
+                  free(f2);
+               }
           }
         adds = eina_list_remove_list(adds, l);
         free(file);

-- 


Reply via email to