Commit de5b9987 authored by Felix Paul Kühne's avatar Felix Paul Kühne

Title Decrapifier: correctly shows with more than 99 episodes (but less than 1000)

parent f4d36b96
Next Version
------------
- fixed subitem behavior of MLShow and MLAlbum on removal
- MLTitleDecrapifier handles shows with more than 99 and less than 1000
episodes correctly now
Added Public APIs:
- MLShow:
......
......@@ -106,6 +106,11 @@ static inline NSNumber *numberFromTwoChars(char high, char low)
return @(intFromChar(high) * 10 + intFromChar(low));
}
static inline NSNumber *numberFromThreeChars(char high, char mid, char low)
{
return @(intFromChar(high) * 100 + intFromChar(mid) * 10 + intFromChar(low));
}
+ (NSDictionary *)tvShowEpisodeInfoFromString:(NSString *)string
{
if (!string)
......@@ -128,7 +133,11 @@ static inline NSNumber *numberFromTwoChars(char high, char low)
isDigit(c(str, i+5)))
{
NSNumber *season = numberFromTwoChars(c(str,i+1), c(str,i+2));
NSNumber *episode = numberFromTwoChars(c(str,i+4), c(str,i+5));
NSNumber *episode;
if (isDigit(c(str, i+6)))
episode = numberFromThreeChars(c(str,i+4), c(str,i+5), c(str,i+6));
else
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;
NSString *episodeName = [str substringFromIndex:i+6];
......
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