Replace '/', at the end check for double spaces
This commit is contained in:
parent
bcd79546f5
commit
1b20d90c0b
@ -90,12 +90,20 @@ std::vector<std::pair<std::string, std::pair<std::string, std::string>>> getRena
|
|||||||
auto pos = og_name.find_last_of('.');
|
auto pos = og_name.find_last_of('.');
|
||||||
// get desired filename
|
// get desired filename
|
||||||
auto name = compilePattern(pattern, season, num+1, og_name.substr(0, pos), episodes[num], show) + og_name.substr(pos);
|
auto name = compilePattern(pattern, season, num+1, og_name.substr(0, pos), episodes[num], show) + og_name.substr(pos);
|
||||||
|
// replace '/' with '|'
|
||||||
|
for( size_t i = 0; i < name.size(); i++ ) {
|
||||||
|
if( name[i] == '/' ) {
|
||||||
|
name[i] = '|';
|
||||||
|
}
|
||||||
|
}
|
||||||
// replace characters illegal in windows if desired
|
// replace characters illegal in windows if desired
|
||||||
if( !linux ) {
|
if( !linux ) {
|
||||||
name.erase(std::remove_if(name.begin(), name.end(), [](char x) {return x == '?' || x == '"' || x == '\\' || x == '|' || x == '*';}), name.end());
|
name.erase(std::remove_if(name.begin(), name.end(), [](char x) {return x == '?' || x == '"' || x == '\\' || x == '*';}), name.end());
|
||||||
size_t max{name.size()};
|
size_t max{name.size()};
|
||||||
for( size_t i = 0; i < max ; i++ ) {
|
for( size_t i = 0; i < max ; i++ ) {
|
||||||
if( name[i] == '<' ) {
|
if( name[i] == '|' ) {
|
||||||
|
name[i] = '-';
|
||||||
|
}else if( name[i] == '<' ) {
|
||||||
name[i] = 'i';
|
name[i] = 'i';
|
||||||
name.insert(i+1, "s less than");
|
name.insert(i+1, "s less than");
|
||||||
max += 11;
|
max += 11;
|
||||||
@ -109,6 +117,13 @@ std::vector<std::pair<std::string, std::pair<std::string, std::string>>> getRena
|
|||||||
max++;
|
max++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
for( size_t i = 0; i < max; i++ ) {
|
||||||
|
if ( name[i] == ' ' && name[i+1] == ' ' ) {
|
||||||
|
name.erase(i, 1);
|
||||||
|
max--;
|
||||||
|
i--;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
renamed_files.emplace_back(dir, std::pair<std::string, std::string>(og_name, name));
|
renamed_files.emplace_back(dir, std::pair<std::string, std::string>(og_name, name));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user