mirror of
https://github.com/owntone/owntone-server.git
synced 2025-01-27 06:33:21 -05:00
Fix Spotify exemption from purge during init-rescan
This commit is contained in:
parent
6b0c5997bf
commit
915719f0f8
28
src/db.c
28
src/db.c
@ -1932,14 +1932,19 @@ db_file_ping(int id)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
db_file_ping_bymatch(char *path)
|
db_file_ping_bymatch(char *path, int isdir)
|
||||||
{
|
{
|
||||||
#define Q_TMPL "UPDATE files SET db_timestamp = %" PRIi64 " WHERE path LIKE '%q/%%';"
|
#define Q_TMPL_DIR "UPDATE files SET db_timestamp = %" PRIi64 " WHERE path LIKE '%q/%%';"
|
||||||
|
#define Q_TMPL_NODIR "UPDATE files SET db_timestamp = %" PRIi64 " WHERE path LIKE '%q%%';"
|
||||||
char *query;
|
char *query;
|
||||||
char *errmsg;
|
char *errmsg;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
query = sqlite3_mprintf(Q_TMPL, (int64_t)time(NULL), path);
|
if (isdir)
|
||||||
|
query = sqlite3_mprintf(Q_TMPL_DIR, (int64_t)time(NULL), path);
|
||||||
|
else
|
||||||
|
query = sqlite3_mprintf(Q_TMPL_NODIR, (int64_t)time(NULL), path);
|
||||||
|
|
||||||
if (!query)
|
if (!query)
|
||||||
{
|
{
|
||||||
DPRINTF(E_LOG, L_DB, "Out of memory for query string\n");
|
DPRINTF(E_LOG, L_DB, "Out of memory for query string\n");
|
||||||
@ -1956,7 +1961,8 @@ db_file_ping_bymatch(char *path)
|
|||||||
sqlite3_free(errmsg);
|
sqlite3_free(errmsg);
|
||||||
sqlite3_free(query);
|
sqlite3_free(query);
|
||||||
|
|
||||||
#undef Q_TMPL
|
#undef Q_TMPL_DIR
|
||||||
|
#undef Q_TMPL_NODIR
|
||||||
}
|
}
|
||||||
|
|
||||||
char *
|
char *
|
||||||
@ -2745,14 +2751,19 @@ db_pl_ping(int id)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
db_pl_ping_bymatch(char *path)
|
db_pl_ping_bymatch(char *path, int isdir)
|
||||||
{
|
{
|
||||||
#define Q_TMPL "UPDATE playlists SET db_timestamp = %" PRIi64 " WHERE path LIKE '%q/%%';"
|
#define Q_TMPL_DIR "UPDATE playlists SET db_timestamp = %" PRIi64 " WHERE path LIKE '%q/%%';"
|
||||||
|
#define Q_TMPL_NODIR "UPDATE playlists SET db_timestamp = %" PRIi64 " WHERE path LIKE '%q%%';"
|
||||||
char *query;
|
char *query;
|
||||||
char *errmsg;
|
char *errmsg;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
query = sqlite3_mprintf(Q_TMPL, (int64_t)time(NULL), path);
|
if (isdir)
|
||||||
|
query = sqlite3_mprintf(Q_TMPL_DIR, (int64_t)time(NULL), path);
|
||||||
|
else
|
||||||
|
query = sqlite3_mprintf(Q_TMPL_NODIR, (int64_t)time(NULL), path);
|
||||||
|
|
||||||
if (!query)
|
if (!query)
|
||||||
{
|
{
|
||||||
DPRINTF(E_LOG, L_DB, "Out of memory for query string\n");
|
DPRINTF(E_LOG, L_DB, "Out of memory for query string\n");
|
||||||
@ -2769,7 +2780,8 @@ db_pl_ping_bymatch(char *path)
|
|||||||
sqlite3_free(errmsg);
|
sqlite3_free(errmsg);
|
||||||
sqlite3_free(query);
|
sqlite3_free(query);
|
||||||
|
|
||||||
#undef Q_TMPL
|
#undef Q_TMPL_DIR
|
||||||
|
#undef Q_TMPL_NODIR
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
4
src/db.h
4
src/db.h
@ -367,7 +367,7 @@ void
|
|||||||
db_file_ping(int id);
|
db_file_ping(int id);
|
||||||
|
|
||||||
void
|
void
|
||||||
db_file_ping_bymatch(char *path);
|
db_file_ping_bymatch(char *path, int isdir);
|
||||||
|
|
||||||
char *
|
char *
|
||||||
db_file_path_byid(int id);
|
db_file_path_byid(int id);
|
||||||
@ -419,7 +419,7 @@ void
|
|||||||
db_pl_ping(int id);
|
db_pl_ping(int id);
|
||||||
|
|
||||||
void
|
void
|
||||||
db_pl_ping_bymatch(char *path);
|
db_pl_ping_bymatch(char *path, int isdir);
|
||||||
|
|
||||||
struct playlist_info *
|
struct playlist_info *
|
||||||
db_pl_fetch_bypath(char *path);
|
db_pl_fetch_bypath(char *path);
|
||||||
|
@ -994,8 +994,8 @@ bulk_scan(int flags)
|
|||||||
db_file_disable_bymatch(path, "", 0);
|
db_file_disable_bymatch(path, "", 0);
|
||||||
db_pl_disable_bymatch(path, "", 0);
|
db_pl_disable_bymatch(path, "", 0);
|
||||||
|
|
||||||
db_file_ping_bymatch(path);
|
db_file_ping_bymatch(path, 1);
|
||||||
db_pl_ping_bymatch(path);
|
db_pl_ping_bymatch(path, 1);
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -1031,8 +1031,8 @@ bulk_scan(int flags)
|
|||||||
/* Protect spotify from the imminent purge if rescanning */
|
/* Protect spotify from the imminent purge if rescanning */
|
||||||
if (flags & F_SCAN_RESCAN)
|
if (flags & F_SCAN_RESCAN)
|
||||||
{
|
{
|
||||||
db_file_ping_bymatch("spotify:");
|
db_file_ping_bymatch("spotify:", 0);
|
||||||
db_pl_ping_bymatch("spotify:");
|
db_pl_ping_bymatch("spotify:", 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
DPRINTF(E_DBG, L_SCAN, "Purging old database content\n");
|
DPRINTF(E_DBG, L_SCAN, "Purging old database content\n");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user