Commit 1a0dda33 authored by Felix Paul Kühne's avatar Felix Paul Kühne

Fix crash when processing TV series like files (refs #9031)

Needs more fixes as 'Untitled TV MLShow - S01E15 - (null) - S00E00' is incorrect for 'S01E15 - ohio.mp4'
parent 91f69d1f
......@@ -7,6 +7,7 @@
* $Id$
* Authors: Pierre d'Herbemont <pdherbemont #>
* Felix Paul Kühne <fkuehne #>
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
......@@ -100,7 +101,14 @@ static inline NSNumber *numberFromTwoChars(char high, char low)
NSNumber *episode = numberFromTwoChars(c(str,i+4), c(str,i+5));
NSString *tvShowName = i > 0 ? [str substringToIndex:i-1] : nil;
tvShowName = tvShowName ? [[MLTitleDecrapifier decrapify:tvShowName] capitalizedString] : nil;
return @{@"season": season, @"episode": episode, @"tvShowName": tvShowName};
NSMutableDictionary *dict = [[NSMutableDictionary alloc] initWithCapacity:3];
if (season)
[dict setObject:season forKey:@"season"];
if (episode)
[dict setObject:episode forKey:@"episode"];
if (tvShowName)
[dict setObject:tvShowName forKey:@"tvShowName"];
return [NSDictionary dictionaryWithDictionary:dict];
return nil;
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