mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-09-03 02:41:21 +02:00
imdb: Fix an issue on changing of imdb key during runtime.
Global instance allows to set the api key from settings on first created instance of the imdb object only, so changes on settings had no effect during runtime and restart of neutrinon was required to apply ne keys. This should fix this.
This commit is contained in:
@@ -47,8 +47,6 @@ CIMDB::CIMDB()
|
||||
search_error = "IMDb: Google download failed";
|
||||
imdb_url = "http://www.omdbapi.com/?plot=full&r=json&i=";
|
||||
imdb_outfile = "/tmp/imdb.json";
|
||||
omdb_apikey = "&apikey=";
|
||||
omdb_apikey += g_settings.omdb_api_key;
|
||||
posterfile = "/tmp/imdb.jpg";
|
||||
|
||||
acc = 0;
|
||||
@@ -67,6 +65,13 @@ CIMDB* CIMDB::getInstance()
|
||||
return imdb;
|
||||
}
|
||||
|
||||
inline std::string CIMDB::getApiKey()
|
||||
{
|
||||
std::string ret = "&apikey=";
|
||||
ret += g_settings.omdb_api_key;
|
||||
return ret;
|
||||
}
|
||||
|
||||
std::string CIMDB::utf82url(std::string s)
|
||||
{
|
||||
std::stringstream ss;
|
||||
@@ -310,7 +315,7 @@ int CIMDB::getIMDb(const std::string& epgTitle)
|
||||
if(((imdb_id.find(search_error)) != std::string::npos))
|
||||
return ret;
|
||||
|
||||
std::string url = imdb_url + imdb_id + omdb_apikey;
|
||||
std::string url = imdb_url + imdb_id + getApiKey();
|
||||
|
||||
if (httpTool.downloadFile(url, imdb_outfile.c_str()))
|
||||
{
|
||||
|
Reference in New Issue
Block a user