diff options
author | Martin Schirrmacher <vdr.skinflatplus@schirrmacher.eu> | 2014-05-11 09:45:02 +0200 |
---|---|---|
committer | Martin Schirrmacher <vdr.skinflatplus@schirrmacher.eu> | 2014-05-11 09:45:02 +0200 |
commit | 31f226b32a33afffa1a9eef17d6fe7b9ab69510a (patch) | |
tree | 00e2a86826bc36ecc8dc018c8a60ade6489adad8 | |
parent | 4f730529bcb14ee3c7a48771d0c570f64005088c (diff) | |
download | skin-flatplus-31f226b32a33afffa1a9eef17d6fe7b9ab69510a.tar.gz skin-flatplus-31f226b32a33afffa1a9eef17d6fe7b9ab69510a.tar.bz2 |
fix loading epg text
-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | displaymenu.c | 90 | ||||
-rw-r--r-- | imageloader.c | 45 | ||||
-rw-r--r-- | imageloader.h | 4 |
4 files changed, 87 insertions, 54 deletions
@@ -26,7 +26,7 @@ PLUGIN = skinflatplus VDRLOGO = vdrlogo_default #DEFINES += -DDEBUGIMAGELOADTIME -#DEFINES += -DDEBUGEPGTIME +DEFINES += -DDEBUGEPGTIME ### The version number of this plugin (taken from the main source file): diff --git a/displaymenu.c b/displaymenu.c index 3ae86d12..38619c48 100644 --- a/displaymenu.c +++ b/displaymenu.c @@ -2027,10 +2027,14 @@ void cFlatDisplayMenu::SetEvent(const cEvent *Event) { mediaPath = series.banners[0].path; mediaWidth = cWidth/2 - marginItem*2; mediaHeight = 999; - for( unsigned int i = 0; i < series.actors.size(); i++ ) { - actors_path.push_back(series.actors[i].actorThumb.path); - actors_name.push_back(series.actors[i].name); - actors_role.push_back(series.actors[i].role); + if( Config.TVScraperEPGInfoShowActors ) { + for( unsigned int i = 0; i < series.actors.size(); i++ ) { + if( imgLoader.FileExits(series.actors[i].actorThumb.path) ) { + actors_path.push_back(series.actors[i].actorThumb.path); + actors_name.push_back(series.actors[i].name); + actors_role.push_back(series.actors[i].role); + } + } } if( series.name.length() > 0 ) series_info << tr("name: ") << series.name << endl; @@ -2056,10 +2060,14 @@ void cFlatDisplayMenu::SetEvent(const cEvent *Event) { mediaPath = movie.poster.path; mediaWidth = cWidth/2 - marginItem*3; mediaHeight = 999; - for( unsigned int i = 0; i < movie.actors.size(); i++ ) { - actors_path.push_back(movie.actors[i].actorThumb.path); - actors_name.push_back(movie.actors[i].name); - actors_role.push_back(movie.actors[i].role); + if( Config.TVScraperEPGInfoShowActors ) { + for( unsigned int i = 0; i < movie.actors.size(); i++ ) { + if( imgLoader.FileExits(movie.actors[i].actorThumb.path) ) { + actors_path.push_back(movie.actors[i].actorThumb.path); + actors_name.push_back(movie.actors[i].name); + actors_role.push_back(movie.actors[i].role); + } + } } if( movie.title.length() > 0 ) movie_info << tr("title: ") << movie.title << endl; @@ -2092,12 +2100,13 @@ void cFlatDisplayMenu::SetEvent(const cEvent *Event) { if( call.posters.size() > 0 ) mediaPath = call.posters[0].path; } - for( unsigned int i = 0; i < call.actors.size(); i++ ) { - cImage *img = imgLoader.LoadFile(call.actors[i].thumb.path.c_str(), 100, 100); - if( img ) { - actors_path.push_back(call.actors[i].thumb.path); - actors_name.push_back(call.actors[i].name); - actors_role.push_back(call.actors[i].role); + if( Config.TVScraperEPGInfoShowActors ) { + for( unsigned int i = 0; i < call.actors.size(); i++ ) { + if( imgLoader.FileExits(call.actors[i].thumb.path) ) { + actors_path.push_back(call.actors[i].thumb.path); + actors_name.push_back(call.actors[i].name); + actors_role.push_back(call.actors[i].role); + } } } } @@ -2241,6 +2250,11 @@ void cFlatDisplayMenu::SetEvent(const cEvent *Event) { else DecorBorderDraw(cLeft, cTop, cWidth, ComplexContent.ContentHeight(false), Config.decorBorderMenuContentSize, Config.decorBorderMenuContentType, Config.decorBorderMenuContentFg, Config.decorBorderMenuContentBg); + + #ifdef DEBUGEPGTIME + uint32_t tick7 = GetMsTicks(); + dsyslog("SetEvent total time: %d ms", tick7 - tick0); + #endif } void cFlatDisplayMenu::DrawItemExtraRecording(const cRecording *Recording, cString EmptyText) { @@ -2836,10 +2850,14 @@ void cFlatDisplayMenu::SetRecording(const cRecording *Recording) { mediaPath = series.banners[0].path; mediaWidth = cWidth/2 - marginItem*2; mediaHeight = 999; - for( unsigned int i = 0; i < series.actors.size(); i++ ) { - actors_path.push_back(series.actors[i].actorThumb.path); - actors_name.push_back(series.actors[i].name); - actors_role.push_back(series.actors[i].role); + if( Config.TVScraperRecInfoShowActors ) { + for( unsigned int i = 0; i < series.actors.size(); i++ ) { + if( imgLoader.FileExits( series.actors[i].actorThumb.path ) ) { + actors_path.push_back(series.actors[i].actorThumb.path); + actors_name.push_back(series.actors[i].name); + actors_role.push_back(series.actors[i].role); + } + } } if( series.name.length() > 0 ) series_info << tr("name: ") << series.name << endl; @@ -2865,10 +2883,14 @@ void cFlatDisplayMenu::SetRecording(const cRecording *Recording) { mediaPath = movie.poster.path; mediaWidth = cWidth/2 - marginItem*3; mediaHeight = 999; - for( unsigned int i = 0; i < movie.actors.size(); i++ ) { - actors_path.push_back(movie.actors[i].actorThumb.path); - actors_name.push_back(movie.actors[i].name); - actors_role.push_back(movie.actors[i].role); + if( Config.TVScraperRecInfoShowActors ) { + for( unsigned int i = 0; i < movie.actors.size(); i++ ) { + if( imgLoader.FileExits( movie.actors[i].actorThumb.path ) ) { + actors_path.push_back(movie.actors[i].actorThumb.path); + actors_name.push_back(movie.actors[i].name); + actors_role.push_back(movie.actors[i].role); + } + } } if( movie.title.length() > 0 ) movie_info << tr("title: ") << movie.title << endl; @@ -2901,19 +2923,20 @@ void cFlatDisplayMenu::SetRecording(const cRecording *Recording) { if( call.posters.size() > 0 ) mediaPath = call.posters[0].path; } - for( unsigned int i = 0; i < call.actors.size(); i++ ) { - cImage *img = imgLoader.LoadFile(call.actors[i].thumb.path.c_str(), 100, 100); - if( img ) { - actors_path.push_back(call.actors[i].thumb.path); - actors_name.push_back(call.actors[i].name); - actors_role.push_back(call.actors[i].role); + if( Config.TVScraperRecInfoShowActors ) { + for( unsigned int i = 0; i < call.actors.size(); i++ ) { + if( imgLoader.FileExits( call.actors[i].thumb.path )) { + actors_path.push_back(call.actors[i].thumb.path); + actors_name.push_back(call.actors[i].name); + actors_role.push_back(call.actors[i].role); + } } } } } #ifdef DEBUGEPGTIME uint32_t tick3 = GetMsTicks(); - dsyslog("SetEvent tvscraper time: %d ms", tick3 - tick2); + dsyslog("SetRecording tvscraper time: %d ms", tick3 - tick2); #endif if( mediaPath.length() > 0 ) { @@ -2963,7 +2986,7 @@ void cFlatDisplayMenu::SetRecording(const cRecording *Recording) { } #ifdef DEBUGEPGTIME uint32_t tick4 = GetMsTicks(); - dsyslog("SetEvent epg-text time: %d ms", tick4 - tick3); + dsyslog("SetRecording epg-text time: %d ms", tick4 - tick3); #endif if( Config.TVScraperRecInfoShowActors && actors_path.size() > 0 ) { @@ -3008,7 +3031,7 @@ void cFlatDisplayMenu::SetRecording(const cRecording *Recording) { } #ifdef DEBUGEPGTIME uint32_t tick5 = GetMsTicks(); - dsyslog("SetEvent actor time: %d ms", tick5 - tick4); + dsyslog("SetRecording actor time: %d ms", tick5 - tick4); #endif if( recAdditional.str().length() > 0 ) { @@ -3079,6 +3102,11 @@ void cFlatDisplayMenu::SetRecording(const cRecording *Recording) { DecorBorderDraw(RecordingBorder.Left, RecordingBorder.Top, RecordingBorder.Width, ComplexContent.ContentHeight(false), RecordingBorder.Size, RecordingBorder.Type, RecordingBorder.ColorFg, RecordingBorder.ColorBg, RecordingBorder.From, false); + + #ifdef DEBUGEPGTIME + uint32_t tick6 = GetMsTicks(); + dsyslog("SetRecording total time: %d ms", tick6 - tick0); + #endif } void cFlatDisplayMenu::SetText(const char *Text, bool FixedFont) { diff --git a/imageloader.c b/imageloader.c index cef0f5c3..02b7825e 100644 --- a/imageloader.c +++ b/imageloader.c @@ -42,9 +42,9 @@ cImage* cImageLoader::LoadLogo(const char *logo, int width, int height) { #ifdef DEBUGIMAGELOADTIME uint32_t tick3 = GetMsTicks(); #endif - + bool success = LoadImage(File); - + if( !success ) { dsyslog("imageloader LoadLogo: %s could not be loaded", *File); return NULL; @@ -57,9 +57,9 @@ cImage* cImageLoader::LoadLogo(const char *logo, int width, int height) { #ifdef DEBUGIMAGELOADTIME uint32_t tick5 = GetMsTicks(); #endif - + img = CreateImage(width, height); - + if( img == NULL ) return NULL; @@ -87,9 +87,9 @@ cImage* cImageLoader::LoadIcon(const char *cIcon, int width, int height, bool pr #ifdef DEBUGIMAGELOADTIME uint32_t tick1 = GetMsTicks(); #endif - + img = imgCache.GetImage( *File, width, height ); - + #ifdef DEBUGIMAGELOADTIME uint32_t tick2 = GetMsTicks(); dsyslog(" search in cache: %d ms", tick2 - tick1); @@ -100,23 +100,23 @@ cImage* cImageLoader::LoadIcon(const char *cIcon, int width, int height, bool pr #ifdef DEBUGIMAGELOADTIME uint32_t tick3 = GetMsTicks(); #endif - + bool success = LoadImage(File); - + #ifdef DEBUGIMAGELOADTIME uint32_t tick4 = GetMsTicks(); dsyslog(" load file from disk: %d ms", tick4 - tick3); #endif - + if( !success ) { File = cString::sprintf("%s%s/%s.%s", *Config.iconPath, "default", cIcon, *logoExtension); #ifdef DEBUGIMAGELOADTIME dsyslog("imageloader load icon %s", *File); uint32_t tick5 = GetMsTicks(); #endif - + img = imgCache.GetImage( *File, width, height ); - + #ifdef DEBUGIMAGELOADTIME uint32_t tick6 = GetMsTicks(); dsyslog(" search in cache: %d ms", tick6 - tick5); @@ -127,14 +127,14 @@ cImage* cImageLoader::LoadIcon(const char *cIcon, int width, int height, bool pr #ifdef DEBUGIMAGELOADTIME uint32_t tick7 = GetMsTicks(); #endif - + success = LoadImage(File); - + #ifdef DEBUGIMAGELOADTIME uint32_t tick8 = GetMsTicks(); dsyslog(" load file from disk: %d ms", tick8 - tick7); #endif - + if( !success ) { dsyslog("imageloader LoadIcon: %s could not be loaded", *File); return NULL; @@ -143,9 +143,9 @@ cImage* cImageLoader::LoadIcon(const char *cIcon, int width, int height, bool pr #ifdef DEBUGIMAGELOADTIME uint32_t tick9 = GetMsTicks(); #endif - + img = CreateImage(width, height); - + #ifdef DEBUGIMAGELOADTIME uint32_t tick10 = GetMsTicks(); dsyslog(" scale logo: %d ms", tick10 - tick9); @@ -181,9 +181,9 @@ cImage* cImageLoader::LoadFile(const char *cFile, int width, int height, bool pr #ifdef DEBUGIMAGELOADTIME uint32_t tick3 = GetMsTicks(); #endif - + bool success = LoadImage(File); - + if( !success ) { dsyslog("imageloader LoadFile: %s could not be loaded", *File); return NULL; @@ -196,9 +196,9 @@ cImage* cImageLoader::LoadFile(const char *cFile, int width, int height, bool pr #ifdef DEBUGIMAGELOADTIME uint32_t tick5 = GetMsTicks(); #endif - + img = CreateImage(width, height); - + if( img == NULL ) return NULL; @@ -217,3 +217,8 @@ void cImageLoader::toLowerCase(std::string &str) { str[i] = std::tolower(str[i]); } } + +bool cImageLoader::FileExits(const std::string& name) { + struct stat buffer; + return (stat (name.c_str(), &buffer) == 0); +} diff --git a/imageloader.h b/imageloader.h index 3458b27c..023314ce 100644 --- a/imageloader.h +++ b/imageloader.h @@ -15,11 +15,11 @@ class cImageLoader : public cImageMagickWrapper { public: cImageLoader(); ~cImageLoader(); - + cImage* LoadLogo(const char *logo, int width, int height); cImage* LoadIcon(const char *cIcon, int width, int height, bool preserveAspect = true); cImage* LoadFile(const char *cFile, int width, int height, bool preserveAspect = true); - + bool FileExits(const std::string& name); private: int epgImageWidthLarge, epgImageHeightLarge; int epgImageWidth, epgImageHeight; |