From 1694e6e11119f335182b62d66e8c44bc188457d9 Mon Sep 17 00:00:00 2001 From: chme Date: Sun, 9 Jan 2022 18:48:55 +0100 Subject: [PATCH] [smartpl] Add "scan_kind" field to smart query language --- src/SMARTPL.g | 3 +++ src/SMARTPL2SQL.g | 15 +++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/src/SMARTPL.g b/src/SMARTPL.g index 7e055aab..9275145c 100644 --- a/src/SMARTPL.g +++ b/src/SMARTPL.g @@ -114,6 +114,7 @@ DATETAG : 'time_added' ENUMTAG : 'data_kind' | 'media_kind' + | 'scan_kind' ; GROUPTAG : 'track_count' @@ -205,6 +206,8 @@ ENUMVAL : 'music' | 'url' | 'spotify' | 'pipe' + | 'files' + | 'rss' ; ORDERBY : 'order by' diff --git a/src/SMARTPL2SQL.g b/src/SMARTPL2SQL.g index b6f66815..1a763364 100644 --- a/src/SMARTPL2SQL.g +++ b/src/SMARTPL2SQL.g @@ -304,6 +304,21 @@ expression returns [ pANTLR3_STRING result, pANTLR3_STRING orderby, pANTLR3_STRI sprintf(str, "f.data_kind = \%d", DATA_KIND_PIPE); } } + else if (strcmp((char *)tag, "scan_kind") == 0) + { + if (strcmp((char *)val, "files") == 0) + { + sprintf(str, "f.scan_kind = \%d", SCAN_KIND_FILES); + } + else if (strcmp((char *)val, "spotify") == 0) + { + sprintf(str, "f.scan_kind = \%d", SCAN_KIND_SPOTIFY); + } + else if (strcmp((char *)val, "rss") == 0) + { + sprintf(str, "f.scan_kind = \%d", SCAN_KIND_RSS); + } + } $result = $ENUMTAG.text->factory->newRaw($ENUMTAG.text->factory); $result->append8($result, str);