Exemple #1
0
static htsmsg_t *
avt_SetAVTransportURI(http_connection_t *hc, htsmsg_t *args,
		      const char *myhost, int myport)
{
  const char *uri = htsmsg_get_str(args, "CurrentURI");
  const char *metaxml = htsmsg_get_str(args, "CurrentURIMetaData");
  char errbuf[200];
  htsmsg_t *meta;

  if(uri == NULL)
    return NULL;

  if(metaxml == NULL) {
    playqueue_play(uri, prop_create_root(NULL), 1);
    return NULL;
  }

  meta = htsmsg_xml_deserialize_cstr(metaxml, errbuf, sizeof(errbuf));
  if(meta == NULL) {
    TRACE(TRACE_ERROR, "UPNP", 
	  "SetAVTransportURI: Unable to parse metadata -- %s", errbuf);
    return NULL;
  }
  
  if(play_with_context(uri, meta)) {
    // Failed to play from context
    // TODO: Fix metadata here
    playqueue_play(uri, prop_create_root(NULL), 1);
  }
  htsmsg_release(meta);
  return NULL;
}
Exemple #2
0
static int
es_htsmsg_create_from_xml_duk(duk_context *ctx)
{
  char errbuf[256];
  const char *xml = duk_safe_to_string(ctx, 0);

  htsmsg_t *m = htsmsg_xml_deserialize_cstr(xml, errbuf, sizeof(errbuf));
  if(m == NULL)
    duk_error(ctx, DUK_ERR_ERROR, "Malformed XML -- %s", errbuf);

  es_push_native_obj(ctx, &es_native_htsmsg, m);
  return 1;
}