diff options
author | Johann Friedrichs <johann.friedrichs@web.de> | 2018-03-21 12:14:55 +0100 |
---|---|---|
committer | Johann Friedrichs <johann.friedrichs@web.de> | 2018-03-21 12:14:55 +0100 |
commit | e8a0e569152c50d6084f252d12854b8fd4e74466 (patch) | |
tree | 5a90ef7ea08ff2096df157ca109c5268cdc04903 /recstatus.c | |
parent | 9c7d95ff8d6ba965cb23147507a859b1fd0491d6 (diff) | |
download | vdr-plugin-epgsearch-e8a0e569152c50d6084f252d12854b8fd4e74466.tar.gz vdr-plugin-epgsearch-e8a0e569152c50d6084f252d12854b8fd4e74466.tar.bz2 |
unified indentation
Diffstat (limited to 'recstatus.c')
-rw-r--r-- | recstatus.c | 134 |
1 files changed, 62 insertions, 72 deletions
diff --git a/recstatus.c b/recstatus.c index 20a31a6..408f159 100644 --- a/recstatus.c +++ b/recstatus.c @@ -41,82 +41,72 @@ cRecStatusMonitor::cRecStatusMonitor() void cRecStatusMonitor::Recording(const cDevice *Device, const char *Name, const char* Filename, bool On) { - time_t now = time(NULL); - // insert new timers currently recording in TimersRecording - if (On && Name) - { - if (EPGSearchConfig.checkTimerConflOnRecording) - cConflictCheckThread::Init((cPluginEpgsearch*)cPluginManager::GetPlugin("epgsearch"), true); - - LOCK_TIMERS_READ; - for (const cTimer *ti = Timers->First(); ti; ti = Timers->Next(ti)) - if (ti->Recording()) - { - // check if this is a new entry - cRecDoneTimerObj *tiRFound = NULL; - cMutexLock TimersRecordingLock(&TimersRecording); - for (cRecDoneTimerObj *tiR = TimersRecording.First(); tiR; tiR = TimersRecording.Next(tiR)) - if (tiR->timer == ti) - { - tiRFound = tiR; - break; - } - - if (tiRFound) // already handled, perhaps a resume - { - if (tiRFound->lastBreak > 0 && now - tiRFound->lastBreak <= ALLOWED_BREAK_INSECS) - { - LogFile.Log(1,"accepting resume of '%s' on device %d", Name, Device->CardIndex()); - tiRFound->lastBreak = 0; - } - continue; + time_t now = time(NULL); + // insert new timers currently recording in TimersRecording + if (On && Name) { + if (EPGSearchConfig.checkTimerConflOnRecording) + cConflictCheckThread::Init((cPluginEpgsearch*)cPluginManager::GetPlugin("epgsearch"), true); + + LOCK_TIMERS_READ; + for (const cTimer *ti = Timers->First(); ti; ti = Timers->Next(ti)) + if (ti->Recording()) { + // check if this is a new entry + cRecDoneTimerObj *tiRFound = NULL; + cMutexLock TimersRecordingLock(&TimersRecording); + for (cRecDoneTimerObj *tiR = TimersRecording.First(); tiR; tiR = TimersRecording.Next(tiR)) + if (tiR->timer == ti) { + tiRFound = tiR; + break; + } + + if (tiRFound) { // already handled, perhaps a resume + if (tiRFound->lastBreak > 0 && now - tiRFound->lastBreak <= ALLOWED_BREAK_INSECS) { + LogFile.Log(1, "accepting resume of '%s' on device %d", Name, Device->CardIndex()); + tiRFound->lastBreak = 0; + } + continue; + } + + cRecDoneTimerObj* timerObj = new cRecDoneTimerObj(ti, Device->DeviceNumber()); + TimersRecording.Add(timerObj); + + cSearchExt* search = TriggeredFromSearchTimer(ti); + if (!search || (search->avoidRepeats == 0 && search->delMode == 0)) // ignore if not avoid repeats and no auto-delete + continue; + + bool vpsUsed = ti->HasFlags(tfVps) && ti->Event() && ti->Event()->Vps(); + LogFile.Log(1, "recording started '%s' on device %d (search timer '%s'); VPS used: %s", Name, Device->CardIndex(), search->search, vpsUsed ? "Yes" : "No"); + const cEvent* event = ti->Event(); + if (!event) { + event = GetEvent(ti); + if (event) + LogFile.Log(3, "timer had no event: assigning '%s'", event->Title()); + } + if (!event) { + LogFile.Log(1, "no event for timer found! will be ignored in done list"); + continue; + } + time_t now = time(NULL); + if (vpsUsed || now < ti->StartTime() + 60) { // allow a delay of one minute + timerObj->recDone = new cRecDone(ti, event, search); + return; + } else + LogFile.Log(1, "recording started too late! will be ignored"); } + } - cRecDoneTimerObj* timerObj = new cRecDoneTimerObj(ti, Device->DeviceNumber()); - TimersRecording.Add(timerObj); - - cSearchExt* search = TriggeredFromSearchTimer(ti); - if (!search || (search->avoidRepeats == 0 && search->delMode == 0)) // ignore if not avoid repeats and no auto-delete - continue; - - bool vpsUsed = ti->HasFlags(tfVps) && ti->Event() && ti->Event()->Vps(); - LogFile.Log(1,"recording started '%s' on device %d (search timer '%s'); VPS used: %s", Name, Device->CardIndex(), search->search, vpsUsed ? "Yes": "No"); - const cEvent* event = ti->Event(); - if (!event) - { - event = GetEvent(ti); - if (event) - LogFile.Log(3,"timer had no event: assigning '%s'", event->Title()); - } - if (!event) - { - LogFile.Log(1,"no event for timer found! will be ignored in done list"); - continue; - } - time_t now = time(NULL); - if (vpsUsed || now < ti->StartTime() + 60) // allow a delay of one minute - { - timerObj->recDone = new cRecDone(ti, event, search); - return; - } - else - LogFile.Log(1,"recording started too late! will be ignored"); - } - } - - if (!On) - { - // must be done in a different thread because we hold timer and scheduling lock here - RecdoneThread.SetFilename(Filename); // push_back Filename for processing - RecdoneThread.Start(); - } + if (!On) { + // must be done in a different thread because we hold timer and scheduling lock here + RecdoneThread.SetFilename(Filename); // push_back Filename for processing + RecdoneThread.Start(); + } } int cRecStatusMonitor::TimerRecDevice(const cTimer* timer) { - if (!timer) return 0; - cMutexLock TimersRecordingLock(&TimersRecording); - for (cRecDoneTimerObj *tiR = TimersRecording.First(); tiR; tiR = TimersRecording.Next(tiR)) - if (tiR->timer == timer && timer->Recording()) return tiR->deviceNr+1; - return 0; + if (!timer) return 0; + cMutexLock TimersRecordingLock(&TimersRecording); + for (cRecDoneTimerObj *tiR = TimersRecording.First(); tiR; tiR = TimersRecording.Next(tiR)) + if (tiR->timer == timer && timer->Recording()) return tiR->deviceNr + 1; + return 0; } |