瀏覽代碼

Fix browsing of UPnP devices with no SortCapabilities (HDHomeRun)

Signed-off-by: Felix Paul Kühne <fkuehne@videolan.org>
Marc Etcheverry 11 年之前
父節點
當前提交
27fa44844e
共有 1 個文件被更改,包括 10 次插入1 次删除
  1. 10 1
      Sources/VLCLocalServerFolderListViewController.m

+ 10 - 1
Sources/VLCLocalServerFolderListViewController.m

@@ -104,12 +104,21 @@
     [super viewDidLoad];
 
     if (_serverType == kVLCServerTypeUPNP) {
+        NSString *sortCriteria = @"";
+        NSMutableString *outSortCaps = [[NSMutableString alloc] init];
+        [[_UPNPdevice contentDirectory] GetSortCapabilitiesWithOutSortCaps:outSortCaps];
+
+        if ([outSortCaps rangeOfString:@"dc:title"].location != NSNotFound)
+        {
+            sortCriteria = @"+dc:title";
+        }
+
         NSMutableString *outResult = [[NSMutableString alloc] init];
         NSMutableString *outNumberReturned = [[NSMutableString alloc] init];
         NSMutableString *outTotalMatches = [[NSMutableString alloc] init];
         NSMutableString *outUpdateID = [[NSMutableString alloc] init];
 
-        [[_UPNPdevice contentDirectory] BrowseWithObjectID:_UPNProotID BrowseFlag:@"BrowseDirectChildren" Filter:@"*" StartingIndex:@"0" RequestedCount:@"0" SortCriteria:@"+dc:title" OutResult:outResult OutNumberReturned:outNumberReturned OutTotalMatches:outTotalMatches OutUpdateID:outUpdateID];
+        [[_UPNPdevice contentDirectory] BrowseWithObjectID:_UPNProotID BrowseFlag:@"BrowseDirectChildren" Filter:@"*" StartingIndex:@"0" RequestedCount:@"0" SortCriteria:sortCriteria OutResult:outResult OutNumberReturned:outNumberReturned OutTotalMatches:outTotalMatches OutUpdateID:outUpdateID];
 
         [_mutableObjectList removeAllObjects];
         NSData *didl = [outResult dataUsingEncoding:NSUTF8StringEncoding];