[DEV] missing dev
This commit is contained in:
parent
8ba04a5048
commit
189078885f
82
appl/cds.cpp
82
appl/cds.cpp
@ -176,31 +176,27 @@
|
|||||||
/* Represent the Search 'AND' connector keyword */
|
/* Represent the Search 'AND' connector keyword */
|
||||||
#define SEARCH_AND ") and ("
|
#define SEARCH_AND ") and ("
|
||||||
|
|
||||||
static bool
|
static bool filter_has_val(const char *filter, const char *val) {
|
||||||
filter_has_val (const char *filter, const char *val)
|
|
||||||
{
|
|
||||||
char *x = NULL, *token = NULL;
|
char *x = NULL, *token = NULL;
|
||||||
char *m_buffer = NULL, *buffer;
|
char *m_buffer = NULL, *buffer;
|
||||||
int len = strlen (val);
|
int len = strlen (val);
|
||||||
bool ret = false;
|
bool ret = false;
|
||||||
|
|
||||||
if (!strcmp (filter, "*"))
|
if (!strcmp (filter, "*")) {
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
x = strdup (filter);
|
x = strdup (filter);
|
||||||
if (x)
|
if (x) {
|
||||||
{
|
|
||||||
m_buffer = (char*) malloc (strlen (x));
|
m_buffer = (char*) malloc (strlen (x));
|
||||||
if (m_buffer)
|
if (m_buffer) {
|
||||||
{
|
|
||||||
buffer = m_buffer;
|
buffer = m_buffer;
|
||||||
token = strtok_r (x, ",", &buffer);
|
token = strtok_r (x, ",", &buffer);
|
||||||
while (token)
|
while (token) {
|
||||||
{
|
if (*val == '@') {
|
||||||
if (*val == '@')
|
|
||||||
token = strchr (token, '@');
|
token = strchr (token, '@');
|
||||||
if (token && !strncmp (token, val, len))
|
}
|
||||||
{
|
if (token && !strncmp (token, val, len)) {
|
||||||
ret = true;
|
ret = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -214,74 +210,54 @@ filter_has_val (const char *filter, const char *val)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* UPnP ContentDirectory Service actions */
|
/* UPnP ContentDirectory Service actions */
|
||||||
static bool
|
static bool cds_get_search_capabilities(struct action_event_t *event) {
|
||||||
cds_get_search_capabilities (struct action_event_t *event)
|
upnp_add_response(event, SERVICE_CDS_ARG_SEARCH_CAPS, "");
|
||||||
{
|
|
||||||
upnp_add_response (event, SERVICE_CDS_ARG_SEARCH_CAPS, "");
|
|
||||||
|
|
||||||
return event->status;
|
return event->status;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
static bool cds_get_sort_capabilities(struct action_event_t *event) {
|
||||||
cds_get_sort_capabilities (struct action_event_t *event)
|
upnp_add_response(event, SERVICE_CDS_ARG_SORT_CAPS, "");
|
||||||
{
|
|
||||||
upnp_add_response (event, SERVICE_CDS_ARG_SORT_CAPS, "");
|
|
||||||
|
|
||||||
return event->status;
|
return event->status;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
static bool cds_get_system_update_id(struct action_event_t *event) {
|
||||||
cds_get_system_update_id (struct action_event_t *event)
|
upnp_add_response(event, SERVICE_CDS_ARG_UPDATE_ID,
|
||||||
{
|
|
||||||
upnp_add_response (event, SERVICE_CDS_ARG_UPDATE_ID,
|
|
||||||
SERVICE_CDS_ROOT_OBJECT_ID);
|
SERVICE_CDS_ROOT_OBJECT_ID);
|
||||||
|
|
||||||
return event->status;
|
return event->status;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void didl_add_header (struct buffer_t *out) {
|
||||||
didl_add_header (struct buffer_t *out)
|
buffer_appendf(out, "<%s %s>", DIDL_LITE, DIDL_NAMESPACE);
|
||||||
{
|
|
||||||
buffer_appendf (out, "<%s %s>", DIDL_LITE, DIDL_NAMESPACE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void didl_add_footer (struct buffer_t *out) {
|
||||||
didl_add_footer (struct buffer_t *out)
|
buffer_appendf(out, "</%s>", DIDL_LITE);
|
||||||
{
|
|
||||||
buffer_appendf (out, "</%s>", DIDL_LITE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void didl_add_tag(struct buffer_t *out, char *tag, char *value) {
|
||||||
didl_add_tag (struct buffer_t *out, char *tag, char *value)
|
if (value) {
|
||||||
{
|
buffer_appendf(out, "<%s>%s</%s>", tag, value, tag);
|
||||||
if (value)
|
}
|
||||||
buffer_appendf (out, "<%s>%s</%s>", tag, value, tag);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void didl_add_param(struct buffer_t *out, char *param, char *value) {
|
||||||
didl_add_param (struct buffer_t *out, char *param, char *value)
|
if (value) {
|
||||||
{
|
|
||||||
if (value)
|
|
||||||
buffer_appendf (out, " %s=\"%s\"", param, value);
|
buffer_appendf (out, " %s=\"%s\"", param, value);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void didl_add_value(struct buffer_t *out, char *param, off_t value) {
|
||||||
didl_add_value (struct buffer_t *out, char *param, off_t value)
|
|
||||||
{
|
|
||||||
buffer_appendf (out, " %s=\"%lld\"", param, value);
|
buffer_appendf (out, " %s=\"%lld\"", param, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void didl_add_item (struct buffer_t *out, int item_id,
|
||||||
didl_add_item (struct buffer_t *out, int item_id,
|
|
||||||
int parent_id, char *restricted, char *classPointer, char *title,
|
int parent_id, char *restricted, char *classPointer, char *title,
|
||||||
char *protocol_info, off_t size, char *url, char *filter)
|
char *protocol_info, off_t size, char *url, char *filter) {
|
||||||
{
|
|
||||||
buffer_appendf (out, "<%s", DIDL_ITEM);
|
buffer_appendf (out, "<%s", DIDL_ITEM);
|
||||||
didl_add_value (out, DIDL_ITEM_ID, item_id);
|
didl_add_value (out, DIDL_ITEM_ID, item_id);
|
||||||
didl_add_value (out, DIDL_ITEM_PARENT_ID, parent_id);
|
didl_add_value (out, DIDL_ITEM_PARENT_ID, parent_id);
|
||||||
didl_add_param (out, DIDL_ITEM_RESTRICTED, restricted);
|
didl_add_param (out, DIDL_ITEM_RESTRICTED, restricted);
|
||||||
buffer_append (out, ">");
|
buffer_append (out, ">");
|
||||||
|
|
||||||
didl_add_tag (out, DIDL_ITEM_CLASS, classPointer);
|
didl_add_tag (out, DIDL_ITEM_CLASS, classPointer);
|
||||||
didl_add_tag (out, DIDL_ITEM_TITLE, title);
|
didl_add_tag (out, DIDL_ITEM_TITLE, title);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user