summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhorchi <vdr@jwendel.de>2018-02-10 07:10:22 (GMT)
committerhorchi <vdr@jwendel.de>2018-02-10 07:10:22 (GMT)
commit911b71c9c70b99b98677179dff404e8eb2432592 (patch)
tree56aee590e84a212f716b4a70ccde3dfec7b1d595
parent59875c10d77355d34b864445e63f635fcc60d853 (diff)
downloadvdr-plugin-epg2vdr-911b71c9c70b99b98677179dff404e8eb2432592.tar.gz
vdr-plugin-epg2vdr-911b71c9c70b99b98677179dff404e8eb2432592.tar.bz2
2018-02-10 version 1.1.83 (horchi)\n - bugfix: Fixed delete of Switch timer\n - added: Fill recording images table with images of existing recordings\n\n1.1.83
-rw-r--r--HISTORY.h8
-rw-r--r--recording.c47
-rw-r--r--timer.c21
-rw-r--r--update.c4
4 files changed, 75 insertions, 5 deletions
diff --git a/HISTORY.h b/HISTORY.h
index df9c9ba..15e4318 100644
--- a/HISTORY.h
+++ b/HISTORY.h
@@ -5,8 +5,8 @@
*
*/
-#define _VERSION "1.1.82"
-#define VERSION_DATE "09.02.2018"
+#define _VERSION "1.1.83"
+#define VERSION_DATE "10.02.2018"
#define DB_API 6
@@ -19,6 +19,10 @@
/*
* ------------------------------------
+2018-02-10 version 1.1.83 (horchi)
+ - bugfix: Fixed delete of Switch timer
+ - added: Fill recording images table with images of existing recordings
+
2018-02-09 version 1.1.82 (horchi)
- added: Switch timer
diff --git a/recording.c b/recording.c
index 2de582e..31ec980 100644
--- a/recording.c
+++ b/recording.c
@@ -490,9 +490,56 @@ int cUpdate::updateRecordingTable(int fullReload)
if (!recordingImagesDb->find())
{
+ const char* ext = ".jpg";
+ MemoryStruct data;
+ struct dirent* dirent;
+ DIR* dir;
+ char* recdir;
+ int lfn = 0;
+
// we don't have a image, check filesystem
+ asprintf(&recdir, "%s/%s", videoBasePath, recordingListDb->getStrValue("PATH"));
+ dir = opendir(recdir);
+
+ if (!dir)
+ {
+ tell(1, "Can't open directory '%s', '%s'", recdir, strerror(errno));
+ continue;
+ }
+
+ free(recdir);
+
+ while ((dirent = readdir(dir)))
+ {
+ // check extension
+
+ if (strncmp(dirent->d_name + strlen(dirent->d_name) - strlen(ext), ext, strlen(ext)) != 0)
+ continue;
+
+ char* imgPath;
+ asprintf(&imgPath, "%s/%s/%s", videoBasePath, recordingListDb->getStrValue("PATH"), dirent->d_name);
+
+ tell(0, "%s'found image for '%s' [%s]", fileExists(imgPath) ? "" : "Don't ",
+ recordingListDb->getStrValue("TITLE"), imgPath);
+
+ if (loadFromFile(imgPath, &data) == success)
+ {
+ if (data.size < (unsigned long)imageDb->getField("IMAGE")->getSize())
+ {
+ recordingImagesDb->setValue("IMGID", recordingListDb->getStrValue("IMGID"));
+ recordingImagesDb->setValue("LFN", lfn++);
+ recordingImagesDb->setValue("IMAGE", data.memory, data.size);
+ recordingImagesDb->setValue("TITLE", recordingListDb->getStrValue("TITLE"));
+ recordingImagesDb->setValue("SHORTTEXT", recordingListDb->getStrValue("SHORTTEXT"));
+ recordingImagesDb->store();
+ }
+ }
+
+ free(imgPath);
+ }
+ closedir(dir);
}
recordingImagesDb->reset();
diff --git a/timer.c b/timer.c
index 958bff9..07feffb 100644
--- a/timer.c
+++ b/timer.c
@@ -467,14 +467,31 @@ int cUpdate::takeSwitchTimer()
continue;
}
- // if already in list, ignore
+ // check state, did we have it already?
auto it = switchTimers.find(timerid);
+ // ACTION is delete?
+
+ if (timerDb->hasCharValue("ACTION", taDelete))
+ {
+ if (it != switchTimers.end())
+ switchTimers.erase(it);
+
+ timerDb->setCharValue("ACTION", taAssumed);
+ timerDb->setCharValue("STATE", tsDeleted);
+ timerDb->store();
+ continue;
+ }
+
+ // if already in map, ignore
+
if (it != switchTimers.end())
continue;
- // not in map, create
+ // not in map, create it
+ // independend if ACTION is 'pending', 'create' or 'modify' ore something else
+ // that's special for switch timers since we have to get the 'pending' also after a vdr restart
tell(1, "Got switch timer (%ld) for channel '%s' at '%s'",
timerDb->getIntValue("ID"), timerDb->getStrValue("CHANNELID"),
diff --git a/update.c b/update.c
index eee6ded..275e5f1 100644
--- a/update.c
+++ b/update.c
@@ -663,7 +663,9 @@ int cUpdate::initDb()
selectSwitchTimerActions->build("select ");
selectSwitchTimerActions->bindAllOut();
selectSwitchTimerActions->build(" from %s where ", timerDb->TableName());
- selectSwitchTimerActions->build("%s != '%c'", timerDb->getField("STATE")->getDbName(), tsFinished);
+ selectSwitchTimerActions->build("%s != '%c' and %s != '%c'",
+ timerDb->getField("STATE")->getDbName(), tsFinished,
+ timerDb->getField("STATE")->getDbName(), tsDeleted);
selectSwitchTimerActions->build(" and %s = '%c'", timerDb->getField("TYPE")->getDbName(), ttView);
selectSwitchTimerActions->bind("VDRUUID", cDBS::bndIn | cDBS::bndSet, " and ");