summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--HISTORY.h7
-rw-r--r--configs/epg.dat4
-rw-r--r--lib/db.h4
-rw-r--r--recinfofile.c27
-rw-r--r--recording.c56
-rw-r--r--update.h4
6 files changed, 41 insertions, 61 deletions
diff --git a/HISTORY.h b/HISTORY.h
index eeac719..cd79cf0 100644
--- a/HISTORY.h
+++ b/HISTORY.h
@@ -5,8 +5,8 @@
*
*/
-#define _VERSION "1.1.78"
-#define VERSION_DATE "22.12.2017"
+#define _VERSION "1.1.79"
+#define VERSION_DATE "24.01.2018"
#define DB_API 5
@@ -19,6 +19,9 @@
/*
* ------------------------------------
+2018-01-24 version 1.1.79 (horchi)
+ - change: minor changes, fixes and code cleanup
+
2017-12-22 version 1.1.78 (horchi)
- change: update of recording description handling
diff --git a/configs/epg.dat b/configs/epg.dat
index 2e7958b..1b3884d 100644
--- a/configs/epg.dat
+++ b/configs/epg.dat
@@ -264,6 +264,7 @@ Table vdrs
DBAPI "" dbapi UInt 0 Data,
LASTUPDATE "" lastupd Int 0 Data,
NEXTUPDATE "" nextupd Int 0 Data,
+ LASTMERGE "" lastmerge Int 0 Data,
STATE "" state Ascii 20 Data,
MASTER "" master Ascii 1 Data,
IP "" ip Ascii 20 Data,
@@ -437,7 +438,7 @@ Table useevents
PRODUCER "" sub_producer Text 1000 Data,
OTHER "" sub_other Text 2000 Data,
DIRECTOR "" sub_director Text 1000 Data,
- COMMENTATOR "" sub_commentator Ascii 200 Data,
+ COMMENTATOR "" sub_commentator Ascii 200 Data,
SCREENPLAY "" sub_screenplay Ascii 500 Data,
CAMERA "" sub_camera Text 1000 Data,
MUSIC "" sub_music Ascii 250 Data,
@@ -597,6 +598,7 @@ Table timers
INFO "error reason if state is failed" info Ascii 255 Data,
ACTION "" action Ascii 1 Data default a,
TCCMAILCNT "" tccmailcnt UInt 0 Data,
+ WRNCOUNT "" wrncount UInt 0 Data,
RETRYS "" retrys UInt 0 Data,
NAMINGMODE "" namingmode Int 0 Data,
diff --git a/lib/db.h b/lib/db.h
index d600322..43f820e 100644
--- a/lib/db.h
+++ b/lib/db.h
@@ -730,7 +730,7 @@ class cDbConnection
{
connectDropped = yes;
- tell(0, "Calling mysql_init(%ld)", syscall(__NR_gettid));
+ tell(2, "Calling mysql_init(%ld)", syscall(__NR_gettid));
if (!(mysql = mysql_init(0)))
return errorSql(this, "attachConnection(init)");
@@ -780,7 +780,7 @@ class cDbConnection
{
if (mysql)
{
- tell(0, "Closing mysql connection and calling mysql_thread_end(%ld)", syscall(__NR_gettid));
+ tell(2, "Closing mysql connection and calling mysql_thread_end(%ld)", syscall(__NR_gettid));
mysql_close(mysql);
mysql_thread_end();
diff --git a/recinfofile.c b/recinfofile.c
index 5a29eae..dd9991c 100644
--- a/recinfofile.c
+++ b/recinfofile.c
@@ -55,14 +55,14 @@ const char* cEventDetails::fields[] =
void cEventDetails::setValue(const char* name, const char* value)
{
- std::map<std::string,std::string>::iterator it;
+ // std::map<std::string,std::string>::iterator it;
- it = values.find(name);
+ auto it = values.find(name);
- if (it == values.end() || it->first != value)
+ if (it == values.end() || it->second != value)
{
changes++;
- values[name] = value;
+ values[name] = value ? value : "";
}
}
@@ -77,7 +77,7 @@ void cEventDetails::setValue(const char* name, int value)
int cEventDetails::updateByRow(cDbRow* row)
{
- std::map<std::string,std::string>::iterator it;
+ // std::map<std::string,std::string>::iterator it;
for (int i = 0; fields[i]; i++)
{
@@ -106,7 +106,7 @@ int cEventDetails::updateByRow(cDbRow* row)
continue;
}
- it = values.find(fields[i]);
+ auto it = values.find(fields[i]);
if (it == values.end() || it->second != v)
{
@@ -215,14 +215,17 @@ int cEventDetails::storeToFs(const char* path)
// Load From Fs
//***************************************************************************
-int cEventDetails::loadFromFs(const char* path)
+int cEventDetails::loadFromFs(const char* path, cDbRow* row, int doClear)
{
FILE* f;
char* fileName = 0;
std::map<std::string,std::string>::iterator it;
- values.clear();
- changes = 0;
+ if (doClear)
+ {
+ values.clear();
+ changes = 0;
+ }
asprintf(&fileName, "%s/info.epg2vdr", path);
@@ -259,6 +262,12 @@ int cEventDetails::loadFromFs(const char* path)
*(p++) = 0;
p = skipspace(rTrim(p));
+ if (!row->getTableDef()->getField(s, /*silent*/ yes))
+ {
+ tell(0, "Warning: Ignoring unexpected field '%s' in '%s'", s, fileName);
+ continue;
+ }
+
if (!isEmpty(p))
{
char* value = strdup(p);
diff --git a/recording.c b/recording.c
index 1dfc7bf..6f87ea7 100644
--- a/recording.c
+++ b/recording.c
@@ -169,7 +169,7 @@ int cUpdate::updatePendingRecordingInfoFiles(const cRecordings* recordings)
if (selectEventById->find())
{
- evd.loadFromFs(path.c_str());
+ evd.loadFromFs(path.c_str(), useeventsDb->getRow());
evd.updateByRow(useeventsDb->getRow());
if (evd.getChanges())
@@ -223,7 +223,7 @@ int cUpdate::storeAllRecordingInfoFiles()
asprintf(&path, "%s/%s", videoBasePath, recordingListDb->getStrValue("PATH"));
- evd.loadFromFs(path);
+ evd.loadFromFs(path, recordingListDb->getRow());
evd.updateByRow(recordingListDb->getRow());
if (evd.getChanges())
@@ -275,7 +275,7 @@ int cUpdate::updateRecordingInfoFiles()
if (folderExists(path))
{
- evd.loadFromFs(path);
+ evd.loadFromFs(path, recordingListDb->getRow());
evd.updateByRow(recordingListDb->getRow());
if (evd.getChanges())
@@ -398,28 +398,16 @@ int cUpdate::updateRecordingTable(int fullReload)
#if (defined (APIVERSNUM) && (APIVERSNUM >= 20304))
if (channel)
{
+ cXml xml;
cStateKey schedulesKey;
const cSchedules* schedules = cSchedules::GetSchedulesRead(schedulesKey, 500/*ms*/);
const cSchedule* s = schedules ? (cSchedule*)schedules->GetSchedule(channel) : 0;
const cEvent* event = s ? s->GetEvent(eventId) : 0;
- if (event)
+ if (event && !isEmpty(event->Aux()) && xml.set(event->Aux()) == success)
{
- cXml xml;
-
- if (isEmpty(event->Aux()))
- tell(0, "AUX for '%s' is empty!", title);
-
- if (!isEmpty(event->Aux()) && xml.set(event->Aux()) == success)
- {
- tell(0, "search 'longdescription' for '%s'", title);
-
- if (XMLElement* element = xml.getElementByName("longdescription"))
- {
- tell(0, "found 'longdescription' for '%s'", title);
- longdescription = element->GetText();
- }
- }
+ if (XMLElement* element = xml.getElementByName("longdescription"))
+ longdescription = element->GetText();
}
if (schedules)
@@ -467,39 +455,18 @@ int cUpdate::updateRecordingTable(int fullReload)
cEventDetails evd;
if (channel) evd.setValue("CHANNELNAME", channel->Name());
- evd.loadFromFs(rec->FileName());
+ evd.loadFromFs(rec->FileName(), recordingListDb->getRow(), no);
+
+ tell(0, "CCCC");
evd.updateToRow(recordingListDb->getRow());
+ tell(0, "DDDD");
// any scrap relevand data changed?
if (recordingListDb->getChanges() > baseChanges)
{
- // int isSeries = recordingListDb->hasValue("CATEGORY", "Serie");
- // int changed = no;
-
- // if (isSeries)
- // {
- // if (recordingListDb->getValue("SCRSERIESID")->isEmpty() ||
- // !recordingListDb->hasValue("SCRSERIESEPISODE", recordingListDb->getIntValue("SCRINFOEPISODEID")) ||
- // !recordingListDb->hasValue("SCRSERIESID", recordingListDb->getIntValue("SCRINFOSERIESID")))
- // {
- // changed = yes;
- // }
- // }
- // else
- // {
- // if (recordingListDb->getValue("SCRMOVIEID")->isEmpty() ||
- // !recordingListDb->hasValue("SCRMOVIEID", recordingListDb->getIntValue("SCRINFOMOVIEID")))
- // {
- // changed = yes;
- // }
- // }
-
- // if (changed)
- // {
recordingListDb->setValue("SCRNEW", yes); // force scrap
recordingListDb->setValue("SCRSP", time(0)); // force load from vdr
- // }
}
// don't toggle uuid if already set!
@@ -517,7 +484,6 @@ int cUpdate::updateRecordingTable(int fullReload)
}
count++;
-
recordingListDb->reset();
}
diff --git a/update.h b/update.h
index af90767..aca9a87 100644
--- a/update.h
+++ b/update.h
@@ -75,7 +75,7 @@ class cEventDetails
public:
cEventDetails() { changes = 0; }
- ~cEventDetails() { }
+ ~cEventDetails() {}
int getChanges() { return changes; }
void clearChanges() { changes = 0; }
@@ -84,7 +84,7 @@ class cEventDetails
void setValue(const char* name, int value);
int storeToFs(const char* path);
- int loadFromFs(const char* path);
+ int loadFromFs(const char* path, cDbRow* row, int doClear = yes);
int updateByRow(cDbRow* row);
int updateToRow(cDbRow* row);