[scan] Fix bug added to iTunes scanner

Incorrect title for meta playlist used in commit 9be7d8f
This commit is contained in:
ejurgensen 2020-02-03 12:06:15 -08:00
parent 77a8de3bea
commit 4c86798182
1 changed files with 13 additions and 4 deletions

View File

@ -863,7 +863,7 @@ static bool
itml_is_modified(const char *path, time_t mtime) itml_is_modified(const char *path, time_t mtime)
{ {
struct playlist_info *pli; struct playlist_info *pli;
int pl_id; int ret;
// This is a special playlist that is disabled and only used for saving a timestamp // This is a special playlist that is disabled and only used for saving a timestamp
pli = db_pl_fetch_bytitlepath(path, path); 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 // Clear out everything, we will recreate
db_pl_delete_bypath(path); db_pl_delete_bypath(path);
free_pli(pli, 0);
} }
else else
{ {
DPRINTF(E_LOG, L_SCAN, "New iTunes XML found, processing: '%s'\n", path); 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); // Prepare the special meta playlist used for saving timestamp
if (pl_id < 0) 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); DPRINTF(E_LOG, L_SCAN, "Error adding iTunes XML meta playlist '%s'\n", path);
free_pli(pli, 0);
return false; return false;
} }
free_pli(pli, 0);
// Disable, only used for saving timestamp // Disable, only used for saving timestamp
db_pl_disable_bypath(path, STRIP_NONE, 0); db_pl_disable_bypath(path, STRIP_NONE, 0);