mirror of
https://github.com/owntone/owntone-server.git
synced 2025-04-01 02:03:45 -04:00
[daap] Move daap_query_parse_sql() into dmap_common.c/h, drop daap_query.c/h
This commit is contained in:
parent
71b4444118
commit
228c8e7920
@ -115,7 +115,6 @@ owntone_SOURCES = main.c \
|
|||||||
misc.c misc.h \
|
misc.c misc.h \
|
||||||
misc_json.c misc_json.h \
|
misc_json.c misc_json.h \
|
||||||
rng.c rng.h \
|
rng.c rng.h \
|
||||||
daap_query.c daap_query.h \
|
|
||||||
smartpl_query.c smartpl_query.h \
|
smartpl_query.c smartpl_query.h \
|
||||||
player.c player.h \
|
player.c player.h \
|
||||||
worker.c worker.h \
|
worker.c worker.h \
|
||||||
|
@ -1,50 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2021-2022 Espen Jürgensen <espenjurgensen@gmail.com>
|
|
||||||
*
|
|
||||||
* 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 <config.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdint.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <errno.h>
|
|
||||||
|
|
||||||
#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);
|
|
||||||
}
|
|
@ -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__ */
|
|
@ -28,7 +28,7 @@
|
|||||||
#include "httpd.h"
|
#include "httpd.h"
|
||||||
#include "logger.h"
|
#include "logger.h"
|
||||||
#include "dmap_common.h"
|
#include "dmap_common.h"
|
||||||
|
#include "parsers/daap_parser.h"
|
||||||
|
|
||||||
/* gperf static hash, dmap_fields.gperf */
|
/* gperf static hash, dmap_fields.gperf */
|
||||||
#include "dmap_fields_hash.h"
|
#include "dmap_fields_hash.h"
|
||||||
@ -636,3 +636,21 @@ dmap_encode_queue_metadata(struct evbuffer *songlist, struct evbuffer *song, str
|
|||||||
|
|
||||||
return 0;
|
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);
|
||||||
|
}
|
||||||
|
@ -88,4 +88,7 @@ dmap_encode_file_metadata(struct evbuffer *songlist, struct evbuffer *song, stru
|
|||||||
int
|
int
|
||||||
dmap_encode_queue_metadata(struct evbuffer *songlist, struct evbuffer *song, struct db_queue_item *queue_item);
|
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__ */
|
#endif /* !__DMAP_HELPERS_H__ */
|
||||||
|
@ -51,7 +51,6 @@
|
|||||||
#include "misc.h"
|
#include "misc.h"
|
||||||
#include "transcode.h"
|
#include "transcode.h"
|
||||||
#include "artwork.h"
|
#include "artwork.h"
|
||||||
#include "daap_query.h"
|
|
||||||
#include "dmap_common.h"
|
#include "dmap_common.h"
|
||||||
#include "cache.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);
|
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)
|
if (!qp->filter)
|
||||||
DPRINTF(E_LOG, L_DAAP, "Ignoring improper DAAP query: %s\n", param);
|
DPRINTF(E_LOG, L_DAAP, "Ignoring improper DAAP query: %s\n", param);
|
||||||
|
|
||||||
|
@ -46,7 +46,6 @@
|
|||||||
#include "artwork.h"
|
#include "artwork.h"
|
||||||
#include "dmap_common.h"
|
#include "dmap_common.h"
|
||||||
#include "db.h"
|
#include "db.h"
|
||||||
#include "daap_query.h"
|
|
||||||
#include "player.h"
|
#include "player.h"
|
||||||
#include "listener.h"
|
#include "listener.h"
|
||||||
|
|
||||||
@ -237,7 +236,7 @@ find_first_song_id(const char *query)
|
|||||||
qp.sort = S_NONE;
|
qp.sort = S_NONE;
|
||||||
qp.offset = 0;
|
qp.offset = 0;
|
||||||
qp.limit = 1;
|
qp.limit = 1;
|
||||||
qp.filter = daap_query_parse_sql(query);
|
qp.filter = dmap_query_parse_sql(query);
|
||||||
if (!qp.filter)
|
if (!qp.filter)
|
||||||
{
|
{
|
||||||
DPRINTF(E_LOG, L_DACP, "Improper DAAP query!\n");
|
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;
|
return -1;
|
||||||
}
|
}
|
||||||
qp.filter = daap_query_parse_sql(buf);
|
qp.filter = dmap_query_parse_sql(buf);
|
||||||
}
|
}
|
||||||
else
|
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
|
// If the queuefilter is unkown, ignore it and use the query parameter instead to build the sql query
|
||||||
id = 0;
|
id = 0;
|
||||||
qp.type = Q_ITEMS;
|
qp.type = Q_ITEMS;
|
||||||
qp.filter = daap_query_parse_sql(query);
|
qp.filter = dmap_query_parse_sql(query);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
id = 0;
|
id = 0;
|
||||||
qp.type = Q_ITEMS;
|
qp.type = Q_ITEMS;
|
||||||
qp.filter = daap_query_parse_sql(query);
|
qp.filter = dmap_query_parse_sql(query);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sort)
|
if (sort)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user