From 7f69b3c662c88310b0c1c3d445cd3a524b3b251a Mon Sep 17 00:00:00 2001 From: zvon Date: Wed, 12 Feb 2020 11:46:44 +0100 Subject: [PATCH] tv_rename: getLangs returns map instead of vector of pairs --- tv_rename.cpp | 9 ++++----- tv_rename.hpp | 2 +- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/tv_rename.cpp b/tv_rename.cpp index 0f3e15a..afb0c1c 100644 --- a/tv_rename.cpp +++ b/tv_rename.cpp @@ -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; } diff --git a/tv_rename.hpp b/tv_rename.hpp index 01e791f..bfa0142 100644 --- a/tv_rename.hpp +++ b/tv_rename.hpp @@ -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