[library] Add action to library_schedule_callback()

Makes it possible for the caller to request that a previous callback is
replaced, so we don't end up with more and more callbacks. Also add other
options for future use.
This commit is contained in:
ejurgensen
2020-03-23 23:17:26 +01:00
parent 2af7296723
commit 2d8521139c
3 changed files with 71 additions and 21 deletions

View File

@@ -549,7 +549,7 @@ rss_scan_all(enum rss_scan_type scan_type)
if (count == 0)
return;
library_callback_schedule(rss_refresh, NULL, &rss_refresh_interval);
library_callback_schedule(rss_refresh, NULL, &rss_refresh_interval, LIBRARY_CB_ADD_OR_REPLACE);
DPRINTF(E_INFO, L_LIB, "Refreshed %d RSS feeds in %.f sec (scan type %d)\n", count, difftime(end, start), scan_type);
}
@@ -601,7 +601,7 @@ rss_add(const char *path)
if (ret < 0)
return LIBRARY_PATH_INVALID;
library_callback_schedule(rss_refresh, NULL, &rss_refresh_interval);
library_callback_schedule(rss_refresh, NULL, &rss_refresh_interval, LIBRARY_CB_ADD_OR_REPLACE);
return LIBRARY_OK;
}