69 unsigned int pos = fileName.find_last_of(
SLASH );
71 oldDir = fileName.substr(0, pos+1);
73 oldFile = fileName.substr(pos+1);
80 for(
unsigned int i = 0; i < t_oldFile.length(); i++ )
83 t_oldFile[i] = tolower( t_oldFile[i] );
87 for(
unsigned int i = 0; i < t_oldDir.length(); i++ )
90 t_oldDir[i] = tolower( t_oldDir[i] );
94 pos = t_oldFile.find_last_of(
".");
98 t_oldFile = t_oldFile.substr(0, pos);
104 int coordofSnE[2] = {0,0};
118 unsigned int pos_oF = -1;
120 pos_oF = t_oldFile.find(
"season" );
122 unsigned int pos_oD = -1;
124 pos_oD = t_oldDir.find(
"season" );
127 if( pos_oF < t_oldFile.length() - 7 && t_oldFile.length() > 7 )
130 if( isdigit( t_oldFile.substr( pos_oF + 7, 2 ).c_str()[1] ) )
133 season = atoi( t_oldFile.substr( pos_oF + 7, 2 ).c_str() );
136 else if( isdigit( t_oldFile.substr( pos_oF + 7, 1 ).c_str()[0] ) )
139 season = atoi( t_oldFile.substr( pos_oF + 7, 1 ).c_str() );
142 coordofSnE[0] = pos_oF-1;
145 else if( pos_oD < t_oldDir.length() - 7 && t_oldFile.length() > 7 )
148 if( isdigit( t_oldDir.substr( pos_oD + 7, 2 ).c_str()[1] ) )
151 season = atoi( t_oldDir.substr( pos_oD + 7, 2 ).c_str() );
154 else if( isdigit( t_oldDir.substr( pos_oD + 7, 1 ).c_str()[0] ) )
157 season = atoi( t_oldDir.substr( pos_oD + 7, 1 ).c_str() );
166 for (i=0; i<t_oldFile.length(); i++)
169 if ( t_oldFile[i]==
's' && isdigit(t_oldFile[i+1]) && isdigit(t_oldFile[i+2]) )
174 season = atoi(t_oldFile.substr(i+1, 2).c_str());
179 else if ( t_oldFile[i]==
's' && isdigit(t_oldFile[i+1]) )
184 season = atoi(t_oldFile.substr(i+1, 1).c_str());
198 pos = t_oldFile.find(
"episode" );
200 if( pos < t_oldFile.length() - 8 && t_oldFile.length() > 8 )
203 if( isdigit( t_oldFile.substr( pos + 8, 2 ).c_str()[1] ) )
206 episode = atoi( t_oldFile.substr( pos + 8, 2 ).c_str() );
208 coordofSnE[1] = pos+11;
211 else if( isdigit( t_oldFile.substr( pos + 8, 1 ).c_str()[0] ) )
214 episode = atoi( t_oldFile.substr( pos + 8, 1 ).c_str() );
216 coordofSnE[1] = pos+10;
223 for (i=0; i<t_oldFile.length(); i++)
226 if ( isdigit(t_oldFile[i]) && isdigit(t_oldFile[i+1]) )
231 episode = atoi(t_oldFile.substr(i, 2).c_str());
236 else if ( isdigit(t_oldFile[i]) )
241 episode = atoi(t_oldFile.substr(i, 1).c_str());
281 if( coordofSnE[0] <= 0 )
289 name = t_oldFile.substr(0, coordofSnE[0]);
308 if ( coordofSnE[1] <
int( t_oldFile.length() ) )
311 title = t_oldFile.substr( coordofSnE[1] );
317 if (
title.length() > 0)
321 if (
title.length() > 0)
void parseShow(string, ConfigOpts *)
Parses the filename.
string oldDir
Holds the show's original directory.
A Show name match failure occured.
string getOldFile() const
void newDir(ConfigOpts *)
Generates the new directory in which the file will be located.
bool overrideDir
Override directory flag - (WTF?)
string oldFile
Holds the show's original filename.
void newName(ConfigOpts *)
Generates the new filename from parsed data complete with extension.
bool findShow(string &, ConfigOpts *)
Determines if the given filename contains a show name.
static void cleanUp(string &, ConfigOpts *)
Removes filler characters and extra white spaces from a string.
string show
Holds the show's new filename.
string getPEpisode() const
string pepisode
Holds the show's episode part.
int episode
Holds the show's episode number.
int weight
Holds the value used for duplicate selection - (WTF?)
ConfigOpts::errorType getErrorData() const
int xepisode
Holds the show's multi-episode number.
static void removeTag(string &, ConfigOpts *)
Removes release group tags as defined in the blacklist file.
int showNameIndex
Holds the index of the showname.
string extension
Holds the show's new extension.
string dir
Holds the show's new directory.
static string getOptions(optionValue)
Retrieves the user configuration options from an array.
output directory from args
~Parser()
Default destructor.
int getShowNameIndex() const
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).
ConfigOpts::errorType errorData
Stores the error type code.
string title
Holds the show's new title.
static void titleCase(string &, ConfigOpts *)
Standardizes capitalization of titles.
Parser()
Default constructor, yields default values.
bool getOverRideDir() const
A Season or Episode pattern match failure occured.
int season
Holds the show's season number.
string getExtension() const
Stores all config options, settings, and flags for clerk.
static vector< string > v_blackList
A vector that holds a list of tags to be removed from each file's name.
bool error
Error flag - True if an error occured.