Delete unused function, add a few comments

This commit is contained in:
zvon 2019-01-17 17:33:13 +01:00
parent 6b6e38ab5a
commit c8067ddaf1
3 changed files with 3 additions and 14 deletions

View File

@ -36,6 +36,8 @@ std::string Curl::execute(const std::string &url) {
return source;
}
// return true if filename has specified season
// set ep_pos to position where episode number starts
bool searchSpecificSeason(const char *const p, size_t &ep_pos, const std::string &number) {
size_t cur_pos{};
bool found_season{false};
@ -133,19 +135,6 @@ void iterateFS(std::map<int, std::set<std::string>> &seasons, const std::string
}
}
void iterateFS(std::set<int> &seasons, const std::string &path) {
size_t season_pos{std::string::npos}; // season_pos - position of first digit of the season
for( const auto p: FSLib::Directory(path) ) {
if(FSLib::isDirectory(path + "/" + p)) {
iterateFS(seasons, path + "/" + p);
continue;
}
if( searchSeason(p, season_pos) )
seasons.insert(atoi(p+season_pos));
}
}
std::string getDefUrl( std::string show, const std::string &language, Curl &c ) {
std::replace(show.begin(), show.end(), ' ', '+');
auto source_code = c.execute("https://www.thetvdb.com/search?q=" + show + "&l=" + language);

View File

@ -19,7 +19,6 @@ std::string getDefUrl( std::string show, const std::string &language, Curl &c );
void findSeason(std::set<std::string> &files, int season, const std::string &path);
void findSeasons(std::map<int, std::set<std::string>> &seasons, const std::string &path, const std::set<int> &season_numbers);
void iterateFS(std::map<int, std::set<std::string>> &seasons, const std::string &path);
void iterateFS(std::set<int> &seasons, const std::string &path);
void printHelp();
bool searchSpecificSeason(const char *const p, size_t &ep_pos, const std::string &number);

View File

@ -248,6 +248,7 @@ void singleSeason( const std::string &path, const std::string &show, int season,
dir = x.substr(0, last);
}
unsigned long num;
// get file's episode number
if( searchSpecificSeason(x.c_str(), pos, std::to_string(season)) ) {
num = atoi(x.c_str()+pos);
} else {