Commit 39b2687a authored by Felix Paul Kühne's avatar Felix Paul Kühne

server browsing: remove intrinsically broken 'IsSupported' check since we...

server browsing: remove intrinsically broken 'IsSupported' check since we can't know before actually trying if stuff plays or not
parent 96baf102
...@@ -109,21 +109,6 @@ ...@@ -109,21 +109,6 @@
return _byteCounterFormatter; return _byteCounterFormatter;
} }
- (BOOL)isSupportedItem:(id<VLCNetworkServerBrowserItem>)item {
NSString *properObjectName = item.name;
NSString *itemURLName = item.URL.lastPathComponent;
return [properObjectName isSupportedFormat] || [itemURLName isSupportedFormat];
}
- (void)showUnsupportedFileAlertForItem:(id<VLCNetworkServerBrowserItem>)item {
VLCAlertView *alert = [[VLCAlertView alloc] initWithTitle:NSLocalizedString(@"FILE_NOT_SUPPORTED", nil)
message:[NSString stringWithFormat:NSLocalizedString(@"FILE_NOT_SUPPORTED_LONG", nil), item.name]
delegate:self
cancelButtonTitle:NSLocalizedString(@"BUTTON_CANCEL", nil)
otherButtonTitles:nil];
[alert show];
}
#pragma mark - server browser item specifics #pragma mark - server browser item specifics
- (void)_downloadItem:(id<VLCNetworkServerBrowserItem>)item - (void)_downloadItem:(id<VLCNetworkServerBrowserItem>)item
...@@ -331,39 +316,35 @@ ...@@ -331,39 +316,35 @@
VLCNetworkServerBrowserViewController *targetViewController = [[VLCNetworkServerBrowserViewController alloc] initWithServerBrowser:item.containerBrowser]; VLCNetworkServerBrowserViewController *targetViewController = [[VLCNetworkServerBrowserViewController alloc] initWithServerBrowser:item.containerBrowser];
[self.navigationController pushViewController:targetViewController animated:YES]; [self.navigationController pushViewController:targetViewController animated:YES];
} else { } else {
if (![self isSupportedItem:item]) { if (searchResult) {
[self showUnsupportedFileAlertForItem:item]; [self _streamFileForItem:item];
} else { } else {
if (searchResult) { VLCMediaList *mediaList = self.serverBrowser.mediaList;
[self _streamFileForItem:item];
} else { if ([item respondsToSelector:@selector(subtitleURL)]) {
VLCMediaList *mediaList = self.serverBrowser.mediaList; NSArray *items = self.serverBrowser.items;
id<VLCNetworkServerBrowserItem> loopItem;
if ([item respondsToSelector:@selector(subtitleURL)]) { [mediaList lock];
NSArray *items = self.serverBrowser.items; NSUInteger count = mediaList.count;
id<VLCNetworkServerBrowserItem> loopItem; for (NSUInteger i = 0; i < count; i++) {
[mediaList lock]; loopItem = items[i];
NSUInteger count = mediaList.count; NSString *URLofSubtitle = nil;
for (NSUInteger i = 0; i < count; i++) { NSURL *remoteSubtitleURL = [loopItem subtitleURL];
loopItem = items[i]; if (remoteSubtitleURL == nil) {
NSString *URLofSubtitle = nil; NSArray *SubtitlesList = [self _searchSubtitle:loopItem.URL.lastPathComponent];
NSURL *remoteSubtitleURL = [loopItem subtitleURL]; remoteSubtitleURL = SubtitlesList.firstObject;
if (remoteSubtitleURL == nil) {
NSArray *SubtitlesList = [self _searchSubtitle:loopItem.URL.lastPathComponent];
remoteSubtitleURL = SubtitlesList.firstObject;
}
if(remoteSubtitleURL != nil) {
URLofSubtitle = [self _getFileSubtitleFromServer:remoteSubtitleURL];
if (URLofSubtitle != nil)
[[mediaList mediaAtIndex:i] addOptions:@{ kVLCSettingSubtitlesFilePath : URLofSubtitle }];
}
} }
[mediaList unlock];
}
[self _streamMediaList:mediaList startingAtIndex:row]; if(remoteSubtitleURL != nil) {
URLofSubtitle = [self _getFileSubtitleFromServer:remoteSubtitleURL];
if (URLofSubtitle != nil)
[[mediaList mediaAtIndex:i] addOptions:@{ kVLCSettingSubtitlesFilePath : URLofSubtitle }];
}
}
[mediaList unlock];
} }
[self _streamMediaList:mediaList startingAtIndex:row];
} }
} }
[tableView deselectRowAtIndexPath:indexPath animated:NO]; [tableView deselectRowAtIndexPath:indexPath animated:NO];
...@@ -378,21 +359,16 @@ ...@@ -378,21 +359,16 @@
else else
item = self.serverBrowser.items[[self.tableView indexPathForCell:cell].row]; item = self.serverBrowser.items[[self.tableView indexPathForCell:cell].row];
if (item.fileSizeBytes.longLongValue < [[UIDevice currentDevice] freeDiskspace].longLongValue) {
if (![self isSupportedItem:item]) { [self _downloadItem:item];
[self showUnsupportedFileAlertForItem:item]; [cell.statusLabel showStatusMessage:NSLocalizedString(@"DOWNLOADING", nil)];
} else { } else {
if (item.fileSizeBytes.longLongValue < [[UIDevice currentDevice] freeDiskspace].longLongValue) { VLCAlertView *alert = [[VLCAlertView alloc] initWithTitle:NSLocalizedString(@"DISK_FULL", nil)
[self _downloadItem:item]; message:[NSString stringWithFormat:NSLocalizedString(@"DISK_FULL_FORMAT", nil), item.name, [[UIDevice currentDevice] model]]
[cell.statusLabel showStatusMessage:NSLocalizedString(@"DOWNLOADING", nil)]; delegate:self
} else { cancelButtonTitle:NSLocalizedString(@"BUTTON_OK", nil)
VLCAlertView *alert = [[VLCAlertView alloc] initWithTitle:NSLocalizedString(@"DISK_FULL", nil) otherButtonTitles:nil];
message:[NSString stringWithFormat:NSLocalizedString(@"DISK_FULL_FORMAT", nil), item.name, [[UIDevice currentDevice] model]] [alert show];
delegate:self
cancelButtonTitle:NSLocalizedString(@"BUTTON_OK", nil)
otherButtonTitles:nil];
[alert show];
}
} }
} }
......
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