diff options
-rw-r--r-- | HISTORY.h | 9 | ||||
-rw-r--r-- | status.c | 106 | ||||
-rw-r--r-- | update.h | 20 |
3 files changed, 85 insertions, 50 deletions
@@ -5,10 +5,10 @@ * */ -#define _VERSION "1.1.99" -#define VERSION_DATE "28.10.2019" +#define _VERSION "1.1.100" +#define VERSION_DATE "29.10.2019" -#define DB_API 7 +#define DB_API 7 #ifdef GIT_REV # define VERSION _VERSION "-GIT" GIT_REV @@ -19,6 +19,9 @@ /* * ------------------------------------ +2019-10-29 version 1.1.100 (horchi) + - bugfix: Added patch to fix potentially cras at end of recording (thaks to kfb77@vdr-portal) + 2019-10-28 version 1.1.99 (horchi) - added: Option to keep menu on channel switch open @@ -10,6 +10,10 @@ #include "update.h" #include "ttools.h" +#if defined (APIVERSNUM) && APIVERSNUM < 20304 +# error "VDR-2.3.4 API version or greater is required!" +#endif + //*************************************************************************** // ----> Copied from epgsearch ;-) //*************************************************************************** @@ -167,10 +171,13 @@ int cUpdate::performRecordingActions() for (cRunningRecording* rr = runningRecordings.First(); rr; rr = runningRecordings.Next(rr)) { - if (rr->timer == ti) + if (ti->Id() == rr->id) { - recording = rr; - break; + if (!rr->remote && !ti->Remote() || rr->remote && ti->Remote() && strcmp(rr->remote, ti->Remote()) == 0) + { + recording = rr; + break; + } } } @@ -202,60 +209,75 @@ int cUpdate::performRecordingActions() const cTimer* pendingTimer = 0; int complete; double recFraction = 100.0; - long timerLengthSecs = rr->timer->StopTime() - rr->timer->StartTime(); - bool vpsUsed = rr->timer->HasFlags(tfVps) && rr->timer->Event() && rr->timer->Event()->Vps(); + long timerLengthSecs = 0; + bool vpsUsed = false; - // check if timer still exists + pendingTimer = Timers->GetById(rr->id, rr->remote); - for (pendingTimer = timers->First(); pendingTimer; pendingTimer = timers->Next(pendingTimer)) + if (pendingTimer) { - if (pendingTimer == rr->timer) - break; - } + tell(2,"Info: valid timer for recording '%s' on Server '%s'", pendingTimer->File(), pendingTimer->Remote()); + timerLengthSecs = pendingTimer->StopTime() - pendingTimer->StartTime(); - // still recording :o ? + if (pendingTimer->Event()) + { + tell(2,"Info: valid event for recording '%s'", pendingTimer->File()); + tell(2,"Info: pendingTimer->Event()->Vps() (%ld)", pendingTimer->Event()->Vps()); + vpsUsed = pendingTimer->HasFlags(tfVps) && pendingTimer->Event()->Vps(); + } + else + { + tell(2,"Info: no event for recording '%s'", pendingTimer->File()); + } - if (pendingTimer && pendingTimer->Recording()) - continue; + // still recording :o ? - if (pRecording && timerLengthSecs) - { - int recLen = RecLengthInSecs(pRecording); - recFraction = double(recLen) * 100 / timerLengthSecs; - } + if (pendingTimer && pendingTimer->Recording()) + continue; - // assure timer has reached it's end or at least 90% (vps) / 98% were recorded + if (pRecording && timerLengthSecs) + { + int recLen = RecLengthInSecs(pRecording); + recFraction = double(recLen) * 100 / timerLengthSecs; + } - complete = recFraction >= (vpsUsed ? 90 : 98); + // assure timer has reached it's end or at least 90% (vps) / 98% were recorded - if (complete) - tell(1, "Info: Finished (%d) '%s'; recorded %d%%; VPS %s", getTimerIdOf(rr->aux), - rr->timer->File(), (int)round(recFraction), vpsUsed ? "Yes": "No"); - else - tell(1, "Info: Finished (%d) '%s' (not complete! - recorded only %d%%); VPS %s", getTimerIdOf(rr->aux), - rr->timer->File(), (int)round(recFraction), vpsUsed ? "Yes": "No"); + complete = recFraction >= (vpsUsed ? 90 : 98); - if (complete) - rr->lastBreak = 0; // reset break - else if (!rr->lastBreak) - rr->lastBreak = time(0); // store first break + if (complete) + tell(1, "Info: Finished (%d) '%s'; recorded %d%%; VPS %s", getTimerIdOf(rr->aux), + pendingTimer->File(), (int)round(recFraction), vpsUsed ? "Yes": "No"); + else + tell(1, "Info: Finished (%d) '%s' (not complete! - recorded only %d%%); VPS %s", getTimerIdOf(rr->aux), + pendingTimer->File(), (int)round(recFraction), vpsUsed ? "Yes": "No"); - if (!rr->lastBreak || - time(0) - rr->lastBreak > allowedBreakDuration || - time(0) >= rr->timer->StopTime()) - { - char* infoTxt; + if (complete) + rr->lastBreak = 0; // reset break + else if (!rr->lastBreak) + rr->lastBreak = time(0); // store first break + + if (!rr->lastBreak || + time(0) - rr->lastBreak > allowedBreakDuration || + time(0) >= pendingTimer->StopTime()) + { + char* infoTxt; - asprintf(&infoTxt, "Recording '%s' finished - %s complete (%d%%)", - rr->timer->File(), complete ? "" : "NOT", (int)round(recFraction)); + asprintf(&infoTxt, "Recording '%s' finished - %s complete (%d%%)", + pendingTimer->File(), complete ? "" : "NOT", (int)round(recFraction)); - tell(1, "Info: %s", infoTxt); + tell(1, "Info: %s", infoTxt); - rr->finished = yes; - rr->failed = !complete; - rr->setInfo(infoTxt); + rr->finished = yes; + rr->failed = !complete; + rr->setInfo(infoTxt); - free(infoTxt); + free(infoTxt); + } + } + else + { + tell(2,"Info: no timer for id '%d'", rr->id); } } } @@ -24,6 +24,10 @@ #define EPGDNAME "epgd" +#if defined(APIVERSNUM) && APIVERSNUM < 20304 +#error "VDR-2.3.4 API version or greater is required!" +#endif + //*************************************************************************** // Running Recording //*************************************************************************** @@ -34,7 +38,12 @@ class cRunningRecording : public cListObject cRunningRecording(const cTimer* t, long did = na) { - timer = t; + id = t->Id(); + + if (remote) + free(remote); + + remote = t->Remote() ? strdup(t->Remote()) : nullptr; doneid = did; lastBreak = 0; info = 0; @@ -44,7 +53,7 @@ class cRunningRecording : public cListObject // copy until timer get waste .. - aux = strdup(timer->Aux() ? timer->Aux() : ""); + aux = strdup(t->Aux() ? t->Aux() : ""); } ~cRunningRecording() @@ -57,13 +66,14 @@ class cRunningRecording : public cListObject // data - const cTimer* timer; // #TODO, it's may be fatal to hold a pointer to a timer! + int id = 0; // use timer->Id(), timer->Remote and GetById instead of pointer to a timer + char* remote {nullptr}; time_t lastBreak; int finished; int failed; long doneid; - char* aux; - char* info; + char* aux {nullptr}; + char* info {nullptr}; }; //*************************************************************************** |