diff options
Diffstat (limited to 'PLUGINS')
-rw-r--r-- | PLUGINS/epgdata/epgdata.c | 49 | ||||
-rw-r--r-- | PLUGINS/epgdata/epgdata.h | 1 |
2 files changed, 28 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; } diff --git a/PLUGINS/epgdata/epgdata.h b/PLUGINS/epgdata/epgdata.h index 0bb0d88..c4097a8 100644 --- a/PLUGINS/epgdata/epgdata.h +++ b/PLUGINS/epgdata/epgdata.h @@ -25,6 +25,7 @@ class Epgdata : public Plugin const char* getSource() { return "epgdata"; } + char* fsNameOfPicture(const char* imagename); // caller has to free the result! int getPicture(const char* imagename, const char* fileRef, MemoryStruct* data); int processDay(int day, int fullupdate, Statistic* statistic); int cleanupAfter(); |