mirror of
https://github.com/owntone/owntone-server.git
synced 2025-11-10 14:09:51 -05:00
The m3u playlist scanner improvements in commit 6e9cf3a resulted in
too many database lookups. This is a more efficient version.
This commit is contained in:
20
src/db.c
20
src/db.c
@@ -1524,6 +1524,26 @@ db_files_get_count(void)
|
||||
return db_get_count("SELECT COUNT(*) FROM files f WHERE f.disabled = 0;");
|
||||
}
|
||||
|
||||
int
|
||||
db_files_get_count_bypathpattern(char *path)
|
||||
{
|
||||
char *query;
|
||||
int count;
|
||||
|
||||
query = sqlite3_mprintf("SELECT COUNT(*) FROM files f WHERE f.path LIKE '%%%q';", path);
|
||||
if (!query)
|
||||
{
|
||||
DPRINTF(E_LOG, L_DB, "Out of memory making count query string.\n");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
count = db_get_count(query);
|
||||
sqlite3_free(query);
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
void
|
||||
db_files_update_songalbumid(void)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user