mirror of
https://github.com/owntone/owntone-server.git
synced 2025-01-29 15:36:00 -05:00
Merge pull request #1170 from chme/mpd-modified-since
[mpd] Support search/find/count with `modified-since` filter criteria
This commit is contained in:
commit
5ece7b9591
@ -192,6 +192,7 @@ static struct mpd_tagtype tagtypes[] =
|
|||||||
{ "file", NULL, NULL, NULL, MPD_TYPE_SPECIAL, -1, true, },
|
{ "file", NULL, NULL, NULL, MPD_TYPE_SPECIAL, -1, true, },
|
||||||
{ "base", NULL, NULL, NULL, MPD_TYPE_SPECIAL, -1, true, },
|
{ "base", NULL, NULL, NULL, MPD_TYPE_SPECIAL, -1, true, },
|
||||||
{ "any", NULL, NULL, NULL, MPD_TYPE_SPECIAL, -1, true, },
|
{ "any", NULL, NULL, NULL, MPD_TYPE_SPECIAL, -1, true, },
|
||||||
|
{ "modified-since", NULL, NULL, NULL, MPD_TYPE_SPECIAL, -1, true, },
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -738,6 +739,14 @@ parse_filter_window_params(int argc, char **argv, bool exact_match, struct query
|
|||||||
{
|
{
|
||||||
c1 = db_mprintf("(f.virtual_path LIKE '/%q%%')", argv[i + 1]);
|
c1 = db_mprintf("(f.virtual_path LIKE '/%q%%')", argv[i + 1]);
|
||||||
}
|
}
|
||||||
|
else if (0 == strcasecmp(tagtype->tag, "modified-since"))
|
||||||
|
{
|
||||||
|
// according to the mpd protocol specification the value can be a unix timestamp or ISO 8601
|
||||||
|
if (strchr(argv[i + 1], '-') == NULL)
|
||||||
|
c1 = db_mprintf("(f.time_modified > strftime('%%s', datetime('%q', 'unixepoch')))", argv[i + 1]);
|
||||||
|
else
|
||||||
|
c1 = db_mprintf("(f.time_modified > strftime('%%s', datetime('%q', 'utc')))", argv[i + 1]);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
DPRINTF(E_WARN, L_MPD, "Unknown special parameter '%s' will be ignored\n", tagtype->tag);
|
DPRINTF(E_WARN, L_MPD, "Unknown special parameter '%s' will be ignored\n", tagtype->tag);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user