The patch I've sent Ben is posted below. It gets things up and running, but the 360 will always show everything in the list - all music and video under the video tab for example.
If there are any problems, let me know.
Code:
diff -Naur original/ushare/src/metadata.c fixed/ushare/src/metadata.c
--- original/ushare/src/metadata.c 2007-05-17 10:24:04.000000000 +0100
+++ fixed/ushare/src/metadata.c 2007-05-17 11:24:23.000000000 +0100
@@ -183,7 +183,12 @@
entry = (struct upnp_entry_t *) malloc (sizeof (struct upnp_entry_t));
- entry->id = ut->starting_id + ut->nr_entries++;
+ if (ut->root_entry)
+ entry->id = ut->starting_id + ut->nr_entries++;
+ else
+ // Assume we're creating the root node so don't use the usual IDs
+ entry->id = 0;
+
entry->fullpath = fullpath ? strdup (fullpath) : NULL;
entry->parent = parent;
entry->child_count = dir ? 0 : -1;
@@ -193,14 +198,22 @@
malloc (sizeof (struct upnp_entry_t *));
*(entry->childs) = NULL;
+ log_verbose("Created entry->id %d\n", entry->id);
+ if (entry->fullpath)
+ {
+ log_verbose(" Path for entry is: %s\n", entry->fullpath);
+ }
+
if (!dir) /* item */
{
+ log_verbose("upnp_entry_new::Creating item\n");
struct mime_type_t *mime = getMimeType (getExtension (name));
if (!mime)
{
--ut->nr_entries;
upnp_entry_free (ut, entry);
log_error ("Invalid Mime type for %s, entry ignored", name);
+ log_verbose ("Returning a NULL entry");
return NULL;
}
entry->mime_type = mime;
@@ -214,6 +227,7 @@
}
else /* container */
{
+ log_verbose("upnp_entry_new::Creating container\n");
entry->mime_type = &Container_MIME_Type;
entry->url = NULL;
}
@@ -261,8 +275,18 @@
entry->size = size;
entry->fd = -1;
- if (entry->id && entry->url)
- log_verbose ("Entry->URL (%d): %s\n", entry->id, entry->url);
+ //if (entry->id && entry->url)
+ if (entry->id)
+ {
+ if (entry->url)
+ {
+ log_verbose ("Entry->URL (%d): %s\n", entry->id, entry->url);
+ }
+ else
+ {
+ log_verbose ("Entry->URL (%d): No URL\n", entry->id);
+ }
+ }
return entry;
}
@@ -368,7 +392,13 @@
entry_lookup_ptr->entry_ptr = child;
if (rbsearch ((void *) entry_lookup_ptr, ut->rb) == NULL)
+ {
log_info (_("Failed to add the RB lookup tree\n"));
+ }
+ else
+ {
+ log_verbose ("Added ID %d to the RB lookup tree\n", child->id);
+ }
}
struct upnp_entry_t *
@@ -504,6 +534,7 @@
/* build root entry */
if (!ut->root_entry)
ut->root_entry = upnp_entry_new (ut, "root", NULL, NULL, -1, true);
+
/* add files from content directory */
for (i=0 ; i < ut->contentlist->count ; i++)