Don't load metadata for stream URLs

This commit is contained in:
Christopher Snowhill 2021-02-28 02:47:00 -08:00
parent ac44ae12be
commit 483b8d6647
3 changed files with 21 additions and 5 deletions

View file

@ -171,6 +171,12 @@ NSDictionary * makeRGInfo(PlaylistEntry *pe)
if (pe == nil) if (pe == nil)
return; return;
BOOL loadData = YES;
NSString * urlScheme = [[pe URL] scheme];
if ([urlScheme isEqualToString:@"http"] ||
[urlScheme isEqualToString:@"https"])
loadData = NO;
#if 0 #if 0
// Race here, but the worst that could happen is we re-read the data // Race here, but the worst that could happen is we re-read the data
if ([pe metadataLoaded] != YES) { if ([pe metadataLoaded] != YES) {
@ -184,7 +190,7 @@ NSDictionary * makeRGInfo(PlaylistEntry *pe)
} }
#else #else
// Let's do it this way instead // Let's do it this way instead
if ([pe metadataLoaded] != YES) { if ([pe metadataLoaded] != YES && loadData == YES) {
NSArray *entries = [NSArray arrayWithObject:pe]; NSArray *entries = [NSArray arrayWithObject:pe];
[playlistLoader performSelectorInBackground:@selector(loadInfoForEntries:) withObject:entries]; [playlistLoader performSelectorInBackground:@selector(loadInfoForEntries:) withObject:entries];
} }

View file

@ -287,6 +287,11 @@ static PluginController *sharedPluginController = nil;
- (NSDictionary *)metadataForURL:(NSURL *)url - (NSDictionary *)metadataForURL:(NSURL *)url
{ {
NSString * urlScheme = [url scheme];
if ([urlScheme isEqualToString:@"http"] ||
[urlScheme isEqualToString:@"https"])
return nil;
NSString *ext = [url pathExtension]; NSString *ext = [url pathExtension];
NSArray *readers = [metadataReaders objectForKey:[ext lowercaseString]]; NSArray *readers = [metadataReaders objectForKey:[ext lowercaseString]];
NSString *classString; NSString *classString;
@ -311,6 +316,11 @@ static PluginController *sharedPluginController = nil;
//If no properties reader is defined, use the decoder's properties. //If no properties reader is defined, use the decoder's properties.
- (NSDictionary *)propertiesForURL:(NSURL *)url - (NSDictionary *)propertiesForURL:(NSURL *)url
{ {
NSString * urlScheme = [url scheme];
if ([urlScheme isEqualToString:@"http"] ||
[urlScheme isEqualToString:@"https"])
return nil;
NSDictionary *properties = nil; NSDictionary *properties = nil;
NSString *ext = [url pathExtension]; NSString *ext = [url pathExtension];

View file

@ -111,9 +111,9 @@
dataTask:(NSURLSessionDataTask *)dataTask dataTask:(NSURLSessionDataTask *)dataTask
didReceiveResponse:(NSURLResponse *)response didReceiveResponse:(NSURLResponse *)response
completionHandler:(void (^)(NSURLSessionResponseDisposition disposition))completionHandler { completionHandler:(void (^)(NSURLSessionResponseDisposition disposition))completionHandler {
if ([response isKindOfClass:[NSHTTPURLResponse class]]) { NSInteger statusCode = [(NSHTTPURLResponse *)response statusCode];
NSInteger statusCode = [(NSHTTPURLResponse *)response statusCode]; if (statusCode != 200) { if ([response isKindOfClass:[NSHTTPURLResponse class]]) {
if (statusCode != 200) {
completionHandler(NSURLSessionResponseCancel); completionHandler(NSURLSessionResponseCancel);
@synchronized (task) { @synchronized (task) {
task = nil; task = nil;