diff options
author | horchi <vdr@jwendel.de> | 2018-02-10 17:44:57 +0100 |
---|---|---|
committer | horchi <vdr@jwendel.de> | 2018-02-10 17:44:57 +0100 |
commit | 4b7842feee923e0ab599fcfb40138df489682d4a (patch) | |
tree | ba418b59f53a6556790d8eaf94c5b0f72f19bb72 /recording.c | |
parent | 911b71c9c70b99b98677179dff404e8eb2432592 (diff) | |
download | vdr-plugin-epg2vdr-4b7842feee923e0ab599fcfb40138df489682d4a.tar.gz vdr-plugin-epg2vdr-4b7842feee923e0ab599fcfb40138df489682d4a.tar.bz2 |
minor change
Diffstat (limited to 'recording.c')
-rw-r--r-- | recording.c | 36 |
1 files changed, 34 insertions, 2 deletions
diff --git a/recording.c b/recording.c index 31ec980..d6d24b5 100644 --- a/recording.c +++ b/recording.c @@ -200,6 +200,7 @@ int cUpdate::storeAllRecordingInfoFiles() { cEventDetails evd; int count = 0; + int imgCount = 0; tell(1, "Store info.epg2vdr for all recordings"); @@ -239,6 +240,36 @@ int cUpdate::storeAllRecordingInfoFiles() recordingListDb->setValue("LASTIFOUPD", sp); recordingListDb->update(sp); + // store the pictures to the filesystem + + recordingImagesDb->clear(); + recordingImagesDb->setValue("IMGID", recordingListDb->getStrValue("IMGID")); + + for (int i = selectImagesOfRecording->find(); i && dbConnected(); i = selectImagesOfRecording->fetch()) + { + char* imgPath; + int lfn = recordingImagesDb->getIntValue("LFN"); + int size = imageSize.getIntValue(); + + asprintf(&imgPath, "%s/test_%d.jpg", path, lfn); + + if (!fileExists(imgPath) || fileSize(imgPath) != size) + { + tell(1, "Storing image of recording '%s' to '%s'", + recordingListDb->getStrValue("TITLE"), imgPath); + + if (fileExists(imgPath)) + removeFile(imgPath); + + storeToFile(imgPath, recordingImagesDb->getStrValue("IMAGE"), size); + imgCount++; + } + + free(imgPath); + } + + selectImagesOfRecording->freeResult(); + free(path); } @@ -246,7 +277,7 @@ int cUpdate::storeAllRecordingInfoFiles() selectRecordings->freeResult(); storeAllRecordingInfoFilesTrigger = no; - tell(1, "Stored %d info.epg2vdr files", count); + tell(1, "Stored %d info.epg2vdr files and %d images", count, imgCount); return done; } @@ -485,8 +516,9 @@ int cUpdate::updateRecordingTable(int fullReload) if (!recordingListDb->getValue("IMGID")->isEmpty()) { + recordingImagesDb->clear(); recordingImagesDb->setValue("IMGID", recordingListDb->getStrValue("IMGID")); - recordingImagesDb->setValue("LFN", 1); + recordingImagesDb->setValue("LFN", 0); if (!recordingImagesDb->find()) { |