Merge branch 'ni/tuxbox' of bitbucket.org:neutrino-images/ni-neutrino-hd into ni/tuxbox

Origin commit data
------------------
Branch: ni/coolstream
Commit: 589f4a543f
Author: gixxpunk <thomas.harfmann@gmail.com>
Date: 2017-05-29 (Mon, 29 May 2017)


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

------------------
This commit was generated by Migit
This commit is contained in:
gixxpunk
2017-05-29 17:15:45 +02:00
7 changed files with 50 additions and 82 deletions

View File

@@ -508,23 +508,8 @@ void CProgressBar::paintProgress(bool do_save_bg)
//NI graphic //NI graphic
void CProgressBar::paintGraphic() void CProgressBar::paintGraphic()
{ {
std::ostringstream buf; std::string pb_active_graphic(frameBuffer->getIconPath(graphic_file));
std::string pb_passive_graphic(frameBuffer->getIconPath(graphic_file + "_passive"));
buf.str("");
buf << ICONSDIR_VAR << "/" << graphic_file << ".png";
if (access(buf.str().c_str(), F_OK) != 0) {
buf.str("");
buf << ICONSDIR << "/" << graphic_file << ".png";
}
std::string pb_active_graphic(buf.str());
buf.str("");
buf << ICONSDIR_VAR << "/" << graphic_file << "_passive.png";
if (access(buf.str().c_str(), F_OK) != 0) {
buf.str("");
buf << ICONSDIR << "/" << graphic_file << "_passive.png";
}
std::string pb_passive_graphic(buf.str());
//printf("**** %04d::%04d: pb_last_width: %d, pb_active_width: %d, pb_max_width %d\n", pb_x, pb_y, pb_last_width, pb_active_width, pb_max_width); //printf("**** %04d::%04d: pb_last_width: %d, pb_active_width: %d, pb_max_width %d\n", pb_x, pb_y, pb_last_width, pb_active_width, pb_max_width);
@@ -547,24 +532,8 @@ void CProgressBar::paintGraphic()
//NI starbar //NI starbar
void CProgressBar::paintStarBar() void CProgressBar::paintStarBar()
{ {
std::ostringstream buf; std::string pb_active_graphic(frameBuffer->getIconPath(NEUTRINO_ICON_STARS));
graphic_file = "stars"; std::string pb_passive_graphic(frameBuffer->getIconPath(NEUTRINO_ICON_STARS_BG));
buf.str("");
buf << ICONSDIR_VAR << "/" << graphic_file << ".png";
if (access(buf.str().c_str(), F_OK) != 0) {
buf.str("");
buf << ICONSDIR << "/" << graphic_file << ".png";
}
std::string pb_active_graphic(buf.str());
buf.str("");
buf << ICONSDIR_VAR << "/" << graphic_file << "_bg.png";
if (access(buf.str().c_str(), F_OK) != 0) {
buf.str("");
buf << ICONSDIR << "/" << graphic_file << "_bg.png";
}
std::string pb_passive_graphic(buf.str());
int stars_w = 0, stars_h = 0; int stars_w = 0, stars_h = 0;
g_PicViewer->getSize(pb_passive_graphic.c_str(), &stars_w, &stars_h); g_PicViewer->getSize(pb_passive_graphic.c_str(), &stars_w, &stars_h);

View File

@@ -136,7 +136,7 @@ class CProgressBar : public CComponentsItem
const int val, const int max_val){x=x_pos; y=y_pos; width=w; height=h; pb_value=val; pb_max_value=max_val;} const int val, const int max_val){x=x_pos; y=y_pos; width=w; height=h; pb_value=val; pb_max_value=max_val;}
//NI graphic //NI graphic
void setGraphic(std::string graphic = "progressbar"){graphic_file = graphic;}; void setGraphic(std::string graphic) { graphic_file = graphic; }
///force update on next paint ///force update on next paint
void reset() { pb_last_width = -1; } void reset() { pb_last_width = -1; }

View File

@@ -321,7 +321,7 @@ void CEpgData::showText(int startPos, int ypos, bool has_cover, bool fullClear)
stars *= 10; // recalculate stars value for starbar stars *= 10; // recalculate stars value for starbar
int stars_w = 0, stars_h = 0; int stars_w = 0, stars_h = 0;
g_PicViewer->getSize(imdb->stars_bg.c_str(), &stars_w, &stars_h); frameBuffer->getIconSize(NEUTRINO_ICON_STARS_BG, &stars_w, &stars_h);
//create starbar item //create starbar item
CProgressBar *cc_starbar = new CProgressBar(); CProgressBar *cc_starbar = new CProgressBar();
@@ -331,8 +331,8 @@ void CEpgData::showText(int startPos, int ypos, bool has_cover, bool fullClear)
if (imdb_active) if (imdb_active)
{ {
int _x = sx+OFFSET_INNER_MID+cover_offset+logo_offset+stars_w+OFFSET_INNER_MID; int _x = sx+OFFSET_INNER_MID+cover_offset+logo_offset+cc_starbar->getWidth()+OFFSET_INNER_MID;
int _w = ox-OFFSET_INNER_MID-cover_offset-logo_offset-stars_w-OFFSET_INNER_MID; int _w = ox-OFFSET_INNER_MID-cover_offset-logo_offset-cc_starbar->getWidth()-OFFSET_INNER_MID;
g_Font[SNeutrinoSettings::FONT_TYPE_EPG_INFO1]->RenderString(_x, y+medlineheight, _w, imdb_rating, COL_MENUCONTENT_TEXT, 0, true); g_Font[SNeutrinoSettings::FONT_TYPE_EPG_INFO1]->RenderString(_x, y+medlineheight, _w, imdb_rating, COL_MENUCONTENT_TEXT, 0, true);
} }
} }
@@ -1645,7 +1645,7 @@ int CEpgData::showIMDb(bool splash)
//titel //titel
std::string title = imdb->getIMDbElement("Title"); std::string title = imdb->getIMDbElement("Title");
if(((title.find("IMDb: Google Download fehlgeschlagen")) != std::string::npos)) if(((title.find(imdb->search_error)) != std::string::npos))
return 1; return 1;
// clear epg array // clear epg array

View File

@@ -42,14 +42,13 @@
CIMDB::CIMDB() CIMDB::CIMDB()
{ {
surl = "http://www.google.de/search?q="; search_url = "http://www.google.de/search?q=";
soutfile = "/tmp/google.out"; search_outfile = "/tmp/google.out";
IMDburl = "http://www.omdbapi.com/?plot=full&r=json&i="; search_error = "IMDb: Google download failed";
IMDbAPI = "/tmp/imdb.json"; imdb_url = "http://www.omdbapi.com/?plot=full&r=json&i=";
omdbapiKey = "&apikey=20711f9e"; imdb_outfile = "/tmp/imdb.json";
omdb_apikey = "&apikey=20711f9e";
posterfile = "/tmp/imdb.jpg"; posterfile = "/tmp/imdb.jpg";
stars_bg = ICONSDIR "/stars_bg.png";
stars = ICONSDIR "/stars.png";
} }
CIMDB::~CIMDB() CIMDB::~CIMDB()
@@ -203,38 +202,39 @@ std::string CIMDB::parseFile(std::string search1, std::string search2, const cha
return(ret); return(ret);
} }
std::string CIMDB::googleIMDb(std::string searchStr) std::string CIMDB::googleIMDb(std::string s)
{ {
CHTTPTool httpTool; CHTTPTool httpTool;
std::string ret = "IMDb: Google Download fehlgeschlagen"; std::string ret = search_error;
std::string httpString = "imdb+"; std::string search_string("");
char* searchStr_ = (char*) searchStr.c_str(); char* search_char = (char*) s.c_str();
m.clear(); m.clear();
unlink(soutfile.c_str()); unlink(search_outfile.c_str());
unlink(IMDbAPI.c_str()); unlink(imdb_outfile.c_str());
unlink(posterfile.c_str()); unlink(posterfile.c_str());
while (*searchStr_!=0) while (*search_char != 0)
{ {
if ( (*searchStr_==' ') ) if (*search_char == ' ')
{ {
httpString += '+'; search_string += '+';
} else
{
httpString += *searchStr_;
} }
searchStr_++; else
{
search_string += *search_char;
}
search_char++;
} }
std::string url = surl + utf82url(httpString) + "%20site:www.imdb.com"; std::string url = search_url + utf82url(search_string) + "%20site:www.imdb.com";
if (httpTool.downloadFile(url, soutfile.c_str())) if (httpTool.downloadFile(url, search_outfile.c_str()))
{ {
ret = parseFile("http://www.imdb.com/title/", ">", soutfile.c_str()); ret = parseFile("http://www.imdb.com/title/", ">", search_outfile.c_str());
if(ret.empty()) if(ret.empty())
ret = parseFile("http://www.imdb.de/title/", ">", soutfile.c_str()); ret = parseFile("http://www.imdb.de/title/", ">", search_outfile.c_str());
std::string delimiters = "/&;"; std::string delimiters = "/&;";
size_t next = ret.find_first_of(delimiters, 0); size_t next = ret.find_first_of(delimiters, 0);
@@ -250,7 +250,7 @@ void CIMDB::initMap( std::map<std::string, std::string>& my )
Json::Reader reader; Json::Reader reader;
std::ostringstream ss; std::ostringstream ss;
std::ifstream fh(IMDbAPI.c_str(),std::ifstream::in); std::ifstream fh(imdb_outfile.c_str(),std::ifstream::in);
ss << fh.rdbuf(); ss << fh.rdbuf();
std::string filedata = ss.str(); std::string filedata = ss.str();
@@ -301,14 +301,14 @@ int CIMDB::getIMDb(const std::string& epgTitle)
CHTTPTool httpTool; CHTTPTool httpTool;
int ret = 0; int ret = 0;
std::string imdb_ID = googleIMDb(epgTitle); std::string imdb_id = googleIMDb(epgTitle);
if(((imdb_ID.find("IMDb: ")) != std::string::npos)) if(((imdb_id.find(search_error)) != std::string::npos))
return ret; return ret;
std::string url = IMDburl + imdb_ID + omdbapiKey; std::string url = imdb_url + imdb_id + omdb_apikey;
if (httpTool.downloadFile(url, IMDbAPI.c_str())) if (httpTool.downloadFile(url, imdb_outfile.c_str()))
{ {
initMap(m); initMap(m);
@@ -467,8 +467,8 @@ void CIMDB::StringReplace(std::string &str, const std::string search, const std:
void CIMDB::cleanup() void CIMDB::cleanup()
{ {
if (access(soutfile.c_str(), F_OK) == 0) if (access(search_outfile.c_str(), F_OK) == 0)
unlink(soutfile.c_str()); unlink(search_outfile.c_str());
if (access(posterfile.c_str(), F_OK) == 0) if (access(posterfile.c_str(), F_OK) == 0)
unlink(posterfile.c_str()); unlink(posterfile.c_str());
} }

View File

@@ -37,12 +37,11 @@ class CIMDB
~CIMDB(); ~CIMDB();
static CIMDB* getInstance(); static CIMDB* getInstance();
std::string surl; std::string search_url;
std::string soutfile; std::string search_outfile;
std::string IMDbAPI; std::string search_error;
std::string imdb_outfile;
std::string posterfile; std::string posterfile;
std::string stars_bg;
std::string stars;
int getIMDb(const std::string& epgTitle); int getIMDb(const std::string& epgTitle);
std::string getFilename(CZapitChannel * channel, uint64_t id); std::string getFilename(CZapitChannel * channel, uint64_t id);
@@ -59,9 +58,9 @@ class CIMDB
private: private:
int acc; int acc;
std::string IMDburl; std::string imdb_url;
std::string omdbapiKey; std::string omdb_apikey;
std::string googleIMDb(std::string searchStr); std::string googleIMDb(std::string s);
std::string utf82url(std::string s); std::string utf82url(std::string s);
std::string parseString(std::string search1, std::string search2, std::string str); std::string parseString(std::string search1, std::string search2, std::string str);
std::string parseFile(std::string search1, std::string search2, const char* file, std::string firstline="", int line_offset=0); std::string parseFile(std::string search1, std::string search2, const char* file, std::string firstline="", int line_offset=0);

View File

@@ -2484,9 +2484,7 @@ void CInfoViewer::showAnalogClock(int posx,int posy,int dia)
hy = int((dia * 0.6 * sin(hAngleInRad))); hy = int((dia * 0.6 * sin(hAngleInRad)));
if (analogclock_buf == NULL) { if (analogclock_buf == NULL) {
std::string clock_face = ICONSDIR_VAR "/clock_face.png"; std::string clock_face = frameBuffer->getIconPath("clock_face");
if (access(clock_face.c_str(), F_OK) != 0)
clock_face = ICONSDIR "/clock_face.png";
g_PicViewer->DisplayImage(clock_face, posx-dia, posy-dia, 2*dia, 2*dia); g_PicViewer->DisplayImage(clock_face, posx-dia, posy-dia, 2*dia, 2*dia);
analogclock_buf = new fb_pixel_t[2*dia * 2*dia]; analogclock_buf = new fb_pixel_t[2*dia * 2*dia];

View File

@@ -183,6 +183,8 @@
#define NEUTRINO_ICON_PIP "pip" #define NEUTRINO_ICON_PIP "pip"
#define NEUTRINO_ICON_STAR_ON "star-on" #define NEUTRINO_ICON_STAR_ON "star-on"
#define NEUTRINO_ICON_STAR_OFF "star-off" #define NEUTRINO_ICON_STAR_OFF "star-off"
#define NEUTRINO_ICON_STARS_BG "stars_bg" //NI
#define NEUTRINO_ICON_STARS "stars" //NI
#define NEUTRINO_ICON_TMDB "tmdb" #define NEUTRINO_ICON_TMDB "tmdb"
#define NEUTRINO_ICON_IMDB "imdb" #define NEUTRINO_ICON_IMDB "imdb"
#define NEUTRINO_ICON_PICTUREVIEWER "pictureviewer" #define NEUTRINO_ICON_PICTUREVIEWER "pictureviewer"