Skip to content
This repository has been archived by the owner on Jan 3, 2019. It is now read-only.

Commit

Permalink
ITV: Added exception checking around format list processing
Browse files Browse the repository at this point in the history
  • Loading branch information
[email protected] committed Feb 2, 2014
1 parent d6787f6 commit 021155c
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 13 deletions.
37 changes: 25 additions & 12 deletions ITVDownload.m
Original file line number Diff line number Diff line change
Expand Up @@ -311,18 +311,31 @@ -(void)metaRequestFinished:(ASIHTTPRequest *)request

//Retrieve PlayPath
NSString *playPath = nil;
NSArray *formatKeys = @[@"Flash - Very Low",@"Flash - Low",@"Flash - Standard",@"Flash - High"];
NSArray *itvRateObjects = @[@"400",@"600",@"800",@"1200"];
NSArray *bitrateObjects = @[@"400000",@"600000",@"800000",@"1200000"];
NSDictionary *itvRateDic = [NSDictionary dictionaryWithObjects:itvRateObjects forKeys:formatKeys];
NSDictionary *bitrateDic = [NSDictionary dictionaryWithObjects:bitrateObjects forKeys:formatKeys];

NSMutableArray *itvRateArray = [[NSMutableArray alloc] init];
NSMutableArray *bitrateArray = [[NSMutableArray alloc] init];

for (TVFormat *format in formatList) [itvRateArray addObject:itvRateDic[[format format]]];
for (TVFormat *format in formatList) [bitrateArray addObject:bitrateDic[[format format]]];

NSMutableArray *itvRateArray = nil;
NSMutableArray *bitrateArray = nil;
@try {
NSArray *formatKeys = @[@"Flash - Very Low",@"Flash - Low",@"Flash - Standard",@"Flash - High"];
NSArray *itvRateObjects = @[@"400",@"600",@"800",@"1200"];
NSArray *bitrateObjects = @[@"400000",@"600000",@"800000",@"1200000"];
NSDictionary *itvRateDic = [NSDictionary dictionaryWithObjects:itvRateObjects forKeys:formatKeys];
NSDictionary *bitrateDic = [NSDictionary dictionaryWithObjects:bitrateObjects forKeys:formatKeys];

itvRateArray = [[NSMutableArray alloc] init];
bitrateArray = [[NSMutableArray alloc] init];

for (TVFormat *format in formatList) [itvRateArray addObject:itvRateDic[[format format]]];
for (TVFormat *format in formatList) [bitrateArray addObject:bitrateDic[[format format]]];
}
@catch (NSException *exception)
{
NSLog(@"ERROR: %@: %@", [exception name], [exception description]);
[self addToLog:[NSString stringWithFormat:@"ERROR: %@: %@", [exception name], [exception description]]];
[show setComplete:@YES];
[show setSuccessful:@NO];
[show setValue:@"Download Failed" forKey:@"status"];
[nc postNotificationName:@"DownloadFinished" object:show];
return;
}
NSLog(@"DEBUG: Parsing MediaFile entries");
if (verbose)
[self addToLog:@"DEBUG: Parsing MediaFile entries" noTag:YES];
Expand Down
2 changes: 1 addition & 1 deletion Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>656</string>
<string>657</string>
<key>CFBundleShortVersionString</key>
<string>1.6.2</string>
<key>NSMainNibFile</key>
Expand Down

0 comments on commit 021155c

Please sign in to comment.