Commit 6dfdfc90 authored by Felix Paul Kühne's avatar Felix Paul Kühne

Local Network: improve re-entrant UPnP server listing

parent 6af60ea3
...@@ -105,7 +105,6 @@ ...@@ -105,7 +105,6 @@
[_mutableObjectList removeAllObjects]; [_mutableObjectList removeAllObjects];
NSData *didl = [outResult dataUsingEncoding:NSUTF8StringEncoding]; NSData *didl = [outResult dataUsingEncoding:NSUTF8StringEncoding];
NSMutableArray *array;
MediaServerBasicObjectParser *parser = [[MediaServerBasicObjectParser alloc] initWithMediaObjectArray:_mutableObjectList itemsOnly:NO]; MediaServerBasicObjectParser *parser = [[MediaServerBasicObjectParser alloc] initWithMediaObjectArray:_mutableObjectList itemsOnly:NO];
[parser parseFromData:didl]; [parser parseFromData:didl];
} else if (_serverType == kVLCFTPServer) { } else if (_serverType == kVLCFTPServer) {
......
...@@ -67,8 +67,6 @@ ...@@ -67,8 +67,6 @@
self.title = NSLocalizedString(@"LOCAL_NETWORK", @""); self.title = NSLocalizedString(@"LOCAL_NETWORK", @"");
[self performSelectorInBackground:@selector(_startUPNPDiscovery) withObject:nil];
_ftpServices = [[NSMutableArray alloc] init]; _ftpServices = [[NSMutableArray alloc] init];
[_ftpServices addObject:NSLocalizedString(@"CONNECT_TO_SERVER", nil)]; [_ftpServices addObject:NSLocalizedString(@"CONNECT_TO_SERVER", nil)];
...@@ -88,6 +86,7 @@ ...@@ -88,6 +86,7 @@
{ {
[super viewWillAppear:animated]; [super viewWillAppear:animated];
[self _triggerNetServiceBrowser]; [self _triggerNetServiceBrowser];
[self performSelectorInBackground:@selector(_startUPNPDiscovery) withObject:nil];
} }
- (void)_triggerNetServiceBrowser - (void)_triggerNetServiceBrowser
...@@ -97,20 +96,28 @@ ...@@ -97,20 +96,28 @@
- (void)_startUPNPDiscovery - (void)_startUPNPDiscovery
{ {
UPnPDB* db = [[UPnPManager GetInstance] DB]; NSLog(@"_startUPNPDiscovery");
_UPNPdevices = [db rootDevices]; UPnPManager *managerInstance = [UPnPManager GetInstance];
[db addObserver:(UPnPDBObserver*)self]; _UPNPdevices = [[managerInstance DB] rootDevices];
[[managerInstance DB] addObserver:(UPnPDBObserver*)self];
//Optional; set User Agent //Optional; set User Agent
[[[UPnPManager GetInstance] SSDP] setUserAgentProduct:[NSString stringWithFormat:@"VLC for iOS/%@", [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleVersion"]] andOS:@"iOS"]; [[managerInstance SSDP] setUserAgentProduct:[NSString stringWithFormat:@"VLC for iOS/%@", [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleVersion"]] andOS:@"iOS"];
//Search for UPnP Devices //Search for UPnP Devices
[[[UPnPManager GetInstance] SSDP] searchSSDP]; [[managerInstance SSDP] startSSDP];
[[managerInstance SSDP] searchSSDP];
[[managerInstance SSDP] SSDPDBUpdate];
} }
- (IBAction)goBack:(id)sender - (IBAction)goBack:(id)sender
{ {
UPnPManager *managerInstance = [UPnPManager GetInstance];
[[managerInstance DB] removeObserver:(UPnPDBObserver*)self];
[[managerInstance SSDP] stopSSDP];
[[(VLCAppDelegate*)[UIApplication sharedApplication].delegate revealController] toggleSidebar:![(VLCAppDelegate*)[UIApplication sharedApplication].delegate revealController].sidebarShowing duration:kGHRevealSidebarDefaultAnimationDuration]; [[(VLCAppDelegate*)[UIApplication sharedApplication].delegate revealController] toggleSidebar:![(VLCAppDelegate*)[UIApplication sharedApplication].delegate revealController].sidebarShowing duration:kGHRevealSidebarDefaultAnimationDuration];
} }
...@@ -155,6 +162,7 @@ ...@@ -155,6 +162,7 @@
NSUInteger section = indexPath.section; NSUInteger section = indexPath.section;
[cell setIsDirectory:YES]; [cell setIsDirectory:YES];
[cell setIcon:nil];
if (section == 0) { if (section == 0) {
BasicUPnPDevice *device = _filteredUPNPDevices[row]; BasicUPnPDevice *device = _filteredUPNPDevices[row];
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment