Merge pull request #1131 from whatdoineed2do/rss-playlistitems-deletion-fix
[rss] defer playlistitems purge til ready to update with new rss
This commit is contained in:
commit
a0830727dd
|
@ -204,7 +204,6 @@ playlist_fetch(bool *is_new, const char *path)
|
||||||
pli = db_pl_fetch_bypath(path);
|
pli = db_pl_fetch_bypath(path);
|
||||||
if (pli)
|
if (pli)
|
||||||
{
|
{
|
||||||
db_pl_clear_items(pli->id);
|
|
||||||
*is_new = false;
|
*is_new = false;
|
||||||
return pli;
|
return pli;
|
||||||
}
|
}
|
||||||
|
@ -453,6 +452,7 @@ rss_save(struct playlist_info *pli, int *count, enum rss_scan_type scan_type)
|
||||||
// Walk through the xml, saving each item
|
// Walk through the xml, saving each item
|
||||||
*count = 0;
|
*count = 0;
|
||||||
db_transaction_begin();
|
db_transaction_begin();
|
||||||
|
db_pl_clear_items(pli->id);
|
||||||
while ((ret = rss_xml_parse_item(&ri, xml, &ptr)) == 0 && (*count < pli->query_limit))
|
while ((ret = rss_xml_parse_item(&ri, xml, &ptr)) == 0 && (*count < pli->query_limit))
|
||||||
{
|
{
|
||||||
if (library_is_exiting())
|
if (library_is_exiting())
|
||||||
|
@ -509,7 +509,7 @@ rss_scan(const char *path, enum rss_scan_type scan_type)
|
||||||
int count;
|
int count;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
// Fetches or creates playlist, clears playlistitems
|
// Fetches or creates playlist
|
||||||
pli = playlist_fetch(&pl_is_new, path);
|
pli = playlist_fetch(&pl_is_new, path);
|
||||||
if (!pli)
|
if (!pli)
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -517,6 +517,8 @@ rss_scan(const char *path, enum rss_scan_type scan_type)
|
||||||
// Retrieves the RSS and reads the feed, saving each item as a track, and also
|
// Retrieves the RSS and reads the feed, saving each item as a track, and also
|
||||||
// adds the relationship to playlistitems. The pli will also be updated with
|
// adds the relationship to playlistitems. The pli will also be updated with
|
||||||
// metadata from the RSS.
|
// metadata from the RSS.
|
||||||
|
//
|
||||||
|
// playlistitems are only cleared if we are ready to add entries
|
||||||
ret = rss_save(pli, &count, scan_type);
|
ret = rss_save(pli, &count, scan_type);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
goto error;
|
goto error;
|
||||||
|
@ -612,7 +614,6 @@ static int
|
||||||
rss_fullscan(void)
|
rss_fullscan(void)
|
||||||
{
|
{
|
||||||
DPRINTF(E_LOG, L_LIB, "RSS feeds removed during full-rescan\n");
|
DPRINTF(E_LOG, L_LIB, "RSS feeds removed during full-rescan\n");
|
||||||
|
|
||||||
return LIBRARY_OK;
|
return LIBRARY_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue