diff options
author | horchi <vdr@jwendel.de> | 2017-03-20 18:02:17 +0100 |
---|---|---|
committer | horchi <vdr@jwendel.de> | 2017-03-20 18:02:17 +0100 |
commit | 42b9898a8a4a07a3134dadce5d24618a0c402fd1 (patch) | |
tree | 6b3837b836873c8bda454778975fe2461bc006fe | |
parent | 9065c5cfb63a92a08c44fe249b53b6a8cb003eab (diff) | |
download | vdr-epg-daemon-42b9898a8a4a07a3134dadce5d24618a0c402fd1.tar.gz vdr-epg-daemon-42b9898a8a4a07a3134dadce5d24618a0c402fd1.tar.bz2 |
2017-03-20: version 1.1.113 (horchi)\n -added: Add validity check of the API key for https://www.themoviedb.org (by 3po)\n - change: Removed compiler warnings when using clang\n - added: Added clang++ to Make.config (as optional compiler)\n\n
-rw-r--r-- | HISTORY.h | 17 | ||||
-rw-r--r-- | Make.config | 35 | ||||
-rw-r--r-- | Makefile | 6 | ||||
-rw-r--r-- | PLUGINS/epgdata/Makefile | 2 | ||||
-rw-r--r-- | PLUGINS/epgdata/epgdata.c | 126 | ||||
-rw-r--r-- | lib/common.c | 2 | ||||
-rw-r--r-- | lib/common.h | 2 | ||||
-rw-r--r-- | lib/curl.c | 12 | ||||
-rw-r--r-- | lib/db.h | 2 | ||||
-rw-r--r-- | lib/searchtimer.c | 2 | ||||
-rw-r--r-- | lib/searchtimer.h | 4 | ||||
-rwxr-xr-x | scripts/epgd-tool | 23 | ||||
-rw-r--r-- | svdrpclient.c | 6 | ||||
-rw-r--r-- | tvdbmanager.c | 4 |
14 files changed, 144 insertions, 99 deletions
@@ -4,8 +4,8 @@ * ----------------------------------- */ -#define _VERSION "1.1.110" -#define VERSION_DATE "16.03.2017" +#define _VERSION "1.1.113" +#define VERSION_DATE "20.03.2017" #define DB_API 4 #ifdef GIT_REV @@ -17,6 +17,19 @@ /* * ------------------------------------ +2017-03-20: version 1.1.113 (horchi) + -added: Add validity check of the API key for https://www.themoviedb.org (by 3po) + - change: Removed compiler warnings when using clang + - added: Added clang++ to Make.config (as optional compiler) + +2017-03-18: version 1.1.112 (horchi) + - bugfix: fixed imagecount value in events table + +2017-03-18: version 1.1.111 (horchi) + - change: modified repeaing timer check statement to handle '' values like null values again + - added: new view eventsview-perlbo.sql + - change: fixed some typos + 2017-03-16: version 1.1.110 (horchi) - added: Congig option for MovieDb api-key diff --git a/Make.config b/Make.config index 7f78843..3d8effd 100644 --- a/Make.config +++ b/Make.config @@ -2,7 +2,6 @@ # # See the README file for copyright information and how to reach the author. # -# # user defined stuff @@ -15,6 +14,7 @@ PLGDEST = $(PREFIX)/lib/epgd/plugins CONFDEST = $(DESTDIR)/etc/epgd HTTPDEST = $(DESTDIR)/var/epgd/www DEBUG = 1 +#USE_CLANG = 1 SYSTEMDDEST = $(DESTDIR)/etc/systemd/system UPSTARTDEST = $(DESTDIR)/etc/init @@ -24,14 +24,15 @@ UPSTARTDEST = $(DESTDIR)/etc/init INIT_SYSTEM = systemd INIT_AFTER = mysql.service -ifeq "$(INIT_SYSTEM)" "systemd" - SYSD_NOTIFY = 1 -endif - # ------------------ # don't touch below -CC = g++ +ifdef USE_CLANG + CC = clang++ +else + CC = g++ +endif + doCompile = $(CC) -c $(CFLAGS) $(DEFINES) doLink = $(CC) $(LFLAGS) doLib = ar -rs @@ -49,6 +50,10 @@ USEWOL = 1 USES = -DUSEUUID -DUSEMD5 -DUSELIBXML -DUSELIBARCHIVE -DUSEJSON -DUSEGUNZIP DEFINES += -D_GNU_SOURCE -DBINDEST='"$(BINDEST)"' -DTARGET='"$(TARGET)"' -DLOG_PREFIX='""' -DPLGDIR='"$(PLGDEST)"' $(USES) +ifeq "$(INIT_SYSTEM)" "systemd" + SYSD_NOTIFY = 1 +endif + ifdef SYSD_NOTIFY SYSTEMD_VERSION_210 := $(shell expr `pkg-config --modversion libsystemd 2>/dev/null || echo 0` \>= 210) SYSTEMD_VERSION_209 := $(shell expr `pkg-config --modversion libsystemd 2>/dev/null || pkg-config --modversion libsystemd-daemon 2>/dev/null || echo "0"` \>= 209) @@ -78,11 +83,19 @@ ifdef DEBUG CFLAGS += -ggdb -fno-stack-protector -O0 endif -CFLAGS += -fPIC -Wextra -Wno-unused-parameter -Wreturn-type -Wall -Wno-parentheses -Wformat -pedantic \ - -Wunused-variable -Wunused-label \ - -Werror=format-security -Wparentheses \ - -Wunused-value -Wunused-function -Wno-long-long \ - -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 +CFLAGS += -fPIC -Wreturn-type -Wall -Wextra -Wparentheses -Wformat -pedantic \ + -Wno-long-long -Wunused-variable -Wunused-label -Wno-unused-result \ + -Wunused-value -Wunused-function -Wno-variadic-macros \ + -Wno-unused-parameter -Werror=format-security \ + -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 + +CFLAGS += -std=c++11 -D__STDC_FORMAT_MACROS + +ifdef USE_CLANG + CFLAGS += -x c++ -Wunused-const-variable +else + CFLAGS += -Wunused-but-set-variable +endif %.o: %.c $(doCompile) -o $@ $< @@ -62,16 +62,16 @@ HTTPOBJS += epgdconfig.o webstore.o webdo.o webauth.o webtools.o httpd.o svdrpcl all: hlib $(TARGET) $(HTTPTARGET) plugins lv eptest: eptest.c episode.c - $(CC) $(CFLAGS) $(DEFINES) eptest.c episode.c svdrpclient.c -L./lib -lhorchi $(DLIBS) -o eptst + $(CC) $(DEFINES) eptest.c episode.c svdrpclient.c -L./lib -lhorchi $(DLIBS) -o eptst hlib: (cd lib && $(MAKE) lib) $(TARGET) : hlib $(OBJS) - $(CC) $(CFLAGS) -rdynamic $(OBJS) $(DLIBS) -o $@ + $(CC) -rdynamic $(OBJS) $(DLIBS) -o $@ $(HTTPTARGET) : hlib $(HTTPOBJS) - $(CC) $(CFLAGS) -rdynamic $(HTTPOBJS) $(HTTPLIBS) -o $@ + $(CC) -rdynamic $(HTTPOBJS) $(HTTPLIBS) -o $@ lv: (cd epglv && $(MAKE)) diff --git a/PLUGINS/epgdata/Makefile b/PLUGINS/epgdata/Makefile index 837c3c1..b10f051 100644 --- a/PLUGINS/epgdata/Makefile +++ b/PLUGINS/epgdata/Makefile @@ -19,7 +19,7 @@ CFLAGS += -I$(EPGD_SRC) all: $(SOFILE) $(SOFILE): $(OBJS) - $(CC) $(CFLAGS) -shared $(OBJS) $(LIBS) -o $@ + $(CC) -shared $(OBJS) $(LIBS) -o $@ install: $(SOFILE) install-config install -D $(SOFILE) $(_PLGDEST)/ diff --git a/PLUGINS/epgdata/epgdata.c b/PLUGINS/epgdata/epgdata.c index 3cf31ef..aca4fcb 100644 --- a/PLUGINS/epgdata/epgdata.c +++ b/PLUGINS/epgdata/epgdata.c @@ -58,7 +58,7 @@ int Epgdata::initDb() // -------- // by fileref (for pictures) - // select name from fileref + // select name from fileref // where source = ? and fileref = ? stmtByFileRef = new cDbStatement(obj->fileDb); @@ -68,12 +68,12 @@ int Epgdata::initDb() stmtByFileRef->build(" from %s where ", obj->fileDb->TableName()); stmtByFileRef->bind("SOURCE", cDBS::bndIn | cDBS::bndSet); stmtByFileRef->bind("FILEREF", cDBS::bndIn | cDBS::bndSet, " and "); - + status += stmtByFileRef->prepare(); // --------------- // (for cleanup double) - // select name from fileref + // select name from fileref // where source = ? order by name desc stmtCleanDouble = new cDbStatement(obj->fileDb); @@ -83,11 +83,11 @@ int Epgdata::initDb() stmtCleanDouble->build(" from %s where ", obj->fileDb->TableName()); stmtCleanDouble->bind("SOURCE", cDBS::bndIn | cDBS::bndSet); stmtCleanDouble->build(" order by name desc"); - + status += stmtCleanDouble->prepare(); // --------- - // select channelid, merge, mergesp from channelmap + // select channelid, merge, mergesp from channelmap // where source = ? and extid = ? selectId = new cDbStatement(obj->mapDb); @@ -99,12 +99,12 @@ int Epgdata::initDb() selectId->build(" from %s where ", obj->mapDb->TableName()); selectId->bind("SOURCE", cDBS::bndIn | cDBS::bndSet); selectId->bind("EXTERNALID", cDBS::bndIn | cDBS::bndSet, " and "); - + status += selectId->prepare(); // --------- // select name, tag from filerf - // where source = 'epgdata' + // where source = 'epgdata' // and name like ? valueName.setField(obj->fileDb->getField("NAME")); @@ -115,7 +115,7 @@ int Epgdata::initDb() selectByDate->build("select "); selectByDate->bind(&valueName, cDBS::bndOut); selectByDate->bind("FILEREF", cDBS::bndOut, ", "); - selectByDate->build(" from %s where source = '%s' and ", + selectByDate->build(" from %s where source = '%s' and ", obj->fileDb->TableName(), getSource()); selectByDate->bindCmp(0, &valueNameLike, "like"); @@ -123,13 +123,13 @@ int Epgdata::initDb() // // -------- // // update events set delflg = ?, updflg = ?, fileref = ?, updsp = ? -// // where fileref = ? +// // where fileref = ? // // and source = ?; // // and updflg in (....) // valueFileRef.setField(obj->eventsDb->getField("FileRef")); // stmtSetDelByFileref = new cDbStatement(obj->eventsDb); - + // stmtSetDelByFileref->build("update %s set ", obj->eventsDb->TableName()); // stmtSetDelByFileref->bind("DelFlg", cDbService::bndIn |cDbService:: bndSet); // stmtSetDelByFileref->bind("UpdFlg", cDbService::bndIn |cDbService:: bndSet, ", "); @@ -143,8 +143,8 @@ int Epgdata::initDb() // status += stmtSetDelByFileref->prepare(); // ---------- - // update events - // set updflg = case when updflg in (...) then 'D' else updflg end, + // update events + // set updflg = case when updflg in (...) then 'D' else updflg end, // delflg = 'Y', // updsp = unix_timestamp() // where source = '...' @@ -158,7 +158,7 @@ int Epgdata::initDb() stmtMarkOldEvents->build(" where source = '%s'", getSource()); stmtMarkOldEvents->build(" and (source, fileref) not in (select source,fileref from fileref)"); - status += stmtMarkOldEvents->prepare(); + status += stmtMarkOldEvents->prepare(); // ---------- // if no epgdata entry in fileref read files from FS to table @@ -198,7 +198,7 @@ int Epgdata::initDb() asprintf(&tag, "%ld", sb.st_size); asprintf(&fileRef, "%s-%s", dp->d_name, tag); - + // store file and let tag NULL to indicate that processing is needed obj->fileDb->clear(); @@ -207,7 +207,7 @@ int Epgdata::initDb() obj->fileDb->setValue("EXTERNALID", "0"); obj->fileDb->setValue("FILEREF", fileRef); obj->fileDb->store(); - + tell(1, "Added '%s' to table fileref", dp->d_name); free(fileRef); free(tag); @@ -250,8 +250,8 @@ int Epgdata::atConfigItem(const char* Name, const char* Value) // Ready //*************************************************************************** -int Epgdata::ready() -{ +int Epgdata::ready() +{ static int count = na; if (isEmpty(pin)) @@ -312,8 +312,8 @@ int Epgdata::processDay(int day, int fullupdate, Statistic* statistic) if (status != success || isEmpty(data.name)) { - tell(1, "Download header for day (%d) at '%s' failed, aborting, got name '%s', status was %d", - day, logurl, data.name ? data.name : "", status); + tell(1, "Download header for day (%d) at '%s' failed, aborting, got name '%s', status was %d", + day, logurl, data.name, status); status = fail; goto Exit; } @@ -324,7 +324,7 @@ int Epgdata::processDay(int day, int fullupdate, Statistic* statistic) asprintf(&path, "%s/%s", directory, data.name); // lookup file - + obj->fileDb->clear(); obj->fileDb->setValue("NAME", data.name); obj->fileDb->setValue("SOURCE", getSource()); @@ -336,8 +336,8 @@ int Epgdata::processDay(int day, int fullupdate, Statistic* statistic) asprintf(&like, "%.8s_%%", data.name); valueNameLike.setValue(like); free(like); - - // check for update + + // check for update if (selectByDate->find()) { @@ -348,7 +348,7 @@ int Epgdata::processDay(int day, int fullupdate, Statistic* statistic) if (haveOneForThisDay && day >= EpgdConfig.upddays) { // don't check for update of existing files more than 'upddays' in the future - + tell(2, "Skipping update check of file '%s' for day %d", data.name, day); statistic->nonUpdates++; @@ -375,7 +375,7 @@ int Epgdata::processDay(int day, int fullupdate, Statistic* statistic) if (!load && fileExists(fspath)) { tell(1, "File '%s' exist, loading from filesystem", fspath); - + obj->loadFromFs(&data, valueName.getStrValue(), getSource()); free(fileRef); @@ -393,9 +393,9 @@ int Epgdata::processDay(int day, int fullupdate, Statistic* statistic) if (load) { tell(0, "Download file: '%s' to '%s", logurl, data.name); - + data.clear(); - + if (obj->downloadFile(url, fileSize, &data, timeout) != success) { tell(0, "Download of day (%d) from '%s' failed", day, logurl); @@ -407,36 +407,36 @@ int Epgdata::processDay(int day, int fullupdate, Statistic* statistic) statistic->files++; // store zip to FS - - obj->storeToFs(&data, data.name, getSource()); + + obj->storeToFs(&data, data.name, getSource()); } if (data.isEmpty()) goto Exit; // unzip ... - + uzdata.clear(); - + if (unzip(path, /*filter*/ ".xml", uzdata.memory, bSize, entryName) == success) { - tell(0, "Processing file '%s' for day %d (%d/%d)", + tell(0, "Processing file '%s' for day %d (%d/%d)", fileRef, day, haveOneForThisDay, load); uzdata.size = bSize; - + // store ? - + if (EpgdConfig.storeXmlToFs) obj->storeToFs(&uzdata, entryName, getSource()); - + // process file .. - + obj->connection->startTransaction(); - + if ((status = processFile(uzdata.memory, uzdata.size, fileRef)) != success) statistic->rejected++; - + if (!obj->dbConnected()) { status = fail; @@ -449,9 +449,9 @@ int Epgdata::processDay(int day, int fullupdate, Statistic* statistic) // { // // mark 'old' entrys in events table as deleted // // and 'fake' fileref to new to avoid deletion at cleanup - + // tell(0, "Removing events of fileref '%s' for day %d", oldFileRef, day); - + // obj->eventsDb->clear(); // obj->eventsDb->setValue("DelFlg", "Y"); // obj->eventsDb->setValue("UpdFlg", "D"); @@ -461,19 +461,19 @@ int Epgdata::processDay(int day, int fullupdate, Statistic* statistic) // valueFileRef.setValue(oldFileRef); // old fileref // stmtSetDelByFileref->execute(); // } - + // Confirm processing of file - + obj->fileDb->setValue("EXTERNALID", "0"); obj->fileDb->setValue("TAG", data.tag); obj->fileDb->setValue("FILEREF", fileRef); obj->fileDb->store(); - + obj->connection->commit(); } Exit: - + // free(oldFileRef); obj->fileDb->reset(); selectByDate->freeResult(); @@ -509,7 +509,7 @@ int Epgdata::processFile(const char* data, int size, const char* fileRef) tell(0, "Invalid xml document returned from xslt for '%s', ignoring", fileRef); return fail; } - + // DEBUG: xmlSaveFile("/tmp/test.xml", transformedDoc); for (xmlNodePtr node = xmlRoot->xmlChildrenNode; node && obj->dbConnected(); node = node->next) @@ -517,25 +517,25 @@ int Epgdata::processFile(const char* data, int size, const char* fileRef) char* prop = 0; tEventId eventid; char* extid = 0; - + // skip all unexpected elements - + if (node->type != XML_ELEMENT_NODE || strcmp((char*)node->name, "event") != 0) continue; - + // get/check eventid - + if (!(prop = (char*)xmlGetProp(node, (xmlChar*)"id")) || !*prop || !(eventid = atoll(prop))) { xmlFree(prop); tell(0, "Missing event id, ignoring!"); continue; } - + xmlFree(prop); // get/check provider id - + if (!(prop = (char*)xmlGetProp(node, (xmlChar*)"provid")) || !*prop || !atoi(prop)) { xmlFree(prop); @@ -555,9 +555,9 @@ int Epgdata::processFile(const char* data, int size, const char* fileRef) { int insert; const char* channelId = obj->mapDb->getStrValue("CHANNELID"); - + // create event .. - + obj->eventsDb->clear(); obj->eventsDb->setBigintValue("EVENTID", eventid); obj->eventsDb->setValue("CHANNELID", channelId); @@ -578,7 +578,7 @@ int Epgdata::processFile(const char* data, int size, const char* fileRef) int merge = obj->mapDb->getIntValue("MERGE"); // store .. - + if (insert) { // handle insert @@ -643,7 +643,7 @@ int Epgdata::getPicture(const char* imagename, const char* fileRef, MemoryStruct obj->fileDb->setValue("SOURCE", getSource()); if (stmtByFileRef->find()) - asprintf(&path, "%s/epgdata/%s", EpgdConfig.cachePath, + asprintf(&path, "%s/epgdata/%s", EpgdConfig.cachePath, obj->fileDb->getStrValue("Name")); stmtByFileRef->freeResult(); @@ -669,16 +669,16 @@ int Epgdata::getPicture(const char* imagename, const char* fileRef, MemoryStruct int Epgdata::cleanupAfter() { const char* ext = ".zip"; - struct dirent* dirent; + struct dirent* dirent; DIR* dir; char* pdir; int count = 0; char* last = 0; - // cleanup *.zip in FS cache ... + // cleanup *.zip in FS cache ... // remove old versions for each day - + obj->fileDb->clear(); obj->fileDb->setValue("SOURCE", getSource()); @@ -694,17 +694,17 @@ int Epgdata::cleanupAfter() obj->fileDb->deleteWhere("%s", where); free(where); } - + free(last); last = strdup(name); } - + free(last); stmtCleanDouble->freeResult(); // mark wasted events (delflg, ...) - stmtMarkOldEvents->execute(); + stmtMarkOldEvents->execute(); // cleanup filesystem, remove files which not referenced in table @@ -721,7 +721,7 @@ int Epgdata::cleanupAfter() tell(1, "Starting cleanup of epgdata zip's in '%s'", pdir); free(pdir); - + while ((dirent = readdir(dir))) { // check extension @@ -730,7 +730,7 @@ int Epgdata::cleanupAfter() continue; // lookup file - + obj->fileDb->clear(); obj->fileDb->setValue("NAME", dirent->d_name); obj->fileDb->setValue("SOURCE", getSource()); @@ -741,7 +741,7 @@ int Epgdata::cleanupAfter() if (!removeFile(pdir)) count++; - + free(pdir); } diff --git a/lib/common.c b/lib/common.c index 8a0e9ac..9207083 100644 --- a/lib/common.c +++ b/lib/common.c @@ -1443,7 +1443,7 @@ const char* getMacOf(const char* device) int s; s = socket(AF_INET, SOCK_DGRAM, 0); - strcpy(ifr.ifr_name, "eth0"); + strcpy(ifr.ifr_name, device); ioctl(s, SIOCGIFHWADDR, &ifr); for (int i = 0; i < macTuppel; i++) diff --git a/lib/common.h b/lib/common.h index df1c236..b488783 100644 --- a/lib/common.h +++ b/lib/common.h @@ -133,7 +133,7 @@ int gunzip(MemoryStruct* zippedData, MemoryStruct* unzippedData); // MemoryStruct //*************************************************************************** -struct MemoryStruct +class MemoryStruct { public: @@ -24,16 +24,16 @@ cSystemNotification* cCurl::sysNotification = 0; size_t collect_data(void *ptr, size_t size, size_t nmemb, void* stream) { std::string sTmp; - register size_t actualsize = size * nmemb; + size_t actualsize = size * nmemb; - if ((FILE *)stream == NULL) + if (!stream) { - sTmp.assign((char *)ptr, actualsize); + sTmp.assign((char*)ptr, actualsize); cCurl::sBuf += sTmp; } else { - fwrite(ptr, size, nmemb, (FILE *)stream); + fwrite(ptr, size, nmemb, (FILE*)stream); } return actualsize; @@ -309,7 +309,7 @@ void cCurl::Free(char* str) size_t cCurl::WriteMemoryCallback(void* ptr, size_t size, size_t nmemb, void* data) { size_t realsize = size * nmemb; - struct MemoryStruct* mem = (struct MemoryStruct*)data; + MemoryStruct* mem = (MemoryStruct*)data; if (sysNotification) sysNotification->check(); @@ -332,7 +332,7 @@ size_t cCurl::WriteMemoryCallback(void* ptr, size_t size, size_t nmemb, void* da size_t cCurl::WriteHeaderCallback(char* ptr, size_t size, size_t nmemb, void* data) { size_t realsize = size * nmemb; - struct MemoryStruct* mem = (struct MemoryStruct*)data; + MemoryStruct* mem = (MemoryStruct*)data; char* p; if (sysNotification) @@ -1052,7 +1052,7 @@ class cDbConnection MYSQL* mysql; - int initialized; + // int initialized; int attached; int inTact; int connectDropped; diff --git a/lib/searchtimer.c b/lib/searchtimer.c index b516359..cfe69e4 100644 --- a/lib/searchtimer.c +++ b/lib/searchtimer.c @@ -774,7 +774,7 @@ int cSearchTimer::checkTimers() { // if difference < 2 minutes adjust silent - if (abs(timerDb->getIntValue("_STARTTIME") - useeventsDb->getIntValue("STARTTIME")) > 2*tmeSecondsPerMinute) + if (std::abs(timerDb->getIntValue("_STARTTIME") - useeventsDb->getIntValue("STARTTIME")) > 2*tmeSecondsPerMinute) parent->message(0, 'I', "EPGD: Timer action", "Info: Starttime of event (%ld) '%s' changed from '%s' to '%s', updating timer (%ld)", timerDb->getIntValue("EVENTID"), useeventsDb->getStrValue("TITLE"), l2pTime(timerDb->getIntValue("_STARTTIME")).c_str(), l2pTime(useeventsDb->getIntValue("STARTTIME")).c_str(), diff --git a/lib/searchtimer.h b/lib/searchtimer.h index f4c072c..92fffc8 100644 --- a/lib/searchtimer.h +++ b/lib/searchtimer.h @@ -79,7 +79,7 @@ class cSearchTimer cDbTable* timerDb; cDbTable* mapDb; cDbTable* vdrDb; - cDbTable* messageDb; + // cDbTable* messageDb; cDbStatement* selectChannelFromMap; cDbStatement* selectDoneTimer; @@ -87,7 +87,7 @@ class cSearchTimer cDbStatement* selectSearchtimerMaxModSp; cDbStatement* selectSearchTimerByName; cDbStatement* selectSearchTimerById; - cDbStatement* selectActiveVdrs; + // cDbStatement* selectActiveVdrs; cDbStatement* selectAllTimer; cDbStatement* selectRPTimerByEvent; cDbStatement* selectTimerByEventId; diff --git a/scripts/epgd-tool b/scripts/epgd-tool index 11987a9..5edcb91 100755 --- a/scripts/epgd-tool +++ b/scripts/epgd-tool @@ -2,7 +2,7 @@ # MySQL helper script by 3PO -# Update 26.02.2017 +# Update 19.03.2017 PASSWORD="" @@ -10,6 +10,8 @@ HOST="" MY_CNF="/etc/mysql/my.cnf" MY_DB_SV="mysqld" TMPFILE="/tmp/.epgtool" +EPGD_CONF="/etc/epgd/epgd.conf" + DISTRI="$(grep "^NAME=" /etc/os-release |cut -d "=" -f2 | sed -e "s/\"//g")" RELEASE="$(grep "^VERSION_ID=" /etc/os-release |cut -d "=" -f2 | sed -e "s/\"//g")" @@ -286,11 +288,27 @@ case $1 in YES_NO ;; + -apikey|apikey) + if [ ! -f "$EPGD_CONF" ] ; then + echo -e "\n $EPGD_CONF -> File not found!\n" + exit + fi + APIKEY="$(grep ScrapMovieDbApiKey "$EPGD_CONF" |sed -e 's/ //g' |cut -d "=" -f2)" + TMDBAPIURL="https://api.themoviedb.org/3/movie/550?" + + if [ "$(curl -s "$TMDBAPIURL"api_key="$APIKEY" | grep '\"status_code\":7')" ] ; then + echo -e "\n Invalid API key: You must be granted a valid key\n" + else + echo -e "\n Your API key is valid: -> '$APIKEY'\n" + fi + ;; + + *) echo "" echo " MySQL helper script by 3PO" echo "" - echo " usage: [-new-db] [-new-u] [-del-db] [-del-u] [ -del-all] [-show] [-fix-cnf] [-dropview] [-drop-all] [-drop-pics] [-check-events] [-check-pic] [-show-stats] [-show-size]" + echo " usage: [-new-db] [-new-u] [-del-db] [-del-u] [ -del-all] [-show] [-fix-cnf] [-dropview] [-drop-all] [-drop-pics] [-check-events] [-check-pic] [-show-stats] [-show-size] [-apikey]" echo "" echo " -new-db Create new Database for epg2vdr" echo " -new-u Create new User for epg2vdr" @@ -306,6 +324,7 @@ case $1 in echo " -check-pic Shows quantity of EPG Pictures stored in Database" echo " -show-stats Shows the Stats and Versions of EPGd and the connected VDRs" echo " -show-size Shows the Size of the Tables in the epg2vdr Database" + echo " -apikey Checks the validity of the API key for https://www.themoviedb.org" echo "" exit ;; diff --git a/svdrpclient.c b/svdrpclient.c index 737330e..86a078c 100644 --- a/svdrpclient.c +++ b/svdrpclient.c @@ -449,7 +449,7 @@ int cSvdrpClient::connect() { if (errno != EINPROGRESS) { - tell(0, "Error: SVDRPCL: connect to %s:%hu failed: %s", ip, port, strerror(errno)); + tell(0, "Error: SVDRPCL: connect to %s:%d failed: %s", ip, port, strerror(errno)); return fail; } @@ -490,7 +490,7 @@ int cSvdrpClient::connect() if (result != 0) { - tell(0, "Error: SVDRPCL: Cconnecting to '%s:%hu' %s failed", ip, port, strerror(errno)); + tell(0, "Error: SVDRPCL: Cconnecting to '%s:%d' %s failed", ip, port, strerror(errno)); ::close(sock); return fail; @@ -533,7 +533,7 @@ int cSvdrpClient::open() if (greeting.First() && greeting.First()->Text()) msg = greeting.First()->Text(); - tell(2, "SVDRPCL: connected to %s:%hu '%s'", ip, port, msg); + tell(2, "SVDRPCL: connected to %s:%d '%s'", ip, port, msg); return success; } diff --git a/tvdbmanager.c b/tvdbmanager.c index ecb134c..7f047fe 100644 --- a/tvdbmanager.c +++ b/tvdbmanager.c @@ -133,7 +133,7 @@ void cTVDBManager::UpdateSeries(void) { tell(0, "%ld updated Series, %ld updatedEpisodes", updatedSeries.size(), updatedEpisodes.size()); tell(0, "%ld series to update in db, %ld episodes to update in db", scrapSeriesIDs.size(), scrapEpisodeIDs.size()); int seriesCur = 1; - for (set<int>::iterator it = scrapSeriesIDs.begin(); !cEpgd::doShutDown && it != scrapSeriesIDs.end(); it++) { + for (set<int>::iterator it = scrapSeriesIDs.begin(); !cEpgd::doShutDown() && it != scrapSeriesIDs.end(); it++) { if (seriesCur%10 == 0) tell(0, "ReScraped %d series...continuing rescraping", seriesCur); cTVDBSeries *series = ScrapSeries(*it); @@ -147,7 +147,7 @@ void cTVDBManager::UpdateSeries(void) { tell(0, "ReScraped %d series", seriesCur-1); int episodeCur = 1; - for (set<int>::iterator it = scrapEpisodeIDs.begin(); !cEpgd::doShutDown && it != scrapEpisodeIDs.end(); it++) { + for (set<int>::iterator it = scrapEpisodeIDs.begin(); !cEpgd::doShutDown() && it != scrapEpisodeIDs.end(); it++) { if (episodeCur%10 == 0) tell(0, "ReScraped %d Episodes...continuing rescraping", episodeCur); cTVDBEpisode *episode = tvdbScraper->GetEpisode(*it); |