* Send known audio-only devices straight to the Music section on root requests.
This commit is contained in:
parent
53db844772
commit
e72c9d0a08
@ -112,6 +112,8 @@ struct upnphttp {
|
|||||||
#define FLAG_MS_PFS 0x02000000 // Microsoft PlaysForSure client
|
#define FLAG_MS_PFS 0x02000000 // Microsoft PlaysForSure client
|
||||||
#define FLAG_AUDIO_ONLY 0x04000000
|
#define FLAG_AUDIO_ONLY 0x04000000
|
||||||
|
|
||||||
|
#define FLAG_FREE_OBJECT_ID 0x00000001
|
||||||
|
|
||||||
/* New_upnphttp() */
|
/* New_upnphttp() */
|
||||||
struct upnphttp *
|
struct upnphttp *
|
||||||
New_upnphttp(int);
|
New_upnphttp(int);
|
||||||
|
28
upnpsoap.c
28
upnpsoap.c
@ -1023,22 +1023,19 @@ BrowseContentDirectory(struct upnphttp * h, const char * action)
|
|||||||
args.requested = RequestedCount;
|
args.requested = RequestedCount;
|
||||||
args.client = h->req_client;
|
args.client = h->req_client;
|
||||||
args.flags = h->reqflags;
|
args.flags = h->reqflags;
|
||||||
if( h->reqflags & FLAG_MS_PFS )
|
if( args.flags & FLAG_MS_PFS )
|
||||||
{
|
{
|
||||||
if( strchr(ObjectId, '$') || (strcmp(ObjectId, "0") == 0) )
|
if( !strchr(ObjectId, '$') && (strcmp(ObjectId, "0") != 0) )
|
||||||
{
|
|
||||||
ObjectId = sqlite3_mprintf("%s", ObjectId);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
ptr = sql_get_text_field(db, "SELECT OBJECT_ID from OBJECTS"
|
ptr = sql_get_text_field(db, "SELECT OBJECT_ID from OBJECTS"
|
||||||
" where OBJECT_ID in "
|
" where OBJECT_ID in "
|
||||||
"('"MUSIC_ID"$%s', '"VIDEO_ID"$%s', '"IMAGE_ID"$%s')",
|
"('"MUSIC_ID"$%s', '"VIDEO_ID"$%s', '"IMAGE_ID"$%s')",
|
||||||
ObjectId, ObjectId, ObjectId);
|
ObjectId, ObjectId, ObjectId);
|
||||||
if( ptr )
|
if( ptr )
|
||||||
|
{
|
||||||
ObjectId = ptr;
|
ObjectId = ptr;
|
||||||
else
|
args.flags |= FLAG_FREE_OBJECT_ID;
|
||||||
ObjectId = sqlite3_mprintf("%s", ObjectId);
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
DPRINTF(E_DEBUG, L_HTTP, "Browsing ContentDirectory:\n"
|
DPRINTF(E_DEBUG, L_HTTP, "Browsing ContentDirectory:\n"
|
||||||
@ -1051,6 +1048,12 @@ BrowseContentDirectory(struct upnphttp * h, const char * action)
|
|||||||
ObjectId, RequestedCount, StartingIndex,
|
ObjectId, RequestedCount, StartingIndex,
|
||||||
BrowseFlag, Filter, SortCriteria);
|
BrowseFlag, Filter, SortCriteria);
|
||||||
|
|
||||||
|
if( (args.flags & FLAG_AUDIO_ONLY) && (strcmp(ObjectId, "0") == 0) )
|
||||||
|
{
|
||||||
|
ObjectId = sqlite3_mprintf("%s", MUSIC_ID);
|
||||||
|
args.flags |= FLAG_FREE_OBJECT_ID;
|
||||||
|
}
|
||||||
|
|
||||||
if( strcmp(BrowseFlag+6, "Metadata") == 0 )
|
if( strcmp(BrowseFlag+6, "Metadata") == 0 )
|
||||||
{
|
{
|
||||||
args.requested = 1;
|
args.requested = 1;
|
||||||
@ -1082,13 +1085,12 @@ BrowseContentDirectory(struct upnphttp * h, const char * action)
|
|||||||
else
|
else
|
||||||
asprintf(&orderBy, "order by length(OBJECT_ID), OBJECT_ID");
|
asprintf(&orderBy, "order by length(OBJECT_ID), OBJECT_ID");
|
||||||
}
|
}
|
||||||
else if( strncmp(ObjectId, MUSIC_ID, strlen(MUSIC_ID)) == 0 )
|
else if( args.client == ERokuSoundBridge )
|
||||||
{
|
{
|
||||||
#ifdef __sparc__
|
#ifdef __sparc__
|
||||||
if( totalMatches < 10000 )
|
if( totalMatches < 10000 )
|
||||||
#endif
|
#endif
|
||||||
asprintf(&orderBy, "order by o.CLASS, d.DISC, d.TRACK, d.TITLE");
|
asprintf(&orderBy, "order by o.CLASS, d.DISC, d.TRACK, d.TITLE");
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* If it's a DLNA client, return an error for bad sort criteria */
|
/* If it's a DLNA client, return an error for bad sort criteria */
|
||||||
@ -1134,11 +1136,9 @@ browse_error:
|
|||||||
ClearNameValueList(&data);
|
ClearNameValueList(&data);
|
||||||
if( orderBy )
|
if( orderBy )
|
||||||
free(orderBy);
|
free(orderBy);
|
||||||
free(resp);
|
if( args.flags & FLAG_FREE_OBJECT_ID )
|
||||||
if( h->reqflags & FLAG_MS_PFS )
|
|
||||||
{
|
|
||||||
sqlite3_free(ObjectId);
|
sqlite3_free(ObjectId);
|
||||||
}
|
free(resp);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
Loading…
x
Reference in New Issue
Block a user