neutrino-mp tmdb -> neutrino-hd

Origin commit data
------------------
Branch: ni/coolstream
Commit: f07b01b418
Author: TangoCash <eric@loxat.de>
Date: 2016-03-04 (Fri, 04 Mar 2016)


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

------------------
This commit was generated by Migit
This commit is contained in:
TangoCash
2016-03-04 13:57:14 +01:00
committed by Michael Liebmann
parent f35562bc78
commit 5018ce6dd2
6 changed files with 539 additions and 7 deletions

84
src/gui/tmdb.h Normal file
View File

@@ -0,0 +1,84 @@
/*
Copyright (C) 2015 TangoCash
License: GPLv2
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation;
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef __TMDB__
#define __TMDB__
#include <curl/curl.h>
#include <curl/easy.h>
#include <string>
#include <gui/components/cc.h>
typedef struct {
std::string epgtitle;
std::string poster_path;
std::string overview;
std::string original_title;
std::string release_date;
std::string vote_average;
int vote_count;
int id;
std::string media_type;
int result;
int runtime;
std::string runtimes;
std::string genres;
int episodes;
int seasons;
std::string cast;
}tmdbinfo;
class cTmdb
{
private:
CURL *curl_handle;
CComponentsForm *form;
tmdbinfo minfo;
CFrameBuffer *frameBuffer;
int ox, oy, sx, sy, toph;
static size_t CurlWriteToString(void *ptr, size_t size, size_t nmemb, void *data);
std::string encodeUrl(std::string txt);
std::string decodeUrl(std::string url);
std::string random_API_KEY();
bool getUrl(std::string &url, std::string &answer, CURL *_curl_handle = NULL);
bool DownloadUrl(std::string url, std::string file, CURL *_curl_handle = NULL);
bool GetMovieDetails();
public:
cTmdb(std::string epgtitle);
~cTmdb();
int exec();
std::string CreateEPGText();
std::string getTitle() { return minfo.epgtitle;}
std::string getOrgTitle() { return minfo.original_title;}
std::string getReleaseDate() { return minfo.release_date;}
std::string getDescription() { return minfo.overview;}
std::string getVote() { return minfo.vote_average;}
bool hasCover() { return !minfo.poster_path.empty();}
bool getBigCover(std::string cover) { return DownloadUrl("http://image.tmdb.org/t/p/w342" + minfo.poster_path, cover);}
bool getSmallCover(std::string cover) { return DownloadUrl("http://image.tmdb.org/t/p/w185" + minfo.poster_path, cover);}
int getResults() { return minfo.result;}
int getStars() { return (int) (atof(minfo.vote_average.c_str())+0.5);}
};
#endif