diff --git a/src/Makefile.am b/src/Makefile.am index 81a1d319..433828ba 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -115,7 +115,6 @@ owntone_SOURCES = main.c \ misc.c misc.h \ misc_json.c misc_json.h \ rng.c rng.h \ - daap_query.c daap_query.h \ smartpl_query.c smartpl_query.h \ player.c player.h \ worker.c worker.h \ diff --git a/src/daap_query.c b/src/daap_query.c deleted file mode 100644 index 25ada9c2..00000000 --- a/src/daap_query.c +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (C) 2021-2022 Espen Jürgensen - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include -#include -#include -#include - -#include "daap_query.h" -#include "parsers/daap_parser.h" -#include "logger.h" -#include "misc.h" - - -char * -daap_query_parse_sql(const char *daap_query) -{ - struct daap_result result; - - DPRINTF(E_SPAM, L_DAAP, "Parse DAAP query input '%s'\n", daap_query); - - if (daap_lex_parse(&result, daap_query) != 0) - { - DPRINTF(E_LOG, L_DAAP, "Could not parse '%s': %s\n", daap_query, result.errmsg); - return NULL; - } - - DPRINTF(E_SPAM, L_DAAP, "Parse DAAP query output '%s'\n", result.str); - - return safe_strdup(result.str); -} diff --git a/src/daap_query.h b/src/daap_query.h deleted file mode 100644 index d5a44930..00000000 --- a/src/daap_query.h +++ /dev/null @@ -1,12 +0,0 @@ - -#ifndef __DAAP_QUERY_H__ -#define __DAAP_QUERY_H__ - -#include "logger.h" -#include "misc.h" - - -char * -daap_query_parse_sql(const char *daap_query); - -#endif /* !__DAAP_QUERY_H__ */ diff --git a/src/dmap_common.c b/src/dmap_common.c index c5a4d0b8..979e0b96 100644 --- a/src/dmap_common.c +++ b/src/dmap_common.c @@ -28,7 +28,7 @@ #include "httpd.h" #include "logger.h" #include "dmap_common.h" - +#include "parsers/daap_parser.h" /* gperf static hash, dmap_fields.gperf */ #include "dmap_fields_hash.h" @@ -636,3 +636,21 @@ dmap_encode_queue_metadata(struct evbuffer *songlist, struct evbuffer *song, str return 0; } + +char * +dmap_query_parse_sql(const char *dmap_query) +{ + struct daap_result result; + + DPRINTF(E_SPAM, L_DAAP, "Parse DMAP query input '%s'\n", dmap_query); + + if (daap_lex_parse(&result, dmap_query) != 0) + { + DPRINTF(E_LOG, L_DAAP, "Could not parse '%s': %s\n", dmap_query, result.errmsg); + return NULL; + } + + DPRINTF(E_SPAM, L_DAAP, "Parse DMAP query output '%s'\n", result.str); + + return safe_strdup(result.str); +} diff --git a/src/dmap_common.h b/src/dmap_common.h index 704f60ab..2babd621 100644 --- a/src/dmap_common.h +++ b/src/dmap_common.h @@ -88,4 +88,7 @@ dmap_encode_file_metadata(struct evbuffer *songlist, struct evbuffer *song, stru int dmap_encode_queue_metadata(struct evbuffer *songlist, struct evbuffer *song, struct db_queue_item *queue_item); +char * +dmap_query_parse_sql(const char *dmap_query); + #endif /* !__DMAP_HELPERS_H__ */ diff --git a/src/httpd_daap.c b/src/httpd_daap.c index 72ef73fc..e87d1f45 100644 --- a/src/httpd_daap.c +++ b/src/httpd_daap.c @@ -51,7 +51,6 @@ #include "misc.h" #include "transcode.h" #include "artwork.h" -#include "daap_query.h" #include "dmap_common.h" #include "cache.h" @@ -597,7 +596,7 @@ query_params_set(struct query_params *qp, int *sort_headers, struct httpd_reques { DPRINTF(E_DBG, L_DAAP, "DAAP browse query filter: %s\n", param); - qp->filter = daap_query_parse_sql(param); + qp->filter = dmap_query_parse_sql(param); if (!qp->filter) DPRINTF(E_LOG, L_DAAP, "Ignoring improper DAAP query: %s\n", param); diff --git a/src/httpd_dacp.c b/src/httpd_dacp.c index fcb7f812..e770d762 100644 --- a/src/httpd_dacp.c +++ b/src/httpd_dacp.c @@ -46,7 +46,6 @@ #include "artwork.h" #include "dmap_common.h" #include "db.h" -#include "daap_query.h" #include "player.h" #include "listener.h" @@ -237,7 +236,7 @@ find_first_song_id(const char *query) qp.sort = S_NONE; qp.offset = 0; qp.limit = 1; - qp.filter = daap_query_parse_sql(query); + qp.filter = dmap_query_parse_sql(query); if (!qp.filter) { DPRINTF(E_LOG, L_DACP, "Improper DAAP query!\n"); @@ -378,7 +377,7 @@ dacp_queueitem_add(const char *query, const char *queuefilter, const char *sort, return -1; } - qp.filter = daap_query_parse_sql(buf); + qp.filter = dmap_query_parse_sql(buf); } else { @@ -387,14 +386,14 @@ dacp_queueitem_add(const char *query, const char *queuefilter, const char *sort, // If the queuefilter is unkown, ignore it and use the query parameter instead to build the sql query id = 0; qp.type = Q_ITEMS; - qp.filter = daap_query_parse_sql(query); + qp.filter = dmap_query_parse_sql(query); } } else { id = 0; qp.type = Q_ITEMS; - qp.filter = daap_query_parse_sql(query); + qp.filter = dmap_query_parse_sql(query); } if (sort)