TV_rename: return a vector of languages for windows
This commit is contained in:
parent
31d30bb42a
commit
e6b2aeecad
@ -107,7 +107,7 @@ string showNameFromId( const string &id, const string &language ) {
|
||||
|
||||
json.Parse( request.get( TEXT( "/series/" ) + id ).c_str() );
|
||||
if ( json.HasParseError() )
|
||||
return "";
|
||||
return TEXT( "" );
|
||||
return toString( json["data"]["seriesName"].GetString() );
|
||||
}
|
||||
|
||||
@ -262,9 +262,14 @@ getRenamedFiles( const string &show, int season, const string id,
|
||||
return renamed_files;
|
||||
}
|
||||
|
||||
#ifndef _WIN32
|
||||
std::map< string, string > getLangs() {
|
||||
Request &request = _tv_rename_request;
|
||||
std::map< string, string > langs;
|
||||
#else
|
||||
std::vector< std::pair< string, string > > getLangs() {
|
||||
std::vector< std::pair< string, string > > langs;
|
||||
#endif
|
||||
Request &request = _tv_rename_request;
|
||||
request.addHeader( TEXT( "Accept: application/json" ) );
|
||||
request.addHeader( TEXT( "Authorization: Bearer " ) +
|
||||
_tv_rename_api_token );
|
||||
@ -273,8 +278,14 @@ std::map< string, string > getLangs() {
|
||||
request.clearHeader();
|
||||
rapidjson::Value &lang_data = d["data"];
|
||||
for ( size_t i = 0; i < lang_data.Size(); i++ ) {
|
||||
#ifndef _WIN32
|
||||
langs[toString( lang_data[i]["abbreviation"].GetString() )] =
|
||||
toString( lang_data[i]["name"].GetString() );
|
||||
#else
|
||||
langs.emplace_back(
|
||||
toString( lang_data[i]["abbreviation"].GetString() ),
|
||||
toString( lang_data[i]["name"].GetString() ) );
|
||||
#endif
|
||||
}
|
||||
return langs;
|
||||
}
|
||||
|
@ -46,7 +46,11 @@ getRenamedFiles( const string &show, int season, const string id,
|
||||
const bool &linux, const std::map< int, string > &files,
|
||||
bool dvd = false );
|
||||
|
||||
#ifndef _WIN32
|
||||
std::map< string, string > getLangs();
|
||||
#else
|
||||
std::vector< std::pair< string, string > > getLangs();
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user