summaryrefslogtreecommitdiff
path: root/PLUGINS/epgdata/epgdata.c
diff options
context:
space:
mode:
authorhorchi <vdr@jwendel.de>2018-03-11 14:00:09 +0100
committerhorchi <vdr@jwendel.de>2018-03-11 14:00:09 +0100
commitcc0ddd47a78d451b445cfa7667757400c619cd5b (patch)
tree2cfadc6b53b10ceba0606a59176035af9e7b13a4 /PLUGINS/epgdata/epgdata.c
parent69218e79181c863a92e51d0d0b8f8a31b31c66c2 (diff)
downloadvdr-epg-daemon-cc0ddd47a78d451b445cfa7667757400c619cd5b.tar.gz
vdr-epg-daemon-cc0ddd47a78d451b445cfa7667757400c619cd5b.tar.bz2
2018-03-11: version 1.1.138 (horchi)\n change: Fixed image problem with epgdata\n due to interface change by epgdata (patch by seahawk1986)\n\n1.1.138
Diffstat (limited to 'PLUGINS/epgdata/epgdata.c')
-rw-r--r--PLUGINS/epgdata/epgdata.c49
1 files changed, 27 insertions, 22 deletions
diff --git a/PLUGINS/epgdata/epgdata.c b/PLUGINS/epgdata/epgdata.c
index aca4fcb..d368d30 100644
--- a/PLUGINS/epgdata/epgdata.c
+++ b/PLUGINS/epgdata/epgdata.c
@@ -625,44 +625,49 @@ int Epgdata::processFile(const char* data, int size, const char* fileRef)
}
//***************************************************************************
-// Get Picture
+// Create FS Name Of Picture
+// - caller has to free the result!
//***************************************************************************
-int Epgdata::getPicture(const char* imagename, const char* fileRef, MemoryStruct* data)
+char* Epgdata::fsNameOfPicture(const char* imagename)
{
- int fileSize = 0;
- char* path = 0;
- char entryName[200+TB];
+ char* buffer = 0;
- data->clear();
+ if (const char* p = strstr(imagename, "://"))
+ buffer = strdup(p+strlen("://"));
+ else
+ buffer = strdup(imagename);
- // lookup file information
+ replaceChars(buffer, "<>:\"/\\:|?*", '_');
+ return buffer;
+}
- obj->fileDb->clear();
- obj->fileDb->setValue("FILEREF", fileRef);
- obj->fileDb->setValue("SOURCE", getSource());
+//***************************************************************************
+// Get Picture
+//***************************************************************************
- if (stmtByFileRef->find())
- asprintf(&path, "%s/epgdata/%s", EpgdConfig.cachePath,
- obj->fileDb->getStrValue("Name"));
+int Epgdata::getPicture(const char* imagename, const char* fileRef, MemoryStruct* data)
+{
+ int fileSize = 0;
+ int status;
- stmtByFileRef->freeResult();
+ data->clear();
- if (!path)
+ if (!imagename)
{
- tell(0, "Error: No entry with fileref '%s' to lookup image '%s' found",
- fileRef, imagename);
+ tell(0, "Error: No image url given, skipping image");
return 0;
}
- if (unzip(path, imagename, data->memory, fileSize, entryName) == success)
+ tell(0, "Downloading image '%s'", imagename);
+ status = obj->downloadFile(imagename, fileSize, data);
+
+ if (status != success)
{
- data->size = fileSize;
- tell(2, "Unzip of image '%s' succeeded", imagename);
+ tell(0, "Error: downloading image from url '%s' failed", imagename);
+ return 0;
}
- free(path);
-
return fileSize;
}