mirror of
https://github.com/owntone/owntone-server.git
synced 2025-01-28 15:06:02 -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);
|
ret = db_build_query_browse(qp, "year", "year", &query);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case Q_BROWSE_DISCS:
|
||||||
|
ret = db_build_query_browse(qp, "disc", "disc", &query);
|
||||||
|
break;
|
||||||
|
|
||||||
case Q_COUNT_ITEMS:
|
case Q_COUNT_ITEMS:
|
||||||
ret = db_build_query_count_items(qp, &query);
|
ret = db_build_query_count_items(qp, &query);
|
||||||
break;
|
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_GROUP_DIRS = Q_F_BROWSE | (1 << 10),
|
||||||
Q_BROWSE_YEARS = Q_F_BROWSE | (1 << 11),
|
Q_BROWSE_YEARS = Q_F_BROWSE | (1 << 11),
|
||||||
Q_COUNT_ITEMS = (1 << 12),
|
Q_COUNT_ITEMS = (1 << 12),
|
||||||
|
Q_BROWSE_DISCS = Q_F_BROWSE | (1 << 13),
|
||||||
};
|
};
|
||||||
|
|
||||||
#define ARTWORK_UNKNOWN 0
|
#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 start_pos;
|
||||||
int end_pos;
|
int end_pos;
|
||||||
int i;
|
int i;
|
||||||
|
uint32_t num;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
c1 = NULL;
|
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]);
|
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)
|
else if (i == 0 && argc == 1)
|
||||||
{
|
{
|
||||||
// Special case: a single token is allowed if listing albums for an artist
|
// 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;
|
qp.sort = S_NONE;
|
||||||
type = "Genre: ";
|
type = "Genre: ";
|
||||||
}
|
}
|
||||||
|
else if (0 == strcasecmp(argv[1], "disc"))
|
||||||
|
{
|
||||||
|
qp.type = Q_BROWSE_DISCS;
|
||||||
|
qp.sort = S_NONE;
|
||||||
|
type = "Disc: ";
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
DPRINTF(E_WARN, L_MPD, "Unsupported type argument for command 'list': %s\n", argv[1]);
|
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 start_pos;
|
||||||
int end_pos;
|
int end_pos;
|
||||||
int i;
|
int i;
|
||||||
|
uint32_t num;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
c1 = NULL;
|
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]);
|
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
|
else
|
||||||
{
|
{
|
||||||
DPRINTF(E_WARN, L_MPD, "Parameter '%s' is not supported by forked-daapd and will be ignored\n", argv[i]);
|
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