From 7d61815aead7a65e544c3b1141fb6e48dfad8a60 Mon Sep 17 00:00:00 2001
From: Kubat <mael.martin31@gmail.com>
Date: Wed, 6 Jan 2021 15:44:57 +0100
Subject: [PATCH] IMPORT: Some correction in fav import and in lkt to display
 results

---
 src/main/lkt.c           | 4 ++++
 src/module/module_repo.c | 7 +++----
 2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/src/main/lkt.c b/src/main/lkt.c
index af3f49ec..7e33ace8 100644
--- a/src/main/lkt.c
+++ b/src/main/lkt.c
@@ -961,6 +961,10 @@ redo:
         else if (STR_NMATCH(buff, "ACK", 3))
             exit(EXIT_FAILURE);
 
+        if (STR_NMATCH(buff, "name: ", strlen("name: "))) {
+            char *real_line = buff + sizeof("name: ") - sizeof(char);
+            memmove(buff, real_line, (1 + strlen(real_line)) * sizeof(char));
+        }
         fprintf(stdout, "%s", buff);
     }
 }
diff --git a/src/module/module_repo.c b/src/module/module_repo.c
index c029e999..f4f1578e 100644
--- a/src/module/module_repo.c
+++ b/src/module/module_repo.c
@@ -511,9 +511,8 @@ __handle_fav_list(struct module_repo_internal *repo, char *fav, size_t fav_size)
         LOG_WARN("REPO", "Fav list has a name to big to prepend it by '@'. Possible collision with other playlists");
     } else {
         memmove(fav + sizeof(char), fav, fav_len * sizeof(char));
-        fav_origin = fav;
-        fav[0] = (char) ("@");
-        fav += sizeof(char);
+        fav_origin = fav + sizeof(char);
+        fav[0] = (char) ('@');
         LOG_INFO("REPO", "Importing fav list '%s' as '%s'", fav_origin, fav);
     }
 
@@ -537,7 +536,7 @@ __handle_fav_list(struct module_repo_internal *repo, char *fav, size_t fav_size)
         }
         uri.id = id;
         if (!database_plt_add_uri(repo->db, fav, &uri)) {
-            LOG_ERROR("REPO", "Failed to add kara %ld to playlist %s", fav);
+            LOG_ERROR("REPO", "Failed to add kara %ld to playlist %s", id, fav);
             continue;
         }
     }
-- 
GitLab