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 | |
parent | 911b71c9c70b99b98677179dff404e8eb2432592 (diff) | |
download | vdr-plugin-epg2vdr-4b7842feee923e0ab599fcfb40138df489682d4a.tar.gz vdr-plugin-epg2vdr-4b7842feee923e0ab599fcfb40138df489682d4a.tar.bz2 |
minor change
-rw-r--r-- | menusched.c | 6 | ||||
-rw-r--r-- | recording.c | 36 | ||||
-rw-r--r-- | update.c | 20 | ||||
-rw-r--r-- | update.h | 2 |
4 files changed, 62 insertions, 2 deletions
diff --git a/menusched.c b/menusched.c index 7c79502..8c3915b 100644 --- a/menusched.c +++ b/menusched.c @@ -1132,7 +1132,13 @@ eOSState cMenuEpgWhatsOn::ProcessKey(eKeys Key) case k4: // Umschalt Timer erstellen { if (cMenuEpgScheduleItem* mi = (cMenuEpgScheduleItem*)Get(Current())) + { menuDb->createSwitchTimer(mi->event); + sleep(1); + + if (Update()) + Display(); + } return osContinue; } 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()) { @@ -135,6 +135,7 @@ cUpdate::cUpdate(cPluginEPG2VDR* aPlugin) deleteTimer = 0; selectMyTimer = 0; selectRecordings = 0; + selectImagesOfRecording = 0; selectRecForInfoUpdate = 0; selectTimerByEvent = 0; selectTimerById = 0; @@ -538,6 +539,24 @@ int cUpdate::initDb() status += selectRecordings->prepare(); + // select * + // from recordingimages where + // imgid = ? + + imageSizeRec.setField(&imageSizeDef); + + selectImagesOfRecording = new cDbStatement(recordingImagesDb); + + selectImagesOfRecording->build("select "); + selectImagesOfRecording->bindAllOut(); + selectImagesOfRecording->build(", length("); + selectImagesOfRecording->bind(&imageSize, cDBS::bndOut); + selectImagesOfRecording->build(")"); + selectImagesOfRecording->build(" from %s where ", recordingImagesDb->TableName()); + selectImagesOfRecording->bind("IMGID", cDBS::bndIn | cDBS::bndSet); + + status += selectImagesOfRecording->prepare(); + // select srcmovieid, srcseriesid, scrseriesepisode // from recordinglist where // state <> 'D' or stete is null @@ -777,6 +796,7 @@ int cUpdate::exitDb() delete deleteTimer; deleteTimer = 0; delete selectMyTimer; selectMyTimer = 0; delete selectRecordings; selectRecordings = 0; + delete selectImagesOfRecording; selectImagesOfRecording = 0; delete selectRecForInfoUpdate; selectRecForInfoUpdate = 0; delete selectTimerByEvent; selectTimerByEvent = 0; delete selectTimerById; selectTimerById = 0; @@ -274,6 +274,7 @@ class cUpdate : public cThread, public cStatus, public cParameters cDbStatement* deleteTimer; cDbStatement* selectMyTimer; cDbStatement* selectRecordings; + cDbStatement* selectImagesOfRecording; cDbStatement* selectRecForInfoUpdate; cDbStatement* selectPendingTimerActions; cDbStatement* selectSwitchTimerActions; @@ -288,6 +289,7 @@ class cUpdate : public cThread, public cStatus, public cParameters cDbValue extChannelId; cDbValue imageUpdSp; cDbValue imageSize; + cDbValue imageSizeRec; cDbValue masterId; cDbValue* viewDescription; |