mirror of
https://github.com/owntone/owntone-server.git
synced 2025-11-10 22:10:15 -05:00
Recompute all songalbumids at startup
Due to the two Murmur64 implementations for 64 and 32bit machines, the hash is not compatible when moving the SQLite DB between 32/64 bit hosts. So we'll recompute all the songalbumids at startup, just in case.
This commit is contained in:
19
src/db.c
19
src/db.c
@@ -1118,6 +1118,25 @@ db_files_get_count(void)
|
||||
return db_get_count("SELECT COUNT(*) FROM files WHERE disabled = 0;");
|
||||
}
|
||||
|
||||
void
|
||||
db_files_update_songalbumid(void)
|
||||
{
|
||||
#define Q_SONGALBUMID "UPDATE files SET songalbumid = daap_songalbumid(album_artist, album);"
|
||||
char *errmsg;
|
||||
int ret;
|
||||
|
||||
DPRINTF(E_DBG, L_DB, "Running query '%s'\n", Q_SONGALBUMID);
|
||||
|
||||
errmsg = NULL;
|
||||
ret = sqlite3_exec(hdl, Q_SONGALBUMID, NULL, NULL, &errmsg);
|
||||
if (ret != SQLITE_OK)
|
||||
DPRINTF(E_LOG, L_DB, "Error updating songalbumid: %s\n", errmsg);
|
||||
|
||||
sqlite3_free(errmsg);
|
||||
|
||||
#undef Q_SONGALBUMID
|
||||
}
|
||||
|
||||
void
|
||||
db_file_inc_playcount(int id)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user