summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlouis <louis.braun@gmx.de>2014-10-26 08:47:24 +0100
committerlouis <louis.braun@gmx.de>2014-10-26 08:47:24 +0100
commite84c60f48aecc60d7289882d53b687920d223ef8 (patch)
tree0eab956c57c53831c67a3b4c8bfa428c19f24b52
parent2129df34cb48d04b15a7aab0afbb5246a01cb0d4 (diff)
downloadvdr-plugin-skindesigner-e84c60f48aecc60d7289882d53b687920d223ef8.tar.gz
vdr-plugin-skindesigner-e84c60f48aecc60d7289882d53b687920d223ef8.tar.bz2
fixed bug that hasposter is only true if poster really exists
-rw-r--r--HISTORY1
-rw-r--r--libcore/helpers.c5
-rw-r--r--libcore/helpers.h1
-rw-r--r--views/displaymenuitemcurrentview.c2
-rw-r--r--views/displaymenuitemview.c2
5 files changed, 9 insertions, 2 deletions
diff --git a/HISTORY b/HISTORY
index b0d4423..a0f256d 100644
--- a/HISTORY
+++ b/HISTORY
@@ -37,6 +37,7 @@ Version 0.0.2
- added device info in displaychannel, example in metrixHD
- improved menu icon display, additionally using menu cat
- changed devices list, device numbers start with 0
+- fixed bug that hasposter is only true if poster really exists
diff --git a/libcore/helpers.c b/libcore/helpers.c
index 1934f3e..4ca2272 100644
--- a/libcore/helpers.c
+++ b/libcore/helpers.c
@@ -90,6 +90,11 @@ bool isNumber(const string& s) {
return !s.empty() && it == s.end();
}
+bool FileExists(const string &fullpath) {
+ struct stat buffer;
+ return (stat (fullpath.c_str(), &buffer) == 0);
+}
+
bool FileExists(const string &path, const string &name, const string &ext) {
stringstream fileName;
fileName << path << name << "." << ext;
diff --git a/libcore/helpers.h b/libcore/helpers.h
index f489555..2a92efb 100644
--- a/libcore/helpers.h
+++ b/libcore/helpers.h
@@ -12,6 +12,7 @@ int Minimum(int a, int b, int c, int d, int e, int f);
std::string CutText(string &text, int width, string fontName, int fontSize);
std::string StrToLowerCase(string str);
bool isNumber(const string& s);
+bool FileExists(const string &fullpath);
bool FileExists(const string &path, const string &name, const string &ext);
bool FolderExists(const string &path);
bool FirstFileInFolder(string &path, string &extension, string &fileName);
diff --git a/views/displaymenuitemcurrentview.c b/views/displaymenuitemcurrentview.c
index d9263c4..312b041 100644
--- a/views/displaymenuitemcurrentview.c
+++ b/views/displaymenuitemcurrentview.c
@@ -42,7 +42,7 @@ void cDisplayMenuItemCurrentView::SetScraperPoster(const cEvent *event, const cR
call.event = event;
call.recording = recording;
if (pScraper->Service("GetPoster", &call)) {
- intTokens.insert(pair<string,int>("hasposter", true));
+ intTokens.insert(pair<string,int>("hasposter", FileExists(call.poster.path)));
intTokens.insert(pair<string,int>("posterwidth", call.poster.width));
intTokens.insert(pair<string,int>("posterheight", call.poster.height));
stringTokens.insert(pair<string,string>("posterpath", call.poster.path));
diff --git a/views/displaymenuitemview.c b/views/displaymenuitemview.c
index 42901b5..5e995c5 100644
--- a/views/displaymenuitemview.c
+++ b/views/displaymenuitemview.c
@@ -706,7 +706,7 @@ void cDisplayMenuItemRecordingView::SetTokens(void) {
call.event = NULL;
call.recording = usedRecording;
if (pScraper->Service("GetPosterThumb", &call)) {
- intTokens.insert(pair<string,int>("hasposterthumbnail", true));
+ intTokens.insert(pair<string,int>("hasposterthumbnail", FileExists(call.poster.path)));
intTokens.insert(pair<string,int>("thumbnailbwidth", call.poster.width));
intTokens.insert(pair<string,int>("thumbnailheight", call.poster.height));
stringTokens.insert(pair<string,string>("thumbnailpath", call.poster.path));