Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 56 lines (46 sloc) 1.634 kB
20ef1c1 @SebCorbin Rewritten design
authored
1 //
2 // Created by sebastien on 26/12/11.
3 //
4 // To change the template use AppCode | Preferences | File Templates.
5 //
6
7 #import "SubFileMovie.h"
8
9 @implementation SubFileMovie
10
61ce39e @SebCorbin Added properties to SubFileMovie
authored
11 @synthesize movie;
12 @synthesize year;
13 @synthesize part;
14
15
20ef1c1 @SebCorbin Rewritten design
authored
16 - (id)initWithSubFile:(SubFile *)subFile {
17 self = [super init];
18 if (self) {
19 localUrl = [[subFile localUrl] copy];
20 filename = [[subFile filename] copy];
21 part = 0;
9ecb315 @SebCorbin Memory management debugged
authored
22 year = 0;
20ef1c1 @SebCorbin Rewritten design
authored
23 }
24
25 return self;
26 }
27
b1e81c4 @SebCorbin Rewritten guessFileData to handle parsing errors
authored
28 - (BOOL)guessFileData {
29 NSString *strTeams, *strYear;
30 if (![filename getCapturesWithRegexAndReferences:@"(?P<movie>.*)[\\.|\\[|\\(| ]{1}(?P<strYear>(?:(?:19|20)[0-9]{2}))[\\.|\\]|\\)| ]{1}(?P<strTeams>.*)",
31 @"${movie}", &movie, @"${strYear}", &strYear, @"${strTeams}", &strTeams, nil]) {
32 return NO;
33 }
34 year = [strYear integerValue];
838bf10 @SebCorbin Added Subscene service
authored
35 movie = [[movie stringByReplacingOccurrencesOfString:@"." withString:@" "]
36 stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]];
37 NSMutableArray *dirtyTeams = [NSMutableArray arrayWithArray:[strTeams componentsSeparatedByCharactersInSet:
38 [NSCharacterSet characterSetWithCharactersInString:@". -"]]];
20ef1c1 @SebCorbin Rewritten design
authored
39 if ([dirtyTeams containsObjectMatchingRegex:@"cd1"]) {
40 part = 1;
41 [dirtyTeams removeObjectsMatchingRegex:@"cd1"];
42 }
43 if ([teams containsObjectMatchingRegex:@"cd2"]) {
44 part = 2;
45 [dirtyTeams removeObjectsMatchingRegex:@"cd2"];
46 }
9ecb315 @SebCorbin Memory management debugged
authored
47 teams = [[[NSArray alloc] initWithArray:dirtyTeams] retain];
b1e81c4 @SebCorbin Rewritten guessFileData to handle parsing errors
authored
48 return YES;
20ef1c1 @SebCorbin Rewritten design
authored
49 }
50
61ce39e @SebCorbin Added properties to SubFileMovie
authored
51 - (void)dealloc {
52 [super dealloc];
53 }
54
20ef1c1 @SebCorbin Rewritten design
authored
55
56 @end
Something went wrong with that request. Please try again.