Commit dd861306 authored by Pierre SAGASPE's avatar Pierre SAGASPE Committed by Felix Paul Kühne
Browse files

plex: check for available space left on device prior to downloading


Signed-off-by: Felix Paul Kühne's avatarFelix Paul Kühne <fkuehne@videolan.org>
parent d7e19aa0
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
#import "VLCStatusLabel.h" #import "VLCStatusLabel.h"
#import "VLCAlertView.h" #import "VLCAlertView.h"
#import "UIBarButtonItem+Theme.h" #import "UIBarButtonItem+Theme.h"
#import "UIDevice+VLC.h"
@interface VLCLocalPlexFolderListViewController () <UITableViewDataSource, UITableViewDelegate, VLCLocalNetworkListCell, UISearchBarDelegate, UISearchDisplayDelegate> @interface VLCLocalPlexFolderListViewController () <UITableViewDataSource, UITableViewDelegate, VLCLocalNetworkListCell, UISearchBarDelegate, UISearchDisplayDelegate>
{ {
...@@ -397,11 +398,17 @@ ...@@ -397,11 +398,17 @@
[ObjList removeAllObjects]; [ObjList removeAllObjects];
ObjList = [_PlexParser PlexMediaServerParser:_PlexServerAddress port:_PlexServerPort navigationPath:path]; ObjList = [_PlexParser PlexMediaServerParser:_PlexServerAddress port:_PlexServerPort navigationPath:path];
if ([[ObjList objectAtIndex:0] objectForKey:@"keySubtitle"]) NSInteger size = [[[ObjList objectAtIndex:0] objectForKey:@"size"] integerValue];
[self _getFileSubtitleFromPlexServer:ObjList modeStream:NO]; if (size < [[UIDevice currentDevice] freeDiskspace].longLongValue) {
if ([[ObjList objectAtIndex:0] objectForKey:@"keySubtitle"])
[self _getFileSubtitleFromPlexServer:ObjList modeStream:NO];
[self _downloadFileFromMediaItem:ObjList]; [self _downloadFileFromMediaItem:ObjList];
[cell.statusLabel showStatusMessage:NSLocalizedString(@"DOWNLOADING", nil)]; [cell.statusLabel showStatusMessage:NSLocalizedString(@"DOWNLOADING", nil)];
} else {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"DISK_FULL", nil) message:[NSString stringWithFormat:NSLocalizedString(@"DISK_FULL_FORMAT", nil), [[ObjList objectAtIndex:0] objectForKey:@"title"], [[UIDevice currentDevice] model]] delegate:self cancelButtonTitle:NSLocalizedString(@"BUTTON_OK", nil) otherButtonTitles:nil];
[alert show];
}
} }
#pragma mark - Search Display Controller Delegate #pragma mark - Search Display Controller Delegate
......
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