[mpd] support "date" argument in find and search commands

This commit is contained in:
chme 2015-05-30 05:44:52 +02:00
parent 2a04740ca2
commit 7f09438621

View File

@ -2190,6 +2190,14 @@ mpd_get_query_params_find(int argc, char **argv, struct query_params *qp)
else
c1 = sqlite3_mprintf("(f.track = %d)", num);
}
else if (0 == strcasecmp(argv[i], "date"))
{
ret = safe_atou32(argv[i + 1], &num);
if (ret < 0)
c1 = sqlite3_mprintf("(f.year = 0 OR f.year IS NULL)");
else
c1 = sqlite3_mprintf("(f.year = %d)", num);
}
else if (i == 0 && argc == 1)
{
// Special case: a single token is allowed if listing albums for an artist
@ -2683,6 +2691,14 @@ mpd_get_query_params_search(int argc, char **argv, struct query_params *qp)
else
c1 = sqlite3_mprintf("(f.track = %d)", num);
}
else if (0 == strcasecmp(argv[i], "date"))
{
ret = safe_atou32(argv[i + 1], &num);
if (ret < 0)
c1 = sqlite3_mprintf("(f.year = 0 OR f.year IS NULL)");
else
c1 = sqlite3_mprintf("(f.year = %d)", num);
}
else
{
DPRINTF(E_WARN, L_MPD, "Parameter '%s' is not supported by forked-daapd and will be ignored\n", argv[i]);