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() );
|
json.Parse( request.get( TEXT( "/series/" ) + id ).c_str() );
|
||||||
if ( json.HasParseError() )
|
if ( json.HasParseError() )
|
||||||
return "";
|
return TEXT( "" );
|
||||||
return toString( json["data"]["seriesName"].GetString() );
|
return toString( json["data"]["seriesName"].GetString() );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -138,7 +138,7 @@ std::vector< string > getEpisodeNames( const string &id, const string &season,
|
|||||||
json.Parse( request.get( baseurl + page ).c_str() );
|
json.Parse( request.get( baseurl + page ).c_str() );
|
||||||
if ( json.HasParseError() )
|
if ( json.HasParseError() )
|
||||||
return {};
|
return {};
|
||||||
if( json.FindMember("data") == json.MemberEnd() )
|
if ( json.FindMember( "data" ) == json.MemberEnd() )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if ( json["data"].IsArray() ) {
|
if ( json["data"].IsArray() ) {
|
||||||
@ -262,9 +262,14 @@ getRenamedFiles( const string &show, int season, const string id,
|
|||||||
return renamed_files;
|
return renamed_files;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef _WIN32
|
||||||
std::map< string, string > getLangs() {
|
std::map< string, string > getLangs() {
|
||||||
Request &request = _tv_rename_request;
|
|
||||||
std::map< string, string > langs;
|
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( "Accept: application/json" ) );
|
||||||
request.addHeader( TEXT( "Authorization: Bearer " ) +
|
request.addHeader( TEXT( "Authorization: Bearer " ) +
|
||||||
_tv_rename_api_token );
|
_tv_rename_api_token );
|
||||||
@ -273,8 +278,14 @@ std::map< string, string > getLangs() {
|
|||||||
request.clearHeader();
|
request.clearHeader();
|
||||||
rapidjson::Value &lang_data = d["data"];
|
rapidjson::Value &lang_data = d["data"];
|
||||||
for ( size_t i = 0; i < lang_data.Size(); i++ ) {
|
for ( size_t i = 0; i < lang_data.Size(); i++ ) {
|
||||||
langs[ toString( lang_data[i]["abbreviation"].GetString() ) ] =
|
#ifndef _WIN32
|
||||||
|
langs[toString( lang_data[i]["abbreviation"].GetString() )] =
|
||||||
toString( lang_data[i]["name"].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;
|
return langs;
|
||||||
}
|
}
|
||||||
|
@ -46,7 +46,11 @@ getRenamedFiles( const string &show, int season, const string id,
|
|||||||
const bool &linux, const std::map< int, string > &files,
|
const bool &linux, const std::map< int, string > &files,
|
||||||
bool dvd = false );
|
bool dvd = false );
|
||||||
|
|
||||||
|
#ifndef _WIN32
|
||||||
std::map< string, string > getLangs();
|
std::map< string, string > getLangs();
|
||||||
|
#else
|
||||||
|
std::vector< std::pair< string, string > > getLangs();
|
||||||
|
#endif
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user