mirror of
https://github.com/owntone/owntone-server.git
synced 2025-11-12 14:51:38 -05:00
This makes the scanner more flexible when matching paths in playlists
with the library paths.
This commit is contained in:
24
src/db.c
24
src/db.c
@@ -1723,6 +1723,30 @@ db_file_id_bypath(char *path)
|
||||
#undef Q_TMPL
|
||||
}
|
||||
|
||||
int
|
||||
db_file_id_bypathpattern(char *path)
|
||||
{
|
||||
#define Q_TMPL "SELECT f.id FROM files f WHERE f.path LIKE '%%%q';"
|
||||
char *query;
|
||||
int ret;
|
||||
|
||||
query = sqlite3_mprintf(Q_TMPL, path);
|
||||
if (!query)
|
||||
{
|
||||
DPRINTF(E_LOG, L_DB, "Out of memory for query string\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
ret = db_file_id_byquery(query);
|
||||
|
||||
sqlite3_free(query);
|
||||
|
||||
return ret;
|
||||
|
||||
#undef Q_TMPL
|
||||
}
|
||||
|
||||
int
|
||||
db_file_id_byfilebase(char *filename, char *base)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user