mirror of
https://github.com/owntone/owntone-server.git
synced 2024-12-28 16:15:57 -05:00
[mpd] support "track" parameter in commands "list", "find", "search"
This commit is contained in:
parent
ed8b69c118
commit
fefd91fabc
4
src/db.c
4
src/db.c
@ -1539,6 +1539,10 @@ db_query_start(struct query_params *qp)
|
||||
ret = db_build_query_browse(qp, "disc", "disc", &query);
|
||||
break;
|
||||
|
||||
case Q_BROWSE_TRACKS:
|
||||
ret = db_build_query_browse(qp, "track", "track", &query);
|
||||
break;
|
||||
|
||||
case Q_COUNT_ITEMS:
|
||||
ret = db_build_query_count_items(qp, &query);
|
||||
break;
|
||||
|
1
src/db.h
1
src/db.h
@ -42,6 +42,7 @@ enum query_type {
|
||||
Q_BROWSE_YEARS = Q_F_BROWSE | (1 << 11),
|
||||
Q_COUNT_ITEMS = (1 << 12),
|
||||
Q_BROWSE_DISCS = Q_F_BROWSE | (1 << 13),
|
||||
Q_BROWSE_TRACKS = Q_F_BROWSE | (1 << 14),
|
||||
};
|
||||
|
||||
#define ARTWORK_UNKNOWN 0
|
||||
|
22
src/mpd.c
22
src/mpd.c
@ -1991,6 +1991,14 @@ mpd_get_query_params_find(int argc, char **argv, struct query_params *qp)
|
||||
else
|
||||
c1 = sqlite3_mprintf("(f.disc = %d)", num);
|
||||
}
|
||||
else if (0 == strcasecmp(argv[i], "track"))
|
||||
{
|
||||
ret = safe_atou32(argv[i + 1], &num);
|
||||
if (ret < 0)
|
||||
DPRINTF(E_WARN, L_MPD, "Track parameter '%s' is not an integer and will be ignored\n", argv[i + 1]);
|
||||
else
|
||||
c1 = sqlite3_mprintf("(f.track = %d)", num);
|
||||
}
|
||||
else if (i == 0 && argc == 1)
|
||||
{
|
||||
// Special case: a single token is allowed if listing albums for an artist
|
||||
@ -2226,6 +2234,12 @@ mpd_command_list(struct evbuffer *evbuf, int argc, char **argv, char **errmsg)
|
||||
qp.sort = S_NONE;
|
||||
type = "Disc: ";
|
||||
}
|
||||
else if (0 == strcasecmp(argv[1], "track"))
|
||||
{
|
||||
qp.type = Q_BROWSE_TRACKS;
|
||||
qp.sort = S_NONE;
|
||||
type = "Track: ";
|
||||
}
|
||||
else
|
||||
{
|
||||
DPRINTF(E_WARN, L_MPD, "Unsupported type argument for command 'list': %s\n", argv[1]);
|
||||
@ -2450,6 +2464,14 @@ mpd_get_query_params_search(int argc, char **argv, struct query_params *qp)
|
||||
else
|
||||
c1 = sqlite3_mprintf("(f.disc = %d)", num);
|
||||
}
|
||||
else if (0 == strcasecmp(argv[i], "track"))
|
||||
{
|
||||
ret = safe_atou32(argv[i + 1], &num);
|
||||
if (ret < 0)
|
||||
DPRINTF(E_WARN, L_MPD, "Track parameter '%s' is not an integer and will be ignored\n", argv[i + 1]);
|
||||
else
|
||||
c1 = sqlite3_mprintf("(f.track = %d)", num);
|
||||
}
|
||||
else
|
||||
{
|
||||
DPRINTF(E_WARN, L_MPD, "Parameter '%s' is not supported by forked-daapd and will be ignored\n", argv[i]);
|
||||
|
Loading…
Reference in New Issue
Block a user