summaryrefslogtreecommitdiff
path: root/update.c
diff options
context:
space:
mode:
Diffstat (limited to 'update.c')
-rw-r--r--update.c24
1 files changed, 18 insertions, 6 deletions
diff --git a/update.c b/update.c
index f79ab68..139f7c0 100644
--- a/update.c
+++ b/update.c
@@ -1808,7 +1808,7 @@ int cEpgd::parseEvent(cDbRow* event, xmlNode* node)
event->getBigintValue("EVENTID"),
event->getStrValue("FILEREF"));
- event->setValue("IMAGECOUNT", imgCnt);
+ event->setValue("IMAGECOUNT", min(imgCnt, EpgdConfig.maximagesperevent));
free(images);
free(imagetype);
@@ -1829,6 +1829,8 @@ int cEpgd::storeImageRefs(tEventId evtId, const char* source, const char* images
char* imagesCsv = strdup(images);
int count = 0;
+ // #TODO limit here to EpgdConfig.maximagesperevent
+
for (char* p = imagesCsv; p && *p; p = next, lfn++)
{
if ((next = strchr(p, ',')))
@@ -2314,9 +2316,6 @@ int cEpgd::scrapNewEvents()
if (seriesCur % 10 == 0)
tell(0, "series episode %d / %d scraped...continuing scraping", seriesCur, seriesTotal);
- if (seriesCur % 50 == 0)
- sleep(1);
-
tvdbManager->ProcessSeries(*it);
if (doShutDown())
@@ -2354,6 +2353,8 @@ int cEpgd::scrapNewEvents()
tell(0, "%d new movies to scrap in db", moviesTotal);
+ time_t sectionStartAt = time(0); // split download in parts of 40
+
for (vector<sMovieResult>::iterator it = moviesToScrap.begin(); it != moviesToScrap.end(); ++it)
{
movieCur++;
@@ -2361,8 +2362,19 @@ int cEpgd::scrapNewEvents()
if (movieCur % 10 == 0)
tell(0, "movie %d / %d scraped...continuing scraping", movieCur, moviesTotal);
- if (movieCur % 50 == 0)
- sleep(1);
+ if (movieCur % 40 == 0)
+ {
+ int duration = time(0) - sectionStartAt;
+
+ if (duration < 10)
+ {
+ duration = 10 - duration;
+ tell(0, "Waiting %d seconds..", duration);
+ sleep(duration);
+ }
+
+ sectionStartAt = time(0);
+ }
movieDbManager->ProcessMovie(*it);