From 4c86798182ef8175e1699397ff35b0188395e8b8 Mon Sep 17 00:00:00 2001 From: ejurgensen Date: Mon, 3 Feb 2020 12:06:15 -0800 Subject: [PATCH] [scan] Fix bug added to iTunes scanner Incorrect title for meta playlist used in commit 9be7d8f --- src/library/filescanner_itunes.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/library/filescanner_itunes.c b/src/library/filescanner_itunes.c index 71e7f47a..5e8a113d 100644 --- a/src/library/filescanner_itunes.c +++ b/src/library/filescanner_itunes.c @@ -863,7 +863,7 @@ static bool itml_is_modified(const char *path, time_t mtime) { struct playlist_info *pli; - int pl_id; + int ret; // This is a special playlist that is disabled and only used for saving a timestamp pli = db_pl_fetch_bytitlepath(path, path); @@ -887,20 +887,29 @@ itml_is_modified(const char *path, time_t mtime) // Clear out everything, we will recreate db_pl_delete_bypath(path); - free_pli(pli, 0); } else { DPRINTF(E_LOG, L_SCAN, "New iTunes XML found, processing: '%s'\n", path); + + CHECK_NULL(L_SCAN, pli = calloc(1, sizeof(struct playlist_info))); } - pl_id = playlist_add(path); - if (pl_id < 0) + // Prepare the special meta playlist used for saving timestamp + playlist_fill(pli, path); + free(pli->title); + pli->title = strdup(path); + + ret = library_playlist_save(pli); + if (ret < 0) { DPRINTF(E_LOG, L_SCAN, "Error adding iTunes XML meta playlist '%s'\n", path); + free_pli(pli, 0); return false; } + free_pli(pli, 0); + // Disable, only used for saving timestamp db_pl_disable_bypath(path, STRIP_NONE, 0);