summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhorchi <vdr@jwendel.de>2017-03-18 11:56:16 +0100
committerhorchi <vdr@jwendel.de>2017-03-18 11:56:16 +0100
commit3d410346bfd642e152453c898c8d98b4b7a4800d (patch)
treecf460b83edcfaab780cbcb16ce478d81389e5695
parent48392aab9ed36c389db18fb95e230d3eed08f18c (diff)
downloadvdr-epg-daemon-3d410346bfd642e152453c898c8d98b4b7a4800d.tar.gz
vdr-epg-daemon-3d410346bfd642e152453c898c8d98b4b7a4800d.tar.bz2
added dynamic pause hadling for scraper movie download
-rw-r--r--lib/searchtimer.c2
-rw-r--r--update.c20
2 files changed, 16 insertions, 6 deletions
diff --git a/lib/searchtimer.c b/lib/searchtimer.c
index e9081fb..50861f3 100644
--- a/lib/searchtimer.c
+++ b/lib/searchtimer.c
@@ -690,7 +690,7 @@ int cSearchTimer::checkTimers()
{
int count = 0;
- tell(1, "Checking timers against actual epg and serarchtimer settings");
+ tell(1, "Checking timers against actual epg and searchtimer settings");
if (checkConnection() != success)
return 0;
diff --git a/update.c b/update.c
index b0d61be..139f7c0 100644
--- a/update.c
+++ b/update.c
@@ -2316,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())
@@ -2356,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++;
@@ -2363,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);