TV_Rename: slight refactor and formatting
This commit is contained in:
parent
efa1daf639
commit
3f6c97bda7
@ -131,15 +131,15 @@ std::vector< string > getEpisodeNames( const string &id, const string &season,
|
|||||||
episodes.resize( epdata.size() );
|
episodes.resize( epdata.size() );
|
||||||
for ( auto &x : epdata ) {
|
for ( auto &x : epdata ) {
|
||||||
if ( x["episodeName"].is_string() ) {
|
if ( x["episodeName"].is_string() ) {
|
||||||
if ( dvd ) {
|
size_t index = -1;
|
||||||
size_t index = x["dvdEpisodeNumber"].get< size_t >();
|
if ( dvd )
|
||||||
if ( index > episodes.size() )
|
index = x["dvdEpisodeNumber"].get< size_t >();
|
||||||
episodes.resize( index );
|
else
|
||||||
index--;
|
index = x["airedEpisodeNumber"].get< size_t >();
|
||||||
episodes[index] =
|
|
||||||
toString( x["episodeName"].get< std::string >() );
|
if ( index == static_cast<size_t>( -1 ) )
|
||||||
} else {
|
continue;
|
||||||
size_t index = x["airedEpisodeNumber"].get< size_t >();
|
|
||||||
if ( index > episodes.size() )
|
if ( index > episodes.size() )
|
||||||
episodes.resize( index );
|
episodes.resize( index );
|
||||||
index--;
|
index--;
|
||||||
@ -150,7 +150,6 @@ std::vector< string > getEpisodeNames( const string &id, const string &season,
|
|||||||
episodes[index].pop_back();
|
episodes[index].pop_back();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
cerr << "Couldn't find episode names for season " << season
|
cerr << "Couldn't find episode names for season " << season
|
||||||
<< " of show " << showNameFromId( id, language ) << std::endl;
|
<< " of show " << showNameFromId( id, language ) << std::endl;
|
||||||
@ -280,8 +279,8 @@ bool authenticate( const std::string &api_key ) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void singleSeason( const string &path, const string &show, int season, string id,
|
void singleSeason( const string &path, const string &show, int season,
|
||||||
const string &language, const string &pattern,
|
string id, const string &language, const string &pattern,
|
||||||
const bool &linux, const bool &trust,
|
const bool &linux, const bool &trust,
|
||||||
std::map< int, string > *files_ptr, bool print, bool dvd ) {
|
std::map< int, string > *files_ptr, bool print, bool dvd ) {
|
||||||
#ifndef GUI
|
#ifndef GUI
|
||||||
@ -344,8 +343,8 @@ end:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void singleSeason( const string &path, const string &show, int season, string id,
|
void singleSeason( const string &path, const string &show, int season,
|
||||||
const string &language, const string &pattern,
|
string id, const string &language, const string &pattern,
|
||||||
const size_t &flags, std::map< int, string > *files_ptr,
|
const size_t &flags, std::map< int, string > *files_ptr,
|
||||||
bool print ) {
|
bool print ) {
|
||||||
singleSeason( path, show, season, id, language, pattern, flags & TV_LINUX,
|
singleSeason( path, show, season, id, language, pattern, flags & TV_LINUX,
|
||||||
|
@ -25,14 +25,14 @@ using char_t = char;
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void singleSeason( const string &path, const string &show, int season, string id,
|
void singleSeason( const string &path, const string &show, int season,
|
||||||
const string &language, const string &pattern,
|
string id, const string &language, const string &pattern,
|
||||||
const bool &linux, const bool &trust,
|
const bool &linux, const bool &trust,
|
||||||
std::map< int, string > *files_ptr = nullptr,
|
std::map< int, string > *files_ptr = nullptr,
|
||||||
bool print = true, bool dvd = false );
|
bool print = true, bool dvd = false );
|
||||||
|
|
||||||
void singleSeason( const string &path, const string &show, int season, string id,
|
void singleSeason( const string &path, const string &show, int season,
|
||||||
const string &language, const string &pattern,
|
string id, const string &language, const string &pattern,
|
||||||
const size_t &flags,
|
const size_t &flags,
|
||||||
std::map< int, string > *files_ptr = nullptr,
|
std::map< int, string > *files_ptr = nullptr,
|
||||||
bool print = true );
|
bool print = true );
|
||||||
|
Loading…
Reference in New Issue
Block a user