17 void Parser::matchPattern(
string &t_oldFile,
int *coordofSnE,
int &season,
int &episode,
int &xepisode,
string &pepisode )
20 for (
unsigned int i=0; i<t_oldFile.length(); i++)
23 if ( t_oldFile[i]==
's' && isdigit( t_oldFile[i+1] ) && isdigit( t_oldFile[i+2] ) && t_oldFile[i+3]==
'e' && isdigit( t_oldFile[i+4] ) && isdigit( t_oldFile[i+5] ) && t_oldFile[i+6]==
'-' && isdigit( t_oldFile[i+7] ) && isdigit( t_oldFile[i+8] ) )
30 season = atoi(t_oldFile.substr(i+1, 2).c_str());
32 episode = atoi(t_oldFile.substr(i+4, 2).c_str());
34 xepisode = atoi(t_oldFile.substr(i+7, 2).c_str());
39 else if ( t_oldFile[i]==
's' && isdigit( t_oldFile[i+1] ) && isdigit( t_oldFile[i+2] ) && t_oldFile[i+3]==
'e' && isdigit( t_oldFile[i+4] ) && isdigit( t_oldFile[i+5] ) && isalpha( t_oldFile[i+6] ) )
46 season = atoi(t_oldFile.substr(i+1, 2).c_str());
48 episode = atoi(t_oldFile.substr(i+4, 2).c_str());
50 pepisode = t_oldFile.substr(i+6, 1).c_str();
55 else if ( t_oldFile[i]==
's' && isdigit( t_oldFile[i+1] ) && isdigit( t_oldFile[i+2] ) && t_oldFile[i+3]==
'e' && isdigit( t_oldFile[i+4] ) && isdigit( t_oldFile[i+5] ) )
62 season = atoi(t_oldFile.substr(i+1, 2).c_str());
64 episode = atoi(t_oldFile.substr(i+4, 2).c_str());
69 else if ( t_oldFile[i]==
's' && isdigit( t_oldFile[i+1] ) && isdigit( t_oldFile[i+2] ) && ( t_oldFile[i+3]==
' ' || t_oldFile[i+3]==
'/' || t_oldFile[i+3]==
'.' || t_oldFile[i+3]==
'x' ) && t_oldFile[i+4]==
'e' && isdigit( t_oldFile[i+5] ) && isdigit( t_oldFile[i+6] ) && t_oldFile[i+7]==
'-' && isdigit( t_oldFile[i+8] ) && isdigit( t_oldFile[i+9] ) )
76 season = atoi(t_oldFile.substr(i+1, 2).c_str());
78 episode = atoi(t_oldFile.substr(i+5, 2).c_str());
80 xepisode = atoi(t_oldFile.substr(i+8, 2).c_str());
85 else if ( t_oldFile[i]==
's' && isdigit( t_oldFile[i+1] ) && isdigit( t_oldFile[i+2] ) && ( t_oldFile[i+3]==
' ' || t_oldFile[i+3]==
'/' || t_oldFile[i+3]==
'.' || t_oldFile[i+3]==
'x' ) && t_oldFile[i+4]==
'e' && isdigit( t_oldFile[i+5] ) && isdigit( t_oldFile[i+6] ) && isalpha( t_oldFile[i+7] ) )
92 season = atoi(t_oldFile.substr(i+1, 2).c_str());
94 episode = atoi(t_oldFile.substr(i+5, 2).c_str());
96 pepisode = t_oldFile.substr(i+7, 1).c_str();
101 else if ( t_oldFile[i]==
's' && isdigit( t_oldFile[i+1] ) && isdigit( t_oldFile[i+2] ) && ( t_oldFile[i+3]==
' ' || t_oldFile[i+3]==
'/' || t_oldFile[i+3]==
'.' || t_oldFile[i+3]==
'x' ) && t_oldFile[i+4]==
'e' && isdigit( t_oldFile[i+5] ) && isdigit( t_oldFile[i+6] ) )
108 season = atoi(t_oldFile.substr(i+1, 2).c_str());
110 episode = atoi(t_oldFile.substr(i+5, 2).c_str());
115 else if ( t_oldFile[i]==
's' && isdigit( t_oldFile[i+1] ) && t_oldFile[i+2]==
' ' && t_oldFile[i+3]==
'e' && isdigit( t_oldFile[i+4] ) && isdigit( t_oldFile[i+5] ) && t_oldFile[i+6]==
'-' && isdigit( t_oldFile[i+7] ) && isdigit( t_oldFile[i+8] ) )
120 coordofSnE[1] = i+10;
122 season = atoi(t_oldFile.substr(i+1, 1).c_str());
124 episode = atoi(t_oldFile.substr(i+4, 2).c_str());
126 xepisode = atoi(t_oldFile.substr(i+7, 2).c_str());
131 else if ( t_oldFile[i]==
's' && isdigit( t_oldFile[i+1] ) && t_oldFile[i+2]==
' ' && t_oldFile[i+3]==
'e' && isdigit( t_oldFile[i+4] ) && isdigit( t_oldFile[i+5] ) && isalpha( t_oldFile[i+6] ) )
138 season = atoi(t_oldFile.substr(i+1, 1).c_str());
140 episode = atoi(t_oldFile.substr(i+4, 2).c_str());
142 pepisode = t_oldFile.substr(i+6, 1).c_str();
147 else if ( t_oldFile[i]==
's' && isdigit( t_oldFile[i+1] ) && t_oldFile[i+2]==
' ' && t_oldFile[i+3]==
'e' && isdigit( t_oldFile[i+4] ) && isdigit( t_oldFile[i+5] ) )
154 season = atoi(t_oldFile.substr(i+1, 1).c_str());
156 episode = atoi(t_oldFile.substr(i+4, 2).c_str());
161 else if ( t_oldFile[i]==
's' && isdigit( t_oldFile[i+1] ) && t_oldFile[i+2]==
'e' && isdigit( t_oldFile[i+3] ) && isdigit( t_oldFile[i+4] ) && t_oldFile[i+5]==
'-' && isdigit( t_oldFile[i+6] ) && isdigit( t_oldFile[i+7] ) )
168 season = atoi(t_oldFile.substr(i+1, 1).c_str());
170 episode = atoi(t_oldFile.substr(i+3, 2).c_str());
172 xepisode = atoi(t_oldFile.substr(i+6, 2).c_str());
177 else if ( t_oldFile[i]==
's' && isdigit( t_oldFile[i+1] ) && t_oldFile[i+2]==
'e' && isdigit( t_oldFile[i+3] ) && isdigit( t_oldFile[i+4] ) && isalpha( t_oldFile[i+5] ) )
184 season = atoi(t_oldFile.substr(i+1, 1).c_str());
186 episode = atoi(t_oldFile.substr(i+3, 2).c_str());
188 pepisode = t_oldFile.substr(i+5, 1).c_str();
193 else if ( t_oldFile[i]==
's' && isdigit( t_oldFile[i+1] ) && t_oldFile[i+2]==
'e' && isdigit( t_oldFile[i+3] ) && isdigit( t_oldFile[i+4] ) )
200 season = atoi(t_oldFile.substr(i+1, 1).c_str());
202 episode = atoi(t_oldFile.substr(i+3, 2).c_str());
207 else if ( t_oldFile[i]==
's' && isdigit( t_oldFile[i+1] ) && t_oldFile[i+2]==
'e' && isdigit( t_oldFile[i+3] ) && isdigit( t_oldFile[i+4] ) && t_oldFile[i+5]==
'-' && isdigit( t_oldFile[i+6] ) )
214 season = atoi(t_oldFile.substr(i+1, 1).c_str());
216 episode = atoi(t_oldFile.substr(i+3, 1).c_str());
218 xepisode = atoi(t_oldFile.substr(i+5, 2).c_str());
223 else if ( t_oldFile[i]==
's' && isdigit( t_oldFile[i+1] ) && t_oldFile[i+2]==
'e' && isdigit( t_oldFile[i+3] ) && isalpha( t_oldFile[i+4] ) )
230 season = atoi(t_oldFile.substr(i+1, 1).c_str());
232 episode = atoi(t_oldFile.substr(i+3, 1).c_str());
234 pepisode = t_oldFile.substr(i+4, 1).c_str();
239 else if ( t_oldFile[i]==
's' && isdigit( t_oldFile[i+1] ) && t_oldFile[i+2]==
'e' && isdigit( t_oldFile[i+3] ) )
246 season = atoi(t_oldFile.substr(i+1, 1).c_str());
248 episode = atoi(t_oldFile.substr(i+3, 1).c_str());
253 else if ( isdigit(t_oldFile[i]) && isdigit(t_oldFile[i+1]) && isdigit(t_oldFile[i+2]) && isdigit(t_oldFile[i+3]) && t_oldFile[i+4]==
'-' && isdigit(t_oldFile[i+5]) && isdigit(t_oldFile[i+6]) )
260 season = atoi(t_oldFile.substr(i, 2).c_str());
262 episode = atoi(t_oldFile.substr(i+2, 2).c_str());
264 xepisode = atoi(t_oldFile.substr(i+5, 2).c_str());
269 else if ( isdigit(t_oldFile[i]) && isdigit(t_oldFile[i+1]) && isdigit(t_oldFile[i+2]) && isdigit(t_oldFile[i+3]) && isalpha(t_oldFile[i+4]) )
276 season = atoi(t_oldFile.substr(i, 2).c_str());
278 episode = atoi(t_oldFile.substr(i+2, 2).c_str());
280 pepisode = t_oldFile.substr(i+4, 1).c_str();
285 else if ( isdigit(t_oldFile[i]) && isdigit(t_oldFile[i+1]) && isdigit(t_oldFile[i+2]) && isdigit(t_oldFile[i+3]) )
292 season = atoi(t_oldFile.substr(i, 2).c_str());
294 episode = atoi(t_oldFile.substr(i+2, 2).c_str());
299 else if ( isdigit(t_oldFile[i]) && isdigit(t_oldFile[i+1]) && isdigit(t_oldFile[i+2]) && t_oldFile[i+3]==
'-' && isdigit(t_oldFile[i+4]) && isdigit(t_oldFile[i+5]) )
306 season = atoi(t_oldFile.substr(i, 1).c_str());
308 episode = atoi(t_oldFile.substr(i+1, 2).c_str());
310 xepisode = atoi(t_oldFile.substr(i+4, 2).c_str());
315 else if ( isdigit(t_oldFile[i]) && isdigit(t_oldFile[i+1]) && isdigit(t_oldFile[i+2]) && isalpha(t_oldFile[i+3]) )
322 season = atoi(t_oldFile.substr(i, 1).c_str());
324 episode = atoi(t_oldFile.substr(i+1, 2).c_str());
326 pepisode = t_oldFile.substr(i+3, 1).c_str();
331 else if ( isdigit(t_oldFile[i]) && isdigit(t_oldFile[i+1]) && isdigit(t_oldFile[i+2]) )
338 season = atoi(t_oldFile.substr(i, 1).c_str());
340 episode = atoi(t_oldFile.substr(i+1, 2).c_str());
345 else if ( isdigit(t_oldFile[i]) && isdigit(t_oldFile[i+1]) && t_oldFile[i+2]==
'x' && isdigit(t_oldFile[i+3]) && isdigit(t_oldFile[i+4]) && t_oldFile[i+5]==
'-' && isdigit(t_oldFile[i+6]) && isdigit(t_oldFile[i+7]) )
352 season = atoi(t_oldFile.substr(i, 2).c_str());
354 episode = atoi(t_oldFile.substr(i+3, 2).c_str());
356 xepisode = atoi(t_oldFile.substr(i+6, 2).c_str());
361 else if ( isdigit(t_oldFile[i]) && isdigit(t_oldFile[i+1]) && t_oldFile[i+2]==
'x' && isdigit(t_oldFile[i+3]) && isdigit(t_oldFile[i+4]) && isalpha(t_oldFile[i+5]) )
368 season = atoi(t_oldFile.substr(i, 2).c_str());
370 episode = atoi(t_oldFile.substr(i+3, 2).c_str());
372 pepisode = t_oldFile.substr(i+5, 1).c_str();
377 else if ( isdigit(t_oldFile[i]) && isdigit(t_oldFile[i+1]) && t_oldFile[i+2]==
'x' && isdigit(t_oldFile[i+3]) && isdigit(t_oldFile[i+4]) )
384 season = atoi(t_oldFile.substr(i, 2).c_str());
386 episode = atoi(t_oldFile.substr(i+3, 2).c_str());
391 else if ( isdigit(t_oldFile[i]) && ( t_oldFile[i+1]==
'x' || t_oldFile[i+1]==
'/' || t_oldFile[i+1]==
'-' ) && isdigit(t_oldFile[i+2]) && isdigit(t_oldFile[i+3]) && t_oldFile[i+4]==
'-' && isdigit(t_oldFile[i+5]) && isdigit(t_oldFile[i+6]) )
398 season = atoi(t_oldFile.substr(i, 1).c_str());
400 episode = atoi(t_oldFile.substr(i+2, 2).c_str());
402 xepisode = atoi(t_oldFile.substr(i+5, 2).c_str());
407 else if ( isdigit(t_oldFile[i]) && ( t_oldFile[i+1]==
'x' || t_oldFile[i+1]==
'/' || t_oldFile[i+1]==
'-' ) && isdigit(t_oldFile[i+2]) && isdigit(t_oldFile[i+3]) && isalpha(t_oldFile[i+4]) )
414 season = atoi(t_oldFile.substr(i, 1).c_str());
416 episode = atoi(t_oldFile.substr(i+2, 2).c_str());
418 pepisode = t_oldFile.substr(i+4, 1).c_str();
423 else if ( isdigit(t_oldFile[i]) && ( t_oldFile[i+1]==
'x' || t_oldFile[i+1]==
'/' || t_oldFile[i+1]==
'-' ) && isdigit(t_oldFile[i+2]) && isdigit(t_oldFile[i+3]) )
430 season = atoi(t_oldFile.substr(i, 1).c_str());
432 episode = atoi(t_oldFile.substr(i+2, 2).c_str());
The Parser class creates an object for each input file and parses file and folder names...
static void matchPattern(string &, int *, int &, int &, int &, string &)
Finds a season and episode number in a given string (filename).