Skip to content

Commit

Permalink
2023-02-11: version 1.3.13 (horchi)\n - Bugfix: Fixed crash at exit w…
Browse files Browse the repository at this point in the history
…ith deactivatet TVDB scraper\n - Change: Trigger eplist match for nes external events\n\n
  • Loading branch information
horchi committed Feb 11, 2023
1 parent 7d8651a commit 6119324
Show file tree
Hide file tree
Showing 19 changed files with 51 additions and 46 deletions.
8 changes: 6 additions & 2 deletions HISTORY.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
22 changes: 11 additions & 11 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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

# ------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion epgd.h
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
6 changes: 3 additions & 3 deletions moviedbmanager.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// https://thetvdb.github.io/v4-api/

#include "tvdbv4.h"
#include "thetvdbscraper.h"
#include "tvdbscraper.h"

std::map<std::string,std::string> cTVDBScraper::languages =
{
Expand Down Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,6 @@ class cTVDBScraper
{
public:

// struct EpisodeId
// {
// int seriesId {0};
// int episodeId {0};
// };

explicit cTVDBScraper(std::string language);
virtual ~cTVDBScraper();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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",

Expand All @@ -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;
}

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions series.c
Original file line number Diff line number Diff line change
Expand Up @@ -483,8 +483,8 @@ int cEpgd::updateEpisodes()

// start series match

if (!doShutDown())
evaluateEpisodes();
// if (!doShutDown())
// evaluateEpisodes();
}

return 0;
Expand Down
4 changes: 2 additions & 2 deletions tvdbmanager.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
24 changes: 12 additions & 12 deletions update.c
Original file line number Diff line number Diff line change
Expand Up @@ -1446,26 +1446,23 @@ 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;
}

while ((dp = readdir(dir)))
{
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)
Expand Down Expand Up @@ -1713,8 +1710,6 @@ void cEpgd::loop()
continue;
}

// evaluateEpisodes(); // #TODO test call

// the real work ...

setState(Es::esBusyEvents);
Expand All @@ -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();

Expand Down Expand Up @@ -2488,7 +2486,8 @@ int cEpgd::initScrapers()

void cEpgd::exitScrapers()
{
tvdbManager->exitDb();
if (tvdbManager)
tvdbManager->exitDb();

delete tvdbManager; tvdbManager = nullptr;
delete movieDbManager; movieDbManager = nullptr;
Expand All @@ -2508,15 +2507,15 @@ int cEpgd::scrapNewEvents()

time_t start = time(0);

tell(1, "---------------------");

tvdbManager->ResetBytesDownloaded();

time_t lastTvDvScrap {0};
getParameter("epgd", "lastTvDvScrap", lastTvDvScrap);

if (lastTvDvScrap > 0)
{
tell(1, "---------------------");

if (tvdbManager->updateSeries(lastTvDvScrap) == success)
{
setParameter("epgd", "lastTvDvScrap", time(0));
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 6119324

Please sign in to comment.