diff --git a/HISTORY.h b/HISTORY.h index cd95686..5e6a732 100644 --- a/HISTORY.h +++ b/HISTORY.h @@ -4,8 +4,8 @@ * ----------------------------------- */ -#define _VERSION "1.3.12" -#define VERSION_DATE "07.02.2023" +#define _VERSION "1.3.13" +#define VERSION_DATE "11.02.2023" #define DB_API 8 #ifdef GIT_REV @@ -17,6 +17,10 @@ /* * ------------------------------------ +2023-02-11: version 1.3.13 (horchi) + - Bugfix: Fixed crash at exit with deactivatet TVDB scraper + - Change: Trigger eplist match for nes external events + 2023-02-07: version 1.3.12 (horchi) - change: Minor code cleanup and log message improvements diff --git a/Makefile b/Makefile index d6d4e4c..a6bc768 100644 --- a/Makefile +++ b/Makefile @@ -48,10 +48,10 @@ endif OBJS += main.o update.o plugin.o epgdconfig.o channelmap.o series.o svdrpclient.o episode.o OBJS += tvdbmanager.o moviedbmanager.o -OBJS += lib/fuzzy.o scraper/thetvdbscraper/thetvdbscraper.o scraper/thetvdbscraper/tvdbv4.o -OBJS += scraper/thetvdbscraper/tvdbseries.o -OBJS += scraper/themoviedbscraper/themoviedbscraper.o scraper/themoviedbscraper/moviedbmovie.o -OBJS += scraper/themoviedbscraper/moviedbactor.o +OBJS += lib/fuzzy.o scraper/tvdbscraper/tvdbscraper.o scraper/tvdbscraper/tvdbv4.o +OBJS += scraper/tvdbscraper/tvdbseries.o +OBJS += scraper/moviedbscraper/themoviedbscraper.o scraper/moviedbscraper/moviedbmovie.o +OBJS += scraper/moviedbscraper/moviedbactor.o HTTPOBJS += epgdconfig.o webstore.o webdo.o webauth.o webtools.o httpd.o svdrpclient.o @@ -79,7 +79,7 @@ lv: clean: clean-plugins @-rm -f $(OBJS) $(HTTPOBJS) core* *~ */*~ *.so - @-rm -f scraper/themoviedbscraper/*~ scraper/themoviedbscraper/*~ scraper/thetvdbscraper/*~ + @-rm -f scraper/moviedbscraper/*~ scraper/moviedbscraper/*~ scraper/tvdbscraper/*~ (cd epglv; $(MAKE) clean) rm -f $(TARGET) $(ARCHIVE).tgz rm -f $(HTTPTARGET) pytst @@ -156,12 +156,12 @@ SCRHEADER = lib/curl.h tvdbmanager.o : $(SCRHEADER) tvdbmanager.h tvdbmanager.c lib/epgservice.h lib/epgservice.c lib/db.h lib/db.c moviedbmanager.o : $(SCRHEADER) moviedbmanager.h moviedbmanager.c lib/epgservice.h lib/epgservice.c lib/db.h lib/db.c -scraper/thetvdbscraper/tvdbv4.o : $(SCRHEADER) scraper/thetvdbscraper/tvdbv4.c scraper/thetvdbscraper/tvdbv4.h -scraper/thetvdbscraper/thetvdbscraper.o : $(SCRHEADER) scraper/thetvdbscraper/thetvdbscraper.h scraper/thetvdbscraper/thetvdbscraper.c scraper/thetvdbscraper/tvdbseries.h -scraper/thetvdbscraper/tvdbseries.o : $(SCRHEADER) scraper/thetvdbscraper/tvdbseries.h scraper/thetvdbscraper/tvdbseries.c -scraper/themoviedbscraper/themoviedbscraper.o : $(SCRHEADER) scraper/themoviedbscraper/themoviedbscraper.h scraper/themoviedbscraper/themoviedbscraper.c scraper/themoviedbscraper/moviedbmovie.h scraper/themoviedbscraper/moviedbactor.h -scraper/themoviedbscraper/moviedbmovie.o : $(SCRHEADER) scraper/themoviedbscraper/moviedbmovie.h scraper/themoviedbscraper/moviedbmovie.c scraper/themoviedbscraper/moviedbactor.h lib/fuzzy.h -scraper/themoviedbscraper/moviedbactors.o : $(SCRHEADER) scraper/themoviedbscraper/moviedbactor.h scraper/themoviedbscraper/moviedbactor.c +scraper/tvdbscraper/tvdbv4.o : $(SCRHEADER) scraper/tvdbscraper/tvdbv4.c scraper/tvdbscraper/tvdbv4.h +scraper/tvdbscraper/tvdbscraper.o : $(SCRHEADER) scraper/tvdbscraper/tvdbscraper.h scraper/tvdbscraper/tvdbscraper.c scraper/tvdbscraper/tvdbseries.h +scraper/tvdbscraper/tvdbseries.o : $(SCRHEADER) scraper/tvdbscraper/tvdbseries.h scraper/tvdbscraper/tvdbseries.c +scraper/moviedbscraper/themoviedbscraper.o : $(SCRHEADER) scraper/moviedbscraper/themoviedbscraper.h scraper/moviedbscraper/themoviedbscraper.c scraper/moviedbscraper/moviedbmovie.h scraper/moviedbscraper/moviedbactor.h +scraper/moviedbscraper/moviedbmovie.o : $(SCRHEADER) scraper/moviedbscraper/moviedbmovie.h scraper/moviedbscraper/moviedbmovie.c scraper/moviedbscraper/moviedbactor.h lib/fuzzy.h +scraper/moviedbscraper/moviedbactors.o : $(SCRHEADER) scraper/moviedbscraper/moviedbactor.h scraper/moviedbscraper/moviedbactor.c lib/fuzzy.o : lib/fuzzy.h lib/fuzzy.c # ------------------------------------------------------ diff --git a/epgd.h b/epgd.h index 8888542..7898e9a 100644 --- a/epgd.h +++ b/epgd.h @@ -99,7 +99,7 @@ class PluginLoader { public: - explicit PluginLoader(const char* name, Plugin* p = 0); + explicit PluginLoader(const char* name, Plugin* p = nullptr); virtual ~PluginLoader(); int load(); diff --git a/moviedbmanager.h b/moviedbmanager.h index ff735fc..3c61f81 100644 --- a/moviedbmanager.h +++ b/moviedbmanager.h @@ -13,9 +13,9 @@ #include "lib/db.h" #include "lib/epgservice.h" -#include "scraper/themoviedbscraper/themoviedbscraper.h" -#include "scraper/themoviedbscraper/moviedbmovie.h" -#include "scraper/themoviedbscraper/moviedbactor.h" +#include "scraper/moviedbscraper/themoviedbscraper.h" +#include "scraper/moviedbscraper/moviedbmovie.h" +#include "scraper/moviedbscraper/moviedbactor.h" #include "epgdconfig.h" diff --git a/scraper/themoviedbscraper/moviedbactor.c b/scraper/moviedbscraper/moviedbactor.c similarity index 100% rename from scraper/themoviedbscraper/moviedbactor.c rename to scraper/moviedbscraper/moviedbactor.c diff --git a/scraper/themoviedbscraper/moviedbactor.h b/scraper/moviedbscraper/moviedbactor.h similarity index 100% rename from scraper/themoviedbscraper/moviedbactor.h rename to scraper/moviedbscraper/moviedbactor.h diff --git a/scraper/themoviedbscraper/moviedbmovie.c b/scraper/moviedbscraper/moviedbmovie.c similarity index 100% rename from scraper/themoviedbscraper/moviedbmovie.c rename to scraper/moviedbscraper/moviedbmovie.c diff --git a/scraper/themoviedbscraper/moviedbmovie.h b/scraper/moviedbscraper/moviedbmovie.h similarity index 100% rename from scraper/themoviedbscraper/moviedbmovie.h rename to scraper/moviedbscraper/moviedbmovie.h diff --git a/scraper/themoviedbscraper/themoviedbscraper.c b/scraper/moviedbscraper/themoviedbscraper.c similarity index 100% rename from scraper/themoviedbscraper/themoviedbscraper.c rename to scraper/moviedbscraper/themoviedbscraper.c diff --git a/scraper/themoviedbscraper/themoviedbscraper.h b/scraper/moviedbscraper/themoviedbscraper.h similarity index 100% rename from scraper/themoviedbscraper/themoviedbscraper.h rename to scraper/moviedbscraper/themoviedbscraper.h diff --git a/scraper/thetvdbscraper/thetvdbscraper.c b/scraper/tvdbscraper/tvdbscraper.c similarity index 96% rename from scraper/thetvdbscraper/thetvdbscraper.c rename to scraper/tvdbscraper/tvdbscraper.c index e6da60f..372bca5 100644 --- a/scraper/thetvdbscraper/thetvdbscraper.c +++ b/scraper/tvdbscraper/tvdbscraper.c @@ -3,7 +3,7 @@ // https://thetvdb.github.io/v4-api/ #include "tvdbv4.h" -#include "thetvdbscraper.h" +#include "tvdbscraper.h" std::map cTVDBScraper::languages = { @@ -159,7 +159,8 @@ int cTVDBScraper::readSeriesId(const char* seriesName) { jSeries = json_array_get(jData, 0); seriesID = atoi(getStringFromJson(jSeries, "tvdb_id", "")); - tell(0, "Series '%s' not found by aliases, using first of (%ld) search results -> (%d)", seriesName, json_array_size(jData), seriesID); + tell(0, "Series '%s' not found by aliases, using first of (%ld) search results -> '%s'(%d)", + seriesName, json_array_size(jData), getStringFromJson(jSeries, "name", ""), seriesID); } json_decref(jResult); diff --git a/scraper/thetvdbscraper/thetvdbscraper.h b/scraper/tvdbscraper/tvdbscraper.h similarity index 89% rename from scraper/thetvdbscraper/thetvdbscraper.h rename to scraper/tvdbscraper/tvdbscraper.h index bffa168..b6f75c0 100644 --- a/scraper/thetvdbscraper/thetvdbscraper.h +++ b/scraper/tvdbscraper/tvdbscraper.h @@ -19,12 +19,6 @@ class cTVDBScraper { public: - // struct EpisodeId - // { - // int seriesId {0}; - // int episodeId {0}; - // }; - explicit cTVDBScraper(std::string language); virtual ~cTVDBScraper(); diff --git a/scraper/thetvdbscraper/tvdbseries.c b/scraper/tvdbscraper/tvdbseries.c similarity index 92% rename from scraper/thetvdbscraper/tvdbseries.c rename to scraper/tvdbscraper/tvdbseries.c index 30d3942..be59789 100644 --- a/scraper/thetvdbscraper/tvdbseries.c +++ b/scraper/tvdbscraper/tvdbseries.c @@ -275,7 +275,7 @@ int cTVDBSeries::parseEpisodes(json_t* jResult) if (!episode.imageUrl.empty() && episode.imageUrl[0] == '/') episode.imageUrl = cTVDBv4::tvdbArtworkUrl + episode.imageUrl; - // readEpisodesExtended(episode); + // readEpisodesExtended(episode); // takes to long :( // lastUpdated - like "2023-01-08 02:21:27", @@ -294,16 +294,22 @@ int cTVDBSeries::parseEpisodesExtended(json_t* jResult, Episode& episode) if (!jData) return 0; + uint n {}; json_t* j = getObjectFromJson(jData, "characters"); json_array_foreach(j, item, jItem) { - // int type = getIntFromJson(jItem, "type"); - // const char* url = getStringFromJson(jItem, "url", ""); - // const char* personName = getStringFromJson(jItem, "personName", ""); - // const char* peopleType = getStringFromJson(jItem, "peopleType", ""); + int type = getIntFromJson(jItem, "type"); + const char* url = getStringFromJson(jItem, "url", ""); + const char* name = getStringFromJson(jItem, "name"); + const char* personName = getStringFromJson(jItem, "personName", ""); + const char* peopleType = getStringFromJson(jItem, "peopleType", ""); + + tell(0, "Additional character (%d/%d): %s/%s as '%s'(%d) [%s]", episode.seriesID, episode.id, name, personName, peopleType, type, url); + n++; } + tell(0, "Got %d Additional characters for series/episode %d/%d", n, episode.seriesID, episode.id); return success; } diff --git a/scraper/thetvdbscraper/tvdbseries.h b/scraper/tvdbscraper/tvdbseries.h similarity index 100% rename from scraper/thetvdbscraper/tvdbseries.h rename to scraper/tvdbscraper/tvdbseries.h diff --git a/scraper/thetvdbscraper/tvdbv4.c b/scraper/tvdbscraper/tvdbv4.c similarity index 100% rename from scraper/thetvdbscraper/tvdbv4.c rename to scraper/tvdbscraper/tvdbv4.c diff --git a/scraper/thetvdbscraper/tvdbv4.h b/scraper/tvdbscraper/tvdbv4.h similarity index 100% rename from scraper/thetvdbscraper/tvdbv4.h rename to scraper/tvdbscraper/tvdbv4.h diff --git a/series.c b/series.c index a067b6a..70e15df 100644 --- a/series.c +++ b/series.c @@ -483,8 +483,8 @@ int cEpgd::updateEpisodes() // start series match - if (!doShutDown()) - evaluateEpisodes(); + // if (!doShutDown()) + // evaluateEpisodes(); } return 0; diff --git a/tvdbmanager.h b/tvdbmanager.h index 0d327a8..5de63bd 100644 --- a/tvdbmanager.h +++ b/tvdbmanager.h @@ -15,8 +15,8 @@ #include "epgdconfig.h" -#include "scraper/thetvdbscraper/thetvdbscraper.h" -#include "scraper/thetvdbscraper/tvdbseries.h" +#include "scraper/tvdbscraper/tvdbscraper.h" +#include "scraper/tvdbscraper/tvdbseries.h" //*************************************************************************** // cTVDBManager diff --git a/update.c b/update.c index c4c5d72..a3fd375 100644 --- a/update.c +++ b/update.c @@ -1446,13 +1446,12 @@ void cEpgd::setState(Es::State state, time_t lastUpdate, int silent) int cEpgd::loadPlugins() { - DIR* dir; - dirent* dp; + DIR* dir {}; + dirent* dp {}; if (!(dir = opendir(EpgdConfig.pluginPath))) { - tell(0, "Error: Opening plugin directory '%s' failed, %s", - EpgdConfig.pluginPath, strerror(errno)); + tell(0, "Error: Opening plugin directory '%s' failed, %s", EpgdConfig.pluginPath, strerror(errno)); return fail; } @@ -1460,12 +1459,10 @@ int cEpgd::loadPlugins() { if (strncmp(dp->d_name, "libepgd-", 8) == 0 && strstr(dp->d_name, ".so")) { - char* path; + char* path {}; asprintf(&path, "%s/%s", EpgdConfig.pluginPath, dp->d_name); - PluginLoader* pl = new PluginLoader(path); - free(path); if (pl->load() != success) @@ -1713,8 +1710,6 @@ void cEpgd::loop() continue; } - // evaluateEpisodes(); // #TODO test call - // the real work ... setState(Es::esBusyEvents); @@ -1734,6 +1729,9 @@ void cEpgd::loop() if (!doShutDown()) updateEpisodes(); // update constabel episodes + if (!doShutDown()) + evaluateEpisodes(); + if (!doShutDown() && procUser) // call user procedure if defined procUser->call(); @@ -2488,7 +2486,8 @@ int cEpgd::initScrapers() void cEpgd::exitScrapers() { - tvdbManager->exitDb(); + if (tvdbManager) + tvdbManager->exitDb(); delete tvdbManager; tvdbManager = nullptr; delete movieDbManager; movieDbManager = nullptr; @@ -2508,8 +2507,6 @@ int cEpgd::scrapNewEvents() time_t start = time(0); - tell(1, "---------------------"); - tvdbManager->ResetBytesDownloaded(); time_t lastTvDvScrap {0}; @@ -2517,6 +2514,8 @@ int cEpgd::scrapNewEvents() if (lastTvDvScrap > 0) { + tell(1, "---------------------"); + if (tvdbManager->updateSeries(lastTvDvScrap) == success) { setParameter("epgd", "lastTvDvScrap", time(0)); @@ -2544,6 +2543,7 @@ int cEpgd::scrapNewEvents() int seriesCur {0}; + tell(1, "---------------------"); tell(1, "Series for %zu new events to scrap", seriesToScrap.size()); // for (auto it = seriesToScrap.begin(); it != seriesToScrap.end(); ++it)