summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhorchi <vdr@jwendel.de>2017-12-21 18:02:38 +0100
committerhorchi <vdr@jwendel.de>2017-12-21 18:02:38 +0100
commit6c5b1d1729ddec6b4815e5f4115544e0c9f47ac3 (patch)
tree07ee8c7dbfeb6b74519a7ae376885012fd9df99d
parentfc626c15ac0e98aeec57f92c0b5aa6072a752e2f (diff)
downloadvdr-plugin-epg2vdr-6c5b1d1729ddec6b4815e5f4115544e0c9f47ac3.tar.gz
vdr-plugin-epg2vdr-6c5b1d1729ddec6b4815e5f4115544e0c9f47ac3.tar.bz2
2017-12-21 version 1.1.76 (horchi)\n - change: backward compatibility to vdr 2.2.0 - second try\n - change: g++ 7 porting\n\n1.1.76
-rw-r--r--HISTORY.h6
-rw-r--r--Makefile1
-rw-r--r--configs/epg.dat1
-rw-r--r--epg2vdr.c20
-rw-r--r--lib/Makefile6
-rw-r--r--lib/demo.c94
-rw-r--r--lib/epgservice.h4
-rw-r--r--lib/xml.c8
-rw-r--r--lib/xml.h2
-rw-r--r--recording.c21
10 files changed, 94 insertions, 69 deletions
diff --git a/HISTORY.h b/HISTORY.h
index 2c90dd0..4926e8c 100644
--- a/HISTORY.h
+++ b/HISTORY.h
@@ -5,7 +5,7 @@
*
*/
-#define _VERSION "1.1.75"
+#define _VERSION "1.1.76"
#define VERSION_DATE "21.12.2017"
#define DB_API 4
@@ -19,6 +19,10 @@
/*
* ------------------------------------
+2017-12-21 version 1.1.76 (horchi)
+ - change: backward compatibility to vdr 2.2.0 - second try
+ - change: g++ 7 porting
+
2017-12-21 version 1.1.75 (horchi)
- change: backward compatibility to vdr 2.2.0
diff --git a/Makefile b/Makefile
index 4018bb7..7036cc6 100644
--- a/Makefile
+++ b/Makefile
@@ -120,7 +120,6 @@ hlib:
%.o: %.c
$(doCompile) $(INCLUDES) -o $@ $<
-# $(CXX) $(CXXFLAGS) -c $(DEFINES) $(INCLUDES) -o $@ $<
### Dependencies:
diff --git a/configs/epg.dat b/configs/epg.dat
index c9ca2f2..ecb6076 100644
--- a/configs/epg.dat
+++ b/configs/epg.dat
@@ -501,6 +501,7 @@ Table recordinglist
TITLE "" title Ascii 200 Data,
SHORTTEXT "" shorttext Ascii 300 Data,
LONGDESCRIPTION "" longdescription MText 25000 Data,
+ ORGDESCRIPTION "" orgdescription MText 25000 Data,
DURATION "" duration UInt 0 Data,
FSK "" fsk UInt 1 Data,
diff --git a/epg2vdr.c b/epg2vdr.c
index 7b2e304..341635a 100644
--- a/epg2vdr.c
+++ b/epg2vdr.c
@@ -814,7 +814,7 @@ cString cPluginEPG2VDR::SVDRPCommand(const char* cmd, const char* Option, int &R
bool cPluginEPG2VDR::Service(const char* id, void* data)
{
if (!data)
- return fail;
+ return false;
tell(4, "Service called with '%s', %d/%d", id,
Epg2VdrConfig.replaceScheduleMenu, Epg2VdrConfig.replaceTimerMenu);
@@ -846,7 +846,7 @@ bool cPluginEPG2VDR::Service(const char* id, void* data)
if (!pluginInitialized)
{
tell(2, "Service called but plugin not ready, retry later");
- return fail;
+ return false;
}
if (strcmp(id, "MainMenuHooksPatch-v1.0::osSchedule") == 0 && Epg2VdrConfig.replaceScheduleMenu)
@@ -886,14 +886,10 @@ bool cPluginEPG2VDR::Service(const char* id, void* data)
}
else if (strcmp(id, EPG2VDR_REC_DETAIL_SERVICE) == 0)
{
-#if defined (APIVERSNUM) && (APIVERSNUM >= 20301)
cEpgRecording_Details_Service_V1* rd = (cEpgRecording_Details_Service_V1*)data;
if (rd)
return recordingDetails(rd);
-#else
- return false;
-#endif
}
exitDb();
@@ -943,17 +939,16 @@ int cPluginEPG2VDR::timerService(cEpgTimer_Service_V1* ts)
int cPluginEPG2VDR::recordingDetails(cEpgRecording_Details_Service_V1* rd)
{
+ int found = false;
+
+#if defined (APIVERSNUM) && (APIVERSNUM >= 20301)
const char* videoBasePath = cVideoDirectory::Name();
md5Buf md5path;
const cRecording* recording;
int pathOffset = 0;
-#if defined (APIVERSNUM) && (APIVERSNUM >= 20301)
LOCK_RECORDINGS_READ;
const cRecordings* recordings = Recordings;
-#else
- const cRecordings* recordings = &Recordings;
-#endif
if (!(recording = recordings->GetById(rd->id)))
return false;
@@ -975,7 +970,8 @@ int cPluginEPG2VDR::recordingDetails(cEpgRecording_Details_Service_V1* rd)
recordingListDb->setValue("OWNER", Epg2VdrConfig.useCommonRecFolder ? "" : Epg2VdrConfig.uuid);
cXml xml;
- int found = recordingListDb->find();
+
+ found = recordingListDb->find();
xml.create("epg2vdr");
@@ -986,6 +982,8 @@ int cPluginEPG2VDR::recordingDetails(cEpgRecording_Details_Service_V1* rd)
recordingListDb->reset();
+#endif
+
return found;
}
diff --git a/lib/Makefile b/lib/Makefile
index 5e4f4b3..07c3e36 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -53,10 +53,6 @@ ifdef SYSD_NOTIFY
CFLAGS += $(shell pkg-config --cflags libsystemd-daemon)
endif
-ifdef DEBUG
- CFLAGS += -ggdb -O0
-endif
-
CFLAGS += $(shell mysql_config --include)
DEFINES += $(USES)
@@ -88,7 +84,7 @@ cppchk:
%.o: %.c
@echo Compile "$(*F)" ...
- $(doCompile) $(*F).c -o $@
+ $(doCompile) -O3 $(INCLUDES) -o $@ $<
#--------------------------------------------------------
# dependencies
diff --git a/lib/demo.c b/lib/demo.c
index 0c4c234..347cabf 100644
--- a/lib/demo.c
+++ b/lib/demo.c
@@ -38,13 +38,13 @@ void initConnection()
void exitConnection()
{
cDbConnection::exit();
-
+
if (connection)
delete connection;
}
//***************************************************************************
-//
+//
//***************************************************************************
int demoStatement()
@@ -57,15 +57,15 @@ int demoStatement()
// open table (attach)
- if (eventsDb->open() != success)
+ if (eventsDb->open() != success)
return fail;
-
+
tell(0, "---------------- prepare select statement -------------");
// vorbereiten (prepare) eines statement, am besten einmal bei programmstart!
// ----------
- // select eventid, compshorttext, episodepart, episodelang
- // from events
+ // select eventid, compshorttext, episodepart, episodelang
+ // from events
// where eventid > ?
cDbStatement* selectByCompTitle = new cDbStatement(eventsDb);
@@ -77,14 +77,14 @@ int demoStatement()
status += selectByCompTitle->build(" from %s where ", eventsDb->TableName());
status += selectByCompTitle->bindCmp(0, eventsDb->getField("EventId"), 0, ">");
- status += selectByCompTitle->prepare(); // prepare statement
+ status += selectByCompTitle->prepare(); // prepare statement
if (status != success)
{
// prepare sollte MySQL fehler ausgegeben haben!
delete eventsDb;
- delete selectByCompTitle;
+ delete selectByCompTitle;
return fail;
}
@@ -93,7 +93,7 @@ int demoStatement()
tell(0, "------------------ create some rows ----------------------");
- eventsDb->clear(); // alle values löschen
+ eventsDb->clear(); // alle values löschen
for (int i = 0; i < 10; i++)
{
@@ -103,7 +103,7 @@ int demoStatement()
eventsDb->setValue(eventsDb->getField("EventId"), 800 + i * 100);
eventsDb->setValue(eventsDb->getField("ChannelId"), "xxx-yyyy-zzz");
eventsDb->setValue(eventsDb->getField("Title"), title);
-
+
eventsDb->store(); // store -> select mit anschl. update oder insert je nachdem ob dier PKey bereits vorhanden ist
// eventsDb->insert(); // sofern man schon weiß das es ein insert ist
// eventsDb->update(); // sofern man schon weiß das der Datensatz vorhanden ist
@@ -114,7 +114,7 @@ int demoStatement()
tell(0, "------------------ done ----------------------");
tell(0, "-------- select all where eventid > 1000 -------------");
-
+
eventsDb->clear(); // alle values löschen
eventsDb->setValue(eventsDb->getField("EventId"), 1000);
@@ -148,7 +148,7 @@ int joinDemo()
int status = success;
// grundsätzlich genügt hier auch eine Tabelle, für die anderen sind cDbValue Instanzen außreichend
- // so ist es etwas einfacher die cDbValues zu initialisieren.
+ // so ist es etwas einfacher die cDbValues zu initialisieren.
// Ich habe statische "virtual FieldDef* getFieldDef(int f)" Methode in der Tabellenklassen geplant
// um ohne Instanz der cTable ein Feld einfach initialisieren zu können
@@ -161,7 +161,7 @@ int joinDemo()
delete timerDb;
// init dict fields as needed (normaly done once at programm start)
- // init and using the pointer improve the speed since the lookup via
+ // init and using the pointer improve the speed since the lookup via
// the name is dine only once
// F_INIT(events, EventId); // ergibt: cDbFieldDef* eventsEventId; dbDict.init(eventsEventId, "events", "EventId");
@@ -170,15 +170,15 @@ int joinDemo()
// open tables (attach)
- if (eventsDb->open() != success)
+ if (eventsDb->open() != success)
return fail;
- if (imageDb->open() != success)
+ if (imageDb->open() != success)
return fail;
- if (imageRefDb->open() != success)
+ if (imageRefDb->open() != success)
return fail;
-
+
tell(0, "---------------- prepare select statement -------------");
// all images
@@ -192,13 +192,13 @@ int joinDemo()
cDbValue masterId;
cDbFieldDef imageSizeDef("image", "image", cDBS::ffUInt, 999, cDBS::ftData, 0); // eine Art ein Feld zu erzeugen
- imageSize.setField(&imageSizeDef);
+ imageSize.setField(&imageSizeDef);
imageUpdSp.setField(imageDb->getField("UpdSp"));
masterId.setField(eventsDb->getField("MasterId"));
// select e.masterid, r.imagename, r.eventid, r.lfn, length(i.image)
- // from imagerefs r, images i, events e
- // where i.imagename = r.imagename
+ // from imagerefs r, images i, events e
+ // where i.imagename = r.imagename
// and e.eventid = r.eventid
// and (i.updsp > ? or r.updsp > ?)
@@ -214,10 +214,10 @@ int joinDemo()
selectAllImages->bind(&imageSize, cDBS::bndOut);
selectAllImages->build(")");
selectAllImages->clrBindPrefix();
- selectAllImages->build(" from %s r, %s i, %s e where ",
+ selectAllImages->build(" from %s r, %s i, %s e where ",
imageRefDb->TableName(), imageDb->TableName(), eventsDb->TableName());
selectAllImages->build("e.%s = r.%s and i.%s = r.%s and (",
- "EventId", // eventsEventId->getDbName(),
+ "EventId", // eventsEventId->getDbName(),
imageRefDb->getField("EventId")->getDbName(),
"imagename", // direkt den DB Feldnamen verwenden -> nicht so schön da nicht dynamisch
imageRefDb->getField("ImgName")->getDbName()); // ordentlich via dictionary übersetzt -> schön ;)
@@ -235,7 +235,7 @@ int joinDemo()
delete eventsDb;
delete imageDb;
delete imageRefDb;
- delete selectAllImages;
+ delete selectAllImages;
return fail;
}
@@ -280,7 +280,7 @@ int joinDemo()
}
//***************************************************************************
-//
+//
//***************************************************************************
int insertDemo()
@@ -302,7 +302,7 @@ int insertDemo()
}
//***************************************************************************
-//
+//
//***************************************************************************
int findUseEvent()
@@ -324,7 +324,7 @@ int findUseEvent()
selectEventById->bindAllOut();
selectEventById->build(" from %s where ", useeventsDb->TableName());
selectEventById->bind("USEID", cDBS::bndIn | cDBS::bndSet);
- selectEventById->build(" and %s in (%s)",
+ selectEventById->build(" and %s in (%s)",
useeventsDb->getField("UPDFLG")->getDbName(),
Us::getNeeded());
@@ -390,8 +390,8 @@ int findUseEvent()
continue;
}
- if (field->getFormat() == cDbService::ffAscii ||
- field->getFormat() == cDbService::ffText ||
+ if (field->getFormat() == cDbService::ffAscii ||
+ field->getFormat() == cDbService::ffText ||
field->getFormat() == cDbService::ffMText)
{
fprintf(f, "%s: %s\n", flds[i], useeventsDb->getStrValue(flds[i]));
@@ -411,11 +411,11 @@ int findUseEvent()
selectEventById->freeResult();
- return done;
+ return done;
}
//***************************************************************************
-//
+//
//***************************************************************************
int updateRecordingDirectory()
@@ -428,31 +428,31 @@ int updateRecordingDirectory()
// char* dir = strdup("more~Marvel's Agents of S.H.I.E.L.D.~xxx.ts");
char* dir = strdup("aaaaa~bbbbbb~ccccc.ts");
char* pos = strrchr(dir, '~');
-
+
if (pos)
{
*pos = 0;
-
+
for (int level = 0; level < 3; level++)
{
recordingDirDb->clear();
recordingDirDb->setValue("VDRUUID", "foobar");
recordingDirDb->setValue("DIRECTORY", dir);
-
+
if (!recordingDirDb->find())
{
ins++;
recordingDirDb->store();
}
-
+
recordingDirDb->reset();
-
+
char* pos = strrchr(dir, '~');
if (pos) *pos=0;
}
}
-
+
tell(0, "inserted %d directories", ins);
delete recordingDirDb;
@@ -475,16 +475,6 @@ int main(int argc, char** argv)
if (argc > 1)
path = argv[1];
- // read deictionary
-
- dbDict.setFilterFromNameFct(toFieldFilter);
-
- if (dbDict.in(path, ffEpgd) != success)
- {
- tell(0, "Invalid dictionary configuration, aborting!");
- return 1;
- }
-
cUserTimes userTimes;
tell(0, "--------------");
@@ -508,6 +498,16 @@ int main(int argc, char** argv)
return 0;
+ // read dictionary
+
+ dbDict.setFilterFromNameFct(toFieldFilter);
+
+ if (dbDict.in(path, ffEpgd) != success)
+ {
+ tell(0, "Invalid dictionary configuration, aborting!");
+ return 1;
+ }
+
// dbDict.show();
initConnection();
@@ -519,7 +519,7 @@ int main(int argc, char** argv)
tell(0, "uuid: '%s'", getUniqueId());
tell(0, "- - - - - - - - - - - - - - - - - ");
-
+
//updateRecordingDirectory();
findUseEvent();
diff --git a/lib/epgservice.h b/lib/epgservice.h
index ff32e3a..36d513e 100644
--- a/lib/epgservice.h
+++ b/lib/epgservice.h
@@ -301,7 +301,7 @@ class cUserTimes
if (strchr(strTime, ':'))
{
hhmm = atoi(strTime) * 100 + atoi(strchr(strTime, ':')+1);
- sprintf(hhmmStr, "%02d:%02d", hhmm / 100, hhmm % 100);
+ sprintf(hhmmStr, "%02d%02d", hhmm / 100, hhmm % 100);
mode = mTime;
}
else if (*strTime == '@')
@@ -366,7 +366,7 @@ class cUserTimes
char* title;
char* search;
int hhmm;
- char hhmmStr[5+TB];
+ char hhmmStr[15+TB];
};
cUserTimes()
diff --git a/lib/xml.c b/lib/xml.c
index 2ea13ed..e859f5f 100644
--- a/lib/xml.c
+++ b/lib/xml.c
@@ -89,3 +89,11 @@ XMLElement* cXml::getNext(XMLNode* node)
{
return node->NextSiblingElement();
}
+
+XMLElement* cXml::getElementByName(const char* name, XMLElement* element)
+{
+ if (element)
+ return element->FirstChildElement(name);
+
+ return root->FirstChildElement(name);
+}
diff --git a/lib/xml.h b/lib/xml.h
index c611d74..2c3450a 100644
--- a/lib/xml.h
+++ b/lib/xml.h
@@ -41,6 +41,8 @@ class cXml
XMLElement* getFirst(XMLNode* node = 0);
XMLElement* getNext(XMLNode* node);
+ XMLElement* getElementByName(const char* name, XMLElement* element = 0);
+
const char* toText();
private:
diff --git a/recording.c b/recording.c
index d22205c..04b620e 100644
--- a/recording.c
+++ b/recording.c
@@ -361,6 +361,7 @@ int cUpdate::updateRecordingTable(int fullReload)
int eventId = 0;
std::string channelId = "";
const char* description = "";
+ const char* longdescription = "";
const char* title = rec->Name();
const cRecordingInfo* recInfo = rec->Info();
int pathOffset = 0;
@@ -391,8 +392,21 @@ int cUpdate::updateRecordingTable(int fullReload)
description = recInfo->Description() ? recInfo->Description() : "";
channel = channels->GetByChannelID(recInfo->ChannelID());
- if (recInfo->Title()) title = recInfo->Title();
- if (recInfo->GetEvent()) eventId = recInfo->GetEvent()->EventID();
+ if (recInfo->Title())
+ title = recInfo->Title();
+
+ if (recInfo->GetEvent())
+ {
+ cXml xml;
+
+ eventId = recInfo->GetEvent()->EventID();
+
+ if (!isEmpty(recInfo->GetEvent()->Aux()) && xml.set(recInfo->GetEvent()->Aux()) == success)
+ {
+ if (XMLElement* e = xml.getElementByName("longdescription"))
+ longdescription = e->GetText();
+ }
+ }
}
fsk = isProtected(rec->FileName());
@@ -419,6 +433,9 @@ int cUpdate::updateRecordingTable(int fullReload)
recordingListDb->setValue("CHANNELID", channelId.c_str());
recordingListDb->setValue("FSK", fsk);
+ if (!isEmpty(longdescription))
+ recordingListDb->setValue("ORGDESCRIPTION", longdescription); // since 'LONGDESCRIPTION' already used for 'DESCRIPTION' :(
+
if (channel)
recordingListDb->setValue("CHANNELNAME", channel->Name());