tv_rename: getLangs returns map instead of vector of pairs

This commit is contained in:
zvon 2020-02-12 11:46:44 +01:00
parent 2a4b7c60ae
commit 7f69b3c662
2 changed files with 5 additions and 6 deletions

View File

@ -262,9 +262,9 @@ getRenamedFiles( const string &show, int season, const string id,
return renamed_files;
}
std::vector< std::pair< string, string > > getLangs() {
std::map< string, string > getLangs() {
Request &request = _tv_rename_request;
std::vector< std::pair< string, string > > langs;
std::map< string, string > langs;
request.addHeader( TEXT( "Accept: application/json" ) );
request.addHeader( TEXT( "Authorization: Bearer " ) +
_tv_rename_api_token );
@ -273,9 +273,8 @@ std::vector< std::pair< string, string > > getLangs() {
request.clearHeader();
rapidjson::Value &lang_data = d["data"];
for ( size_t i = 0; i < lang_data.Size(); i++ ) {
langs.emplace_back(
toString( lang_data[i]["abbreviation"].GetString() ),
toString( lang_data[i]["name"].GetString() ) );
langs[ toString( lang_data[i]["abbreviation"].GetString() ) ] =
toString( lang_data[i]["name"].GetString() );
}
return langs;
}

View File

@ -46,7 +46,7 @@ getRenamedFiles( const string &show, int season, const string id,
const bool &linux, const std::map< int, string > &files,
bool dvd = false );
std::vector< std::pair< string, string > > getLangs();
std::map< string, string > getLangs();
#else