From c8067ddaf19ccd9c6d782367cfdb0bf2a9310eb3 Mon Sep 17 00:00:00 2001 From: zvon Date: Thu, 17 Jan 2019 17:33:13 +0100 Subject: [PATCH] Delete unused function, add a few comments --- functions.cpp | 15 ++------------- functions.hpp | 1 - tv_rename.cpp | 1 + 3 files changed, 3 insertions(+), 14 deletions(-) diff --git a/functions.cpp b/functions.cpp index 54b8941..53c57ed 100644 --- a/functions.cpp +++ b/functions.cpp @@ -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> &seasons, const std::string } } -void iterateFS(std::set &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); diff --git a/functions.hpp b/functions.hpp index f09a130..0030806 100644 --- a/functions.hpp +++ b/functions.hpp @@ -19,7 +19,6 @@ std::string getDefUrl( std::string show, const std::string &language, Curl &c ); void findSeason(std::set &files, int season, const std::string &path); void findSeasons(std::map> &seasons, const std::string &path, const std::set &season_numbers); void iterateFS(std::map> &seasons, const std::string &path); -void iterateFS(std::set &seasons, const std::string &path); void printHelp(); bool searchSpecificSeason(const char *const p, size_t &ep_pos, const std::string &number); diff --git a/tv_rename.cpp b/tv_rename.cpp index a40ac0c..025daf2 100644 --- a/tv_rename.cpp +++ b/tv_rename.cpp @@ -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 {