Commit 924b63ef authored by Felix Paul Kühne's avatar Felix Paul Kühne

OneDrive: expose more available metadata

parent 693dca35
...@@ -152,10 +152,26 @@ ...@@ -152,10 +152,26 @@
self.thumbnailView.image = [UIImage imageNamed:@"folder"]; self.thumbnailView.image = [UIImage imageNamed:@"folder"];
} else { } else {
self.titleLabel.text = self.oneDriveFile.name; self.titleLabel.text = self.oneDriveFile.name;
self.subtitleLabel.text = (self.oneDriveFile.size > 0) ? [NSByteCountFormatter stringFromByteCount:[self.oneDriveFile.size longLongValue] countStyle:NSByteCountFormatterCountStyleFile]: @""; NSMutableString *subtitle = [[NSMutableString alloc] init];
if (self.oneDriveFile.size > 0) {
[subtitle appendString:[NSByteCountFormatter stringFromByteCount:[self.oneDriveFile.size longLongValue] countStyle:NSByteCountFormatterCountStyleFile]];
if (self.oneDriveFile.duration > 0) {
VLCTime *time = [VLCTime timeWithNumber:self.oneDriveFile.duration];
[subtitle appendFormat:@" — %@", [time verboseStringValue]];
}
} else if (self.oneDriveFile.duration > 0) {
VLCTime *time = [VLCTime timeWithNumber:self.oneDriveFile.duration];
[subtitle appendString:[time verboseStringValue]];
}
self.subtitleLabel.text = subtitle;
self.titleLabel.hidden = self.subtitleLabel.hidden = NO; self.titleLabel.hidden = self.subtitleLabel.hidden = NO;
self.folderTitleLabel.hidden = YES; self.folderTitleLabel.hidden = YES;
self.thumbnailView.image = [UIImage imageNamed:@"blank"]; if (self.oneDriveFile.isAudio)
self.thumbnailView.image = [UIImage imageNamed:@"audio"];
else if (self.oneDriveFile.isVideo)
self.thumbnailView.image = [UIImage imageNamed:@"movie"];
else
self.thumbnailView.image = [UIImage imageNamed:@"blank"];
} }
} }
//we don't have streaming for box yet //we don't have streaming for box yet
......
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
/* include private API headers */ /* include private API headers */
#import <LiveSDK/LiveApiHelper.h> #import <LiveSDK/LiveApiHelper.h>
@interface VLCOneDriveController () <LiveAuthDelegate, LiveDownloadOperationDelegate, LiveOperationDelegate, VLCOneDriveObjectDelegate> @interface VLCOneDriveController () <LiveAuthDelegate, LiveDownloadOperationDelegate, VLCOneDriveObjectDelegate>
{ {
LiveConnectClient *_liveClient; LiveConnectClient *_liveClient;
NSArray *_liveScopes; NSArray *_liveScopes;
...@@ -114,6 +114,16 @@ ...@@ -114,6 +114,16 @@
} }
} }
- (void)liveOperationSucceeded:(LiveDownloadOperation *)operation
{
APLog(@"ODC: liveOperationSucceeded (%@)", operation.userState);
}
- (void)liveOperationFailed:(NSError *)error operation:(LiveDownloadOperation *)operation
{
APLog(@"ODC: liveOperationFailed %@ (%@)", error, operation.userState);
}
#pragma mark - listing #pragma mark - listing
- (void)loadTopLevelFolder - (void)loadTopLevelFolder
...@@ -139,15 +149,6 @@ ...@@ -139,15 +149,6 @@
} }
} }
- (void)liveOperationSucceeded:(LiveOperation *)operation
{
NSLog(@"%@", operation);
}
- (void)liveOperationFailed:(NSError *)error operation:(LiveOperation *)operation
{
}
#pragma mark - file handling #pragma mark - file handling
- (void)downloadFileWithPath:(NSString *)path - (void)downloadFileWithPath:(NSString *)path
...@@ -168,15 +169,13 @@ ...@@ -168,15 +169,13 @@
- (void)folderContentLoaded:(VLCOneDriveObject *)sender - (void)folderContentLoaded:(VLCOneDriveObject *)sender
{ {
NSLog(@"odc: foldercontent loaded: %@", [sender name]);
if (self.delegate) if (self.delegate)
[self.delegate performSelector:@selector(mediaListUpdated)]; [self.delegate performSelector:@selector(mediaListUpdated)];
} }
- (void)folderContentLoadingFailed:(NSError *)error sender:(VLCOneDriveObject *)sender - (void)folderContentLoadingFailed:(NSError *)error sender:(VLCOneDriveObject *)sender
{ {
NSLog(@"folder content loading failed %@", error); APLog(@"folder content loading failed %@", error);
} }
- (void)fileContentLoaded:(VLCOneDriveObject *)sender - (void)fileContentLoaded:(VLCOneDriveObject *)sender
...@@ -185,12 +184,11 @@ ...@@ -185,12 +184,11 @@
- (void)fileContentLoadingFailed:(NSError *)error sender:(VLCOneDriveObject *)sender - (void)fileContentLoadingFailed:(NSError *)error sender:(VLCOneDriveObject *)sender
{ {
NSLog(@"file content loading failed %@", error); APLog(@"file content loading failed %@", error);
} }
- (void)fullFolderTreeLoaded:(VLCOneDriveObject *)sender - (void)fullFolderTreeLoaded:(VLCOneDriveObject *)sender
{ {
NSLog(@"fullFolderTreeLoaded");
if (self.delegate) if (self.delegate)
[self.delegate performSelector:@selector(mediaListUpdated)]; [self.delegate performSelector:@selector(mediaListUpdated)];
} }
......
...@@ -40,6 +40,8 @@ ...@@ -40,6 +40,8 @@
@property (strong, nonatomic) NSNumber *duration; @property (strong, nonatomic) NSNumber *duration;
@property (strong, nonatomic) NSString *thumbnailURL; @property (strong, nonatomic) NSString *thumbnailURL;
@property (readonly, nonatomic) BOOL isFolder; @property (readonly, nonatomic) BOOL isFolder;
@property (readonly, nonatomic) BOOL isVideo;
@property (readonly, nonatomic) BOOL isAudio;
@property (strong, nonatomic) NSArray *folders; @property (strong, nonatomic) NSArray *folders;
@property (strong, nonatomic) NSArray *files; @property (strong, nonatomic) NSArray *files;
......
...@@ -21,6 +21,16 @@ ...@@ -21,6 +21,16 @@
return [self.type isEqual:@"folder"] || [self.type isEqual:@"album"]; return [self.type isEqual:@"folder"] || [self.type isEqual:@"album"];
} }
- (BOOL)isVideo
{
return [self.type isEqual:@"video"];
}
- (BOOL)isAudio
{
return [self.type isEqual:@"audio"];
}
- (NSString *)filesPath - (NSString *)filesPath
{ {
return [self.objectId stringByAppendingString:@"/files"]; return [self.objectId stringByAppendingString:@"/files"];
...@@ -125,10 +135,6 @@ ...@@ -125,10 +135,6 @@
[items addObject:oneDriveObject]; [items addObject:oneDriveObject];
} }
NSLog(@"we found %i items", items.count);
for (NSUInteger x = 0; x < items.count; x++)
NSLog(@"%@", [items[x] name]);
self.folders = subFolders; self.folders = subFolders;
self.files = folderFiles; self.files = folderFiles;
self.items = items; self.items = items;
......
...@@ -87,10 +87,13 @@ ...@@ -87,10 +87,13 @@
- (IBAction)goBack:(id)sender - (IBAction)goBack:(id)sender
{ {
if (_oneDriveController.rootFolder != _oneDriveController.currentFolder) { if (_oneDriveController.rootFolder != _oneDriveController.currentFolder) {
if ([_oneDriveController.rootFolder.name isEqualToString:_oneDriveController.currentFolder.parent.name]) if ([_oneDriveController.rootFolder.name isEqualToString:_oneDriveController.currentFolder.parent.name]) {
_oneDriveController.currentFolder = nil; _oneDriveController.currentFolder = nil;
else self.title = _oneDriveController.rootFolder.name;
} else {
_oneDriveController.currentFolder = _oneDriveController.currentFolder.parent; _oneDriveController.currentFolder = _oneDriveController.currentFolder.parent;
self.title = _oneDriveController.currentFolder.name;
}
[_activityIndicator startAnimating]; [_activityIndicator startAnimating];
[_oneDriveController loadCurrentFolder]; [_oneDriveController loadCurrentFolder];
} else } else
...@@ -134,6 +137,7 @@ ...@@ -134,6 +137,7 @@
[_activityIndicator startAnimating]; [_activityIndicator startAnimating];
_oneDriveController.currentFolder = selectedObject; _oneDriveController.currentFolder = selectedObject;
[_oneDriveController loadCurrentFolder]; [_oneDriveController loadCurrentFolder];
self.title = selectedObject.name;
} else { } else {
/* stream file */ /* stream file */
NSURL *url = [NSURL URLWithString:selectedObject.downloadPath]; NSURL *url = [NSURL URLWithString:selectedObject.downloadPath];
......
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