diff -ruN /tmp/gmediaserver-0.9.0/src/contentdir.c ./src/contentdir.c --- /tmp/gmediaserver-0.9.0/src/contentdir.c 2005-12-11 01:19:48.000000000 +0100 +++ ./src/contentdir.c 2006-01-07 22:18:56.000000000 +0100 @@ -234,13 +234,13 @@ if (has_entry_detail(entry, DETAIL_CHILDREN)) { detail = get_entry_detail(entry, DETAIL_CHILDREN); strbuf_appendf(result, - "", + "", entry->id, entry->parent, detail->data.children.count); } else { strbuf_appendf(result, - "", + "", entry->id, entry->parent); if (filter_includes_any(filter, "res", "@protocolInfo", "@size", "address@hidden", "address@hidden", NULL)) { @@ -251,8 +251,8 @@ strbuf_appendf(result, " protocolInfo=\"http-get:*:%s:*\"", detail->data.file.mime_type); /*if (detail->data.file.size != 0)*/ if (filter_includes_any(filter, "res", "@size", "address@hidden", NULL)) - strbuf_appendf(result, " size=\"%" PRIu32 "\"", detail->data.file.size); - strbuf_appendf(result, ">http://%s:%d/files/%d", + strbuf_appendf(result, " size=\"%" PRIu32 "\" duration=\"0:02:00.000\"", detail->data.file.size); + strbuf_appendf(result, ">http://%s:%d/files/%d.mp3", UpnpGetServerIpAddress(), UpnpGetServerPort(), entry->id); @@ -261,7 +261,7 @@ strbuf_append(result, "http://%s:%d/files/%d", + strbuf_appendf(result, ">http://%s:%d/files/%d.mp3", UpnpGetServerIpAddress(), UpnpGetServerPort(), entry->id); @@ -534,7 +534,7 @@ StrBuf *result; /* Retrieve arguments */ - id = upnp_get_i4(event, "ContainerID"); /* See comment for ObjectID in browse */ + id = 0;//upnp_get_i4(event, "ContainerID"); /* See comment for ObjectID in browse */ search_criteria = upnp_get_string(event, "SearchCriteria"); sort_criteria = upnp_get_string(event, "SortCriteria"); filter = upnp_get_string(event, "Filter"); @@ -549,11 +549,11 @@ count = UINT32_MAX; /* SortCriteria not supported at the moment */ - if (strcmp(sort_criteria, "") != 0) { + /*if (strcmp(sort_criteria, "") != 0) { upnp_set_error(event, UPNP_CONTENTDIR_E_BAD_SORT_CRITERIA, _("Sorting not supported")); return false; - } + }*/ /* Check SearchCriteria */ criteria = parse_search_criteria(search_criteria, &error); @@ -593,7 +593,7 @@ /* Make response. */ upnp_add_response(event, "Result", strbuf_buffer(result)); upnp_add_response(event, "NumberReturned", int32_str(match_count)); - upnp_add_response(event, "TotalMatches", "0"); + upnp_add_response(event, "TotalMatches", int32_str(match_count));// "0"); upnp_add_response(event, "UpdateID", uint32_str(id == 0 ? update_id : 0)); strbuf_free(result); unlock_metadata(); diff -ruN /tmp/gmediaserver-0.9.0/src/gmediaserver.h ./src/gmediaserver.h --- /tmp/gmediaserver-0.9.0/src/gmediaserver.h 2005-10-10 08:10:37.000000000 +0200 +++ ./src/gmediaserver.h 2006-01-06 20:03:16.000000000 +0100 @@ -257,6 +257,13 @@ extern ServiceAction connectmgr_service_actions[]; extern ServiceVariable connectmgr_service_variables[]; +/* mediarecreg.c */ +#define MEDIARECREG_SERVICE_ID "urn:microsoft.com:serviceId:X_MS_MediaReceiverRegistrar" +extern ServiceAction mediarecreg_service_actions[]; +extern ServiceVariable mediarecreg_service_variables[]; + + + /* url.c */ void sgmlescape(const char *str, char *target, uint32_t *length); char *xsgmlescape(const char *str); diff -ruN /tmp/gmediaserver-0.9.0/src/Makefile.in ./src/Makefile.in --- /tmp/gmediaserver-0.9.0/src/Makefile.in 2005-12-13 21:50:45.000000000 +0100 +++ ./src/Makefile.in 2006-01-06 18:01:56.000000000 +0100 @@ -83,7 +83,7 @@ am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)" binPROGRAMS_INSTALL = $(INSTALL_PROGRAM) PROGRAMS = $(bin_PROGRAMS) -am_gmediaserver_OBJECTS = connectmgr.$(OBJEXT) contentdir.$(OBJEXT) \ +am_gmediaserver_OBJECTS = connectmgr.$(OBJEXT) contentdir.$(OBJEXT) mediarecreg.${OBJEXT} \ interface.$(OBJEXT) logging.$(OBJEXT) upnp.$(OBJEXT) \ webserver.$(OBJEXT) webclient.$(OBJEXT) main.$(OBJEXT) \ metadata.$(OBJEXT) url.$(OBJEXT) search-lexer.$(OBJEXT) \ @@ -262,6 +262,7 @@ gmediaserver_SOURCES = \ connectmgr.c \ contentdir.c \ + mediarecreg.c \ interface.c \ logging.c \ upnp.c \ @@ -370,6 +371,7 @@ @AMDEP_TRUE@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@ @AMDEP_TRUE@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@ address@hidden@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@ @AMDEP_TRUE@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@ @AMDEP_TRUE@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@ @AMDEP_TRUE@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@ diff -ruN /tmp/gmediaserver-0.9.0/src/mediarecreg.c ./src/mediarecreg.c --- /tmp/gmediaserver-0.9.0/src/mediarecreg.c 1970-01-01 01:00:00.000000000 +0100 +++ ./src/mediarecreg.c 2006-01-06 20:06:36.000000000 +0100 @@ -0,0 +1,82 @@ +/* contentdir.c - Implementation of UPnP ContentDirectory + * + * Copyright (C) 2005 Oskar Liljeblad + * + * 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 Library 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include +#include /* Gnulib/C99 */ +#include /* ? */ +#include "gettext.h" /* Gnulib/gettext */ +#define _(s) gettext(s) +#define N_(s) gettext_noop(s) +#include "xvasprintf.h" /* Gnulib */ +#include "minmax.h" /* Gnulib */ +#include "xalloc.h" /* Gnulib */ +#include "quotearg.h" /* Gnulib */ +#include "dirname.h" /* Gnulib */ +#include "strbuf.h" +#include "intutil.h" +#include "strutil.h" +#include "gmediaserver.h" +#include "search-parser.h" +#include "search-lexer.h" + +extern int yyparse(yyscan_t scanner, SearchCriteriaParseData *data); + +static uint32_t update_id = 0; + +static ServiceVariable * +find_variable(const char *name) +{ + int c; + for (c = 0; contentdir_service_variables[c].name != NULL; c++) { + if (strcmp(contentdir_service_variables[c].name, name) == 0) + return &contentdir_service_variables[c]; + } + assert(0); /* Shouldn't get here */ +} + +static bool +mediarecreg_is_authorized(ActionEvent *event) +{ + upnp_add_response(event, "Result", "1"); + return event->status; +} + +static bool +mediarecreg_is_validated(ActionEvent *event) +{ + upnp_add_response(event, "Result", "1"); + return event->status; +} + +/* XXX: In the future, ServiceVariable should allow different + * data types (and point to real variables, e.g. {"SystemUpdateID", UINT32_TYPE, &update_id}). + */ +ServiceVariable mediarecreg_service_variables[] = { + /*{ "TransferIDs", NULL },*/ + { "SystemUpdateID", NULL }, + /*{ "ContainerUpdateIDs", NULL },*/ + { 0, } +}; + +ServiceAction mediarecreg_service_actions[] = { + { "IsAuthorized", mediarecreg_is_authorized }, + { "IsValidated", mediarecreg_is_validated }, + { 0, } +}; diff -ruN /tmp/gmediaserver-0.9.0/src/schemas/MediaServer.xml.in ./src/schemas/MediaServer.xml.in --- /tmp/gmediaserver-0.9.0/src/schemas/MediaServer.xml.in 2005-06-17 14:05:11.000000000 +0200 +++ ./src/schemas/MediaServer.xml.in 2006-01-06 17:39:42.000000000 +0100 @@ -9,7 +9,7 @@ @DEVICE_UDN@ %s Oskar Liljeblad - @PACKAGE_NAME@ + Windows Media Connect @PACKAGE_VERSION@ 0000001 @@ -30,6 +30,13 @@ /ConnectionManager/Event /ConnectionManager/Control + + urn:microsoft.com:service:X_MS_MediaReceiverRegistrar:1 + urn:microsoft.com:serviceId:X_MS_MediaReceiverRegistrar + MediaReceiverRegistrar.xml + MediaReceiverRegistrar/Event + MediaReceiverRegistrar/Control + diff -ruN /tmp/gmediaserver-0.9.0/src/upnp.c ./src/upnp.c --- /tmp/gmediaserver-0.9.0/src/upnp.c 2005-12-11 16:09:28.000000000 +0100 +++ ./src/upnp.c 2006-01-06 17:55:28.000000000 +0100 @@ -53,6 +53,12 @@ connectmgr_service_actions, connectmgr_service_variables, }, + { + MEDIARECREG_SERVICE_ID, + "urn:microsoft.com:service:X_MS_MediaReceiverRegistrar:1", + mediarecreg_service_actions, + mediarecreg_service_variables, + }, { 0, } }; diff -ruN /tmp/gmediaserver-0.9.0/src/webserver.c ./src/webserver.c --- /tmp/gmediaserver-0.9.0/src/webserver.c 2005-08-29 17:06:21.000000000 +0200 +++ ./src/webserver.c 2006-01-07 22:00:02.000000000 +0100 @@ -62,10 +62,14 @@ } WebServerFile; static Entry * -get_entry_from_url(const char *filename) +get_entry_from_url(char *filename) { int32_t id; - + char * dotpos; + + dotpos=strchr(filename, '.'); + if(dotpos!=NULL) + filename[dotpos-filename]='\0'; if (filename[0] != '/') return NULL; filename = strchr(filename+1, '/');