From cc0ddd47a78d451b445cfa7667757400c619cd5b Mon Sep 17 00:00:00 2001 From: horchi Date: Sun, 11 Mar 2018 14:00:09 +0100 Subject: 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\n --- PLUGINS/epgdata/epgdata.c | 49 ++++++++++++++++++++++++++--------------------- 1 file changed, 27 insertions(+), 22 deletions(-) (limited to 'PLUGINS/epgdata/epgdata.c') 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; } -- cgit v1.2.3