imdb/tmdb: more unifications; part 2

Origin commit data
------------------
Branch: ni/coolstream
Commit: 577a5b6819
Author: vanhofen <vanhofen@gmx.de>
Date: 2021-04-10 (Sat, 10 Apr 2021)

Origin message was:
------------------
- imdb/tmdb: more unifications; part 2

------------------
No further description and justification available within origin commit message!

------------------
This commit was generated by Migit
This commit is contained in:
vanhofen
2021-04-10 22:19:43 +02:00
parent 6f0e3849db
commit c450e74ee8
4 changed files with 27 additions and 40 deletions

View File

@@ -28,35 +28,18 @@
#include <fstream>
#include <iostream>
#include <unistd.h>
#include <global.h>
#include <driver/screen_max.h>
#include <system/httptool.h>
#include <system/helpers.h>
#include <system/helpers-json.h>
#include <eitd/sectionsd.h>
#include <unistd.h>
#include <json/json.h>
#include "mdb-imdb.h"
CIMDB::CIMDB()
{
search_url = "http://www.google.de/search?q=";
search_outfile = "/tmp/google.out";
search_error = "IMDb: Google download failed";
imdb_url = "http://www.omdbapi.com/?plot=full&r=json&i=";
imdb_outfile = "/tmp/imdb.json";
posterfile = "/tmp/imdb.jpg";
acc = 0;
}
CIMDB::~CIMDB()
{
cleanup();
}
CIMDB* CIMDB::getInstance()
{
static CIMDB* imdb = NULL;
@@ -65,11 +48,22 @@ CIMDB* CIMDB::getInstance()
return imdb;
}
inline std::string CIMDB::getApiKey()
CIMDB::CIMDB()
{
std::string ret = "&apikey=";
ret += g_settings.omdb_api_key;
return ret;
key = g_settings.omdb_api_key;
search_url = "http://www.google.de/search?q=";
search_outfile = "/tmp/google.out";
search_error = "IMDb: Google download failed";
imdb_url = "http://www.omdbapi.com/?plot=full&r=json&apikey=" + key + "&i=";
imdb_outfile = "/tmp/imdb.json";
posterfile = "/tmp/imdb.jpg";
acc = 0;
}
CIMDB::~CIMDB()
{
cleanup();
}
std::string CIMDB::utf82url(std::string s)
@@ -315,7 +309,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 + getApiKey();
std::string url = imdb_url + imdb_id;
if (httpTool.downloadFile(url, imdb_outfile.c_str()))
{

View File

@@ -56,6 +56,7 @@ class CIMDB
private:
int acc;
std::string imdb_url;
std::string key; // omdb api key
std::string googleIMDb(std::string s);
std::string utf82url(std::string s);

View File

@@ -24,26 +24,22 @@
#include <config.h>
#endif
#include <fstream>
#include <set>
#include <string>
#include <stdio.h>
#include <stdlib.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
#include <errno.h>
#include <fstream>
#include <set>
#include <string>
#include <neutrino.h>
#include "system/settings.h"
#include "system/set_threadname.h"
#include <system/settings.h>
#include <system/set_threadname.h>
#include <driver/screen_max.h>
#include <global.h>
#include "mdb-tmdb.h"
CTMDB* CTMDB::getInstance()
@@ -56,11 +52,7 @@ CTMDB* CTMDB::getInstance()
CTMDB::CTMDB()
{
#ifdef TMDB_API_KEY
key = TMDB_API_KEY;
#else
key = g_settings.tmdb_api_key;
#endif
hintbox = NULL;
}

View File

@@ -23,9 +23,9 @@
#define __tmdb__
#include <string>
#include "system/helpers.h"
#include <system/helpers.h>
#include <system/helpers-json.h>
#include "gui/widget/hintbox.h"
#include <gui/widget/hintbox.h>
#define TMDB_COVER "/tmp/tmdb.jpg"