mirror of
https://github.com/owntone/owntone-server.git
synced 2025-01-14 16:25:03 -05:00
Exclude streams/URLs (data_kind = 1) from most listings.
This commit is contained in:
parent
4552acba7e
commit
8260841f17
30
src/db.c
30
src/db.c
@ -737,9 +737,9 @@ db_build_query_items(struct query_params *qp, char **q)
|
|||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if (qp->filter)
|
if (qp->filter)
|
||||||
count = sqlite3_mprintf("SELECT COUNT(*) FROM files f WHERE f.disabled = 0 AND %s;", qp->filter);
|
count = sqlite3_mprintf("SELECT COUNT(*) FROM files f WHERE f.disabled = 0 AND f.data_kind = 0 AND %s;", qp->filter);
|
||||||
else
|
else
|
||||||
count = sqlite3_mprintf("SELECT COUNT(*) FROM files f WHERE f.disabled = 0;");
|
count = sqlite3_mprintf("SELECT COUNT(*) FROM files f WHERE f.disabled = 0 AND f.data_kind = 0;");
|
||||||
|
|
||||||
if (!count)
|
if (!count)
|
||||||
{
|
{
|
||||||
@ -762,13 +762,13 @@ db_build_query_items(struct query_params *qp, char **q)
|
|||||||
sort = sort_clause[qp->sort];
|
sort = sort_clause[qp->sort];
|
||||||
|
|
||||||
if (idx && qp->filter)
|
if (idx && qp->filter)
|
||||||
query = sqlite3_mprintf("SELECT f.* FROM files f WHERE f.disabled = 0 AND %s %s %s;", qp->filter, sort, idx);
|
query = sqlite3_mprintf("SELECT f.* FROM files f WHERE f.disabled = 0 AND f.data_kind = 0 AND %s %s %s;", qp->filter, sort, idx);
|
||||||
else if (idx)
|
else if (idx)
|
||||||
query = sqlite3_mprintf("SELECT f.* FROM files f WHERE f.disabled = 0 %s %s;", sort, idx);
|
query = sqlite3_mprintf("SELECT f.* FROM files f WHERE f.disabled = 0 AND f.data_kind = 0 %s %s;", sort, idx);
|
||||||
else if (qp->filter)
|
else if (qp->filter)
|
||||||
query = sqlite3_mprintf("SELECT f.* FROM files f WHERE f.disabled = 0 AND %s %s;", qp->filter, sort);
|
query = sqlite3_mprintf("SELECT f.* FROM files f WHERE f.disabled = 0 AND f.data_kind = 0 AND %s %s;", qp->filter, sort);
|
||||||
else
|
else
|
||||||
query = sqlite3_mprintf("SELECT f.* FROM files f WHERE f.disabled = 0 %s;", sort);
|
query = sqlite3_mprintf("SELECT f.* FROM files f WHERE f.disabled = 0 AND f.data_kind = 0 %s;", sort);
|
||||||
|
|
||||||
if (!query)
|
if (!query)
|
||||||
{
|
{
|
||||||
@ -973,7 +973,7 @@ db_build_query_groups(struct query_params *qp, char **q)
|
|||||||
char *idx;
|
char *idx;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
qp->results = db_get_count("SELECT COUNT(DISTINCT f.songalbumid) FROM files f WHERE f.disabled = 0;");
|
qp->results = db_get_count("SELECT COUNT(DISTINCT f.songalbumid) FROM files f WHERE f.disabled = 0 AND f.data_kind = 0;");
|
||||||
if (qp->results < 0)
|
if (qp->results < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
@ -983,13 +983,13 @@ db_build_query_groups(struct query_params *qp, char **q)
|
|||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (idx && qp->filter)
|
if (idx && qp->filter)
|
||||||
query = sqlite3_mprintf("SELECT COUNT(*), g.id, g.persistentid, f.album_artist, g.name FROM files f, groups g WHERE f.songalbumid = g.persistentid AND g.type = %d AND f.disabled = 0 AND %s GROUP BY f.album, g.name %s;", G_ALBUMS, qp->filter, idx);
|
query = sqlite3_mprintf("SELECT COUNT(*), g.id, g.persistentid, f.album_artist, g.name FROM files f, groups g WHERE f.songalbumid = g.persistentid AND g.type = %d AND f.disabled = 0 AND f.data_kind = 0 AND %s GROUP BY f.album, g.name %s;", G_ALBUMS, qp->filter, idx);
|
||||||
else if (idx)
|
else if (idx)
|
||||||
query = sqlite3_mprintf("SELECT COUNT(*), g.id, g.persistentid, f.album_artist, g.name FROM files f, groups g WHERE f.songalbumid = g.persistentid AND g.type = %d AND f.disabled = 0 GROUP BY f.album, g.name %s;", G_ALBUMS, idx);
|
query = sqlite3_mprintf("SELECT COUNT(*), g.id, g.persistentid, f.album_artist, g.name FROM files f, groups g WHERE f.songalbumid = g.persistentid AND g.type = %d AND f.disabled = 0 AND f.data_kind = 0 GROUP BY f.album, g.name %s;", G_ALBUMS, idx);
|
||||||
else if (qp->filter)
|
else if (qp->filter)
|
||||||
query = sqlite3_mprintf("SELECT COUNT(*), g.id, g.persistentid, f.album_artist, g.name FROM files f, groups g WHERE f.songalbumid = g.persistentid AND g.type = %d AND f.disabled = 0 AND %s GROUP BY f.album, g.name;", G_ALBUMS, qp->filter);
|
query = sqlite3_mprintf("SELECT COUNT(*), g.id, g.persistentid, f.album_artist, g.name FROM files f, groups g WHERE f.songalbumid = g.persistentid AND g.type = %d AND f.disabled = 0 AND f.data_kind = 0 AND %s GROUP BY f.album, g.name;", G_ALBUMS, qp->filter);
|
||||||
else
|
else
|
||||||
query = sqlite3_mprintf("SELECT COUNT(*), g.id, g.persistentid, f.album_artist, g.name FROM files f, groups g WHERE f.songalbumid = g.persistentid AND g.type = %d AND f.disabled = 0 GROUP BY f.album, g.name;", G_ALBUMS);
|
query = sqlite3_mprintf("SELECT COUNT(*), g.id, g.persistentid, f.album_artist, g.name FROM files f, groups g WHERE f.songalbumid = g.persistentid AND g.type = %d AND f.disabled = 0 AND f.data_kind = 0 GROUP BY f.album, g.name;", G_ALBUMS);
|
||||||
|
|
||||||
if (!query)
|
if (!query)
|
||||||
{
|
{
|
||||||
@ -1015,7 +1015,7 @@ db_build_query_groupitems(struct query_params *qp, char **q)
|
|||||||
{
|
{
|
||||||
case G_ALBUMS:
|
case G_ALBUMS:
|
||||||
count = sqlite3_mprintf("SELECT COUNT(*) FROM files f JOIN groups g ON f.songalbumid = g.persistentid"
|
count = sqlite3_mprintf("SELECT COUNT(*) FROM files f JOIN groups g ON f.songalbumid = g.persistentid"
|
||||||
" WHERE g.id = %d AND f.disabled = 0;", qp->id);
|
" WHERE g.id = %d AND f.disabled = 0 AND f.data_kind = 0;", qp->id);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@ -1040,7 +1040,7 @@ db_build_query_groupitems(struct query_params *qp, char **q)
|
|||||||
{
|
{
|
||||||
case G_ALBUMS:
|
case G_ALBUMS:
|
||||||
query = sqlite3_mprintf("SELECT f.* FROM files f JOIN groups g ON f.songalbumid = g.persistentid"
|
query = sqlite3_mprintf("SELECT f.* FROM files f JOIN groups g ON f.songalbumid = g.persistentid"
|
||||||
" WHERE g.id = %d AND f.disabled = 0;", qp->id);
|
" WHERE g.id = %d AND f.disabled = 0 AND f.data_kind = 0;", qp->id);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1069,7 +1069,7 @@ db_build_query_group_dirs(struct query_params *qp, char **q)
|
|||||||
case G_ALBUMS:
|
case G_ALBUMS:
|
||||||
count = sqlite3_mprintf("SELECT COUNT(DISTINCT(SUBSTR(f.path, 1, LENGTH(f.path) - LENGTH(f.fname) - 1)))"
|
count = sqlite3_mprintf("SELECT COUNT(DISTINCT(SUBSTR(f.path, 1, LENGTH(f.path) - LENGTH(f.fname) - 1)))"
|
||||||
" FROM files f JOIN groups g ON f.songalbumid = g.persistentid"
|
" FROM files f JOIN groups g ON f.songalbumid = g.persistentid"
|
||||||
" WHERE g.id = %d AND f.disabled = 0;", qp->id);
|
" WHERE g.id = %d AND f.disabled = 0 AND f.data_kind = 0;", qp->id);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@ -1095,7 +1095,7 @@ db_build_query_group_dirs(struct query_params *qp, char **q)
|
|||||||
case G_ALBUMS:
|
case G_ALBUMS:
|
||||||
query = sqlite3_mprintf("SELECT DISTINCT(SUBSTR(f.path, 1, LENGTH(f.path) - LENGTH(f.fname) - 1))"
|
query = sqlite3_mprintf("SELECT DISTINCT(SUBSTR(f.path, 1, LENGTH(f.path) - LENGTH(f.fname) - 1))"
|
||||||
" FROM files f JOIN groups g ON f.songalbumid = g.persistentid"
|
" FROM files f JOIN groups g ON f.songalbumid = g.persistentid"
|
||||||
" WHERE g.id = %d AND f.disabled = 0;", qp->id);
|
" WHERE g.id = %d AND f.disabled = 0 AND f.data_kind = 0;", qp->id);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user