Commit 7d66951d authored by Tobias's avatar Tobias

add thumbnailURL to ServerBrowserItem-Protocol

download thumbnail in ServerBrowserViewController
parent 8758d4fa
......@@ -45,7 +45,7 @@ NS_ASSUME_NONNULL_BEGIN
@optional
@property (nonatomic, readonly, nullable) NSString *duration;
@property (nonatomic, readonly, nullable) NSURL *subtitleURL;
@property (nonatomic, readonly, nullable) NSURL *thumbnailURL;
@end
......
......@@ -23,6 +23,7 @@ NS_ASSUME_NONNULL_BEGIN
- (instancetype)initWithDictionary:(NSDictionary *)dictionary;
@property (nonatomic, readonly, nullable) NSURL *subtitleURL;
@property (nonatomic, readonly, nullable) NSString *duration;
@property (nonatomic, readonly, nullable) NSURL *thumbnailURL;
@end
......
......@@ -70,16 +70,18 @@
self = [super init];
if (self) {
_name = dictionary[@"title"];
NSString *thumbURLString = dictionary[@"thumb"];
_subtitleURL = thumbURLString ? [NSURL URLWithString:thumbURLString] : nil;
_fileSizeBytes = dictionary[@"size"];
_duration = dictionary[@"duration"];
NSString *subtitleURLString = dictionary[@"pathSubtitle"];
if ([subtitleURLString isEqualToString:@"(null)"]) subtitleURLString = nil;
subtitleURLString = [subtitleURLString stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
_subtitleURL = subtitleURLString ? [NSURL URLWithString:subtitleURLString] : nil;
_subtitleURL = subtitleURLString.length ? [NSURL URLWithString:subtitleURLString] : nil;
_URL = [NSURL URLWithString:dictionary[@"pathfile"]];
_container = NO;
NSString *thumbURLString = dictionary[@"thumb"];
_thumbnailURL = thumbURLString.length ? [NSURL URLWithString:thumbURLString] : nil;
}
return self;
}
......
......@@ -244,6 +244,10 @@
cell.delegate = self;
NSURL *thumbnailURL = nil;
if ([item respondsToSelector:@selector(thumbnailURL)]) {
thumbnailURL = item.thumbnailURL;
}
if (thumbnailURL) {
dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_LOW, 0);
dispatch_async(queue, ^{
......
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