mirror of
https://github.com/owntone/owntone-server.git
synced 2025-01-27 06:33:21 -05:00
[mpd] support "disc" parameter in commands "list", "find", "search"
This commit is contained in:
parent
a03a9d1e7c
commit
1300b2f018
4
src/db.c
4
src/db.c
@ -1535,6 +1535,10 @@ db_query_start(struct query_params *qp)
|
||||
ret = db_build_query_browse(qp, "year", "year", &query);
|
||||
break;
|
||||
|
||||
case Q_BROWSE_DISCS:
|
||||
ret = db_build_query_browse(qp, "disc", "disc", &query);
|
||||
break;
|
||||
|
||||
case Q_COUNT_ITEMS:
|
||||
ret = db_build_query_count_items(qp, &query);
|
||||
break;
|
||||
|
1
src/db.h
1
src/db.h
@ -41,6 +41,7 @@ enum query_type {
|
||||
Q_GROUP_DIRS = Q_F_BROWSE | (1 << 10),
|
||||
Q_BROWSE_YEARS = Q_F_BROWSE | (1 << 11),
|
||||
Q_COUNT_ITEMS = (1 << 12),
|
||||
Q_BROWSE_DISCS = Q_F_BROWSE | (1 << 13),
|
||||
};
|
||||
|
||||
#define ARTWORK_UNKNOWN 0
|
||||
|
24
src/mpd.c
24
src/mpd.c
@ -1925,6 +1925,7 @@ mpd_get_query_params_find(int argc, char **argv, struct query_params *qp)
|
||||
int start_pos;
|
||||
int end_pos;
|
||||
int i;
|
||||
uint32_t num;
|
||||
int ret;
|
||||
|
||||
c1 = NULL;
|
||||
@ -1982,6 +1983,14 @@ mpd_get_query_params_find(int argc, char **argv, struct query_params *qp)
|
||||
{
|
||||
c1 = sqlite3_mprintf("(f.genre = '%q')", argv[i + 1]);
|
||||
}
|
||||
else if (0 == strcasecmp(argv[i], "disc"))
|
||||
{
|
||||
ret = safe_atou32(argv[i + 1], &num);
|
||||
if (ret < 0)
|
||||
DPRINTF(E_WARN, L_MPD, "Disc parameter '%s' is not an integer and will be ignored\n", argv[i + 1]);
|
||||
else
|
||||
c1 = sqlite3_mprintf("(f.disc = %d)", num);
|
||||
}
|
||||
else if (i == 0 && argc == 1)
|
||||
{
|
||||
// Special case: a single token is allowed if listing albums for an artist
|
||||
@ -2211,6 +2220,12 @@ mpd_command_list(struct evbuffer *evbuf, int argc, char **argv, char **errmsg)
|
||||
qp.sort = S_NONE;
|
||||
type = "Genre: ";
|
||||
}
|
||||
else if (0 == strcasecmp(argv[1], "disc"))
|
||||
{
|
||||
qp.type = Q_BROWSE_DISCS;
|
||||
qp.sort = S_NONE;
|
||||
type = "Disc: ";
|
||||
}
|
||||
else
|
||||
{
|
||||
DPRINTF(E_WARN, L_MPD, "Unsupported type argument for command 'list': %s\n", argv[1]);
|
||||
@ -2369,6 +2384,7 @@ mpd_get_query_params_search(int argc, char **argv, struct query_params *qp)
|
||||
int start_pos;
|
||||
int end_pos;
|
||||
int i;
|
||||
uint32_t num;
|
||||
int ret;
|
||||
|
||||
c1 = NULL;
|
||||
@ -2426,6 +2442,14 @@ mpd_get_query_params_search(int argc, char **argv, struct query_params *qp)
|
||||
{
|
||||
c1 = sqlite3_mprintf("(f.genre LIKE '%%%q%%')", argv[i + 1]);
|
||||
}
|
||||
else if (0 == strcasecmp(argv[i], "disc"))
|
||||
{
|
||||
ret = safe_atou32(argv[i + 1], &num);
|
||||
if (ret < 0)
|
||||
DPRINTF(E_WARN, L_MPD, "Disc parameter '%s' is not an integer and will be ignored\n", argv[i + 1]);
|
||||
else
|
||||
c1 = sqlite3_mprintf("(f.disc = %d)", num);
|
||||
}
|
||||
else
|
||||
{
|
||||
DPRINTF(E_WARN, L_MPD, "Parameter '%s' is not supported by forked-daapd and will be ignored\n", argv[i]);
|
||||
|
Loading…
x
Reference in New Issue
Block a user