Fixed random regex mishaps
This commit is contained in:
parent
725bc4d8a5
commit
cdf5120234
@ -163,10 +163,10 @@ void singleSeason( const std::string &path, const std::string &show, int season,
|
|||||||
return;
|
return;
|
||||||
for( const auto &x : files ) {
|
for( const auto &x : files ) {
|
||||||
std::string name = x.filename();
|
std::string name = x.filename();
|
||||||
std::string dir = std::regex_replace(x.c_str(), std::regex(name), "");
|
std::string dir = x.parent_path();
|
||||||
unsigned long num;
|
unsigned long num;
|
||||||
try {
|
try {
|
||||||
num = std::stoi(std::regex_replace(name, std::regex(".*[sS][0-9]{0,2000}[eE]([0-9]{0,2000}).*"), "$1"));
|
num = std::stoi(std::regex_replace(name, std::regex(".*[sS][0]{0,2000}" + std::to_string(season) + "[eE]([0-9]{1,2000}).*"), "$1"));
|
||||||
} catch (std::exception &e) {
|
} catch (std::exception &e) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -179,7 +179,7 @@ void singleSeason( const std::string &path, const std::string &show, int season,
|
|||||||
name = std::regex_replace(name, std::regex(">"), "is more than");
|
name = std::regex_replace(name, std::regex(">"), "is more than");
|
||||||
name = std::regex_replace(name, std::regex(":"), " -");
|
name = std::regex_replace(name, std::regex(":"), " -");
|
||||||
}
|
}
|
||||||
renamed_files.insert(dir + name);
|
renamed_files.insert(dir + "/" + name);
|
||||||
renamed_episodes[num] = name;
|
renamed_episodes[num] = name;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user