summaryrefslogtreecommitdiff
path: root/worker.c
diff options
context:
space:
mode:
Diffstat (limited to 'worker.c')
-rw-r--r--worker.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/worker.c b/worker.c
index 85bbfaa..9344f8f 100644
--- a/worker.c
+++ b/worker.c
@@ -181,15 +181,20 @@ void cTVScraperWorker::CheckRunningTimers(void) {
scrapType type = GetScrapType(event);
if (type == scrapSeries) {
if (!db->SetRecordingSeries((int)event->EventID())) {
- tvdbScraper->Scrap(event, (int)event->EventID());
+ if (ConnectScrapers()) {
+ tvdbScraper->Scrap(event, (int)event->EventID());
+ }
}
} else if (type == scrapMovie) {
if (!db->SetRecordingMovie((int)event->EventID())) {
- moviedbScraper->Scrap(event, (int)event->EventID());
+ if (ConnectScrapers()) {
+ moviedbScraper->Scrap(event, (int)event->EventID());
+ }
}
}
}
}
+ DisconnectScrapers();
}
bool cTVScraperWorker::StartScrapping(void) {
@@ -206,6 +211,7 @@ bool cTVScraperWorker::StartScrapping(void) {
void cTVScraperWorker::Action(void) {
if (!startLoop)
return;
+
mutex.Lock();
dsyslog("tvscraper: waiting %d minutes to start main loop", initSleep / 1000 / 60);
waitCondition.TimedWait(mutex, initSleep);
@@ -220,10 +226,7 @@ void cTVScraperWorker::Action(void) {
DisconnectScrapers();
continue;
}
- if (ConnectScrapers()) {
- CheckRunningTimers();
- DisconnectScrapers();
- }
+ CheckRunningTimers();
if (StartScrapping()) {
dsyslog("tvscraper: start scraping epg");
db->ClearOutdated(movieDir);