Fixed an error in displayreplay if no recording information are available

This commit is contained in:
kamel5 2021-02-01 13:31:08 +01:00
parent 6aeaf41467
commit 1c393e23a5
3 changed files with 33 additions and 4 deletions

View File

@ -191,6 +191,8 @@ void cViewReplay::GetTimers(void) {
void cViewReplay::SetTimeShiftValues(const cRecording *recording) { void cViewReplay::SetTimeShiftValues(const cRecording *recording) {
//check for instant recording //check for instant recording
if (!recording)
return;
const char *recName = recording->Name(); const char *recName = recording->Name();
if (recName && *recName == '@') if (recName && *recName == '@')
return; return;
@ -224,6 +226,12 @@ void cViewReplay::SetTitle(const char *title) {
if (veRecTitle) { if (veRecTitle) {
veRecTitle->Set(title); veRecTitle->Set(title);
} }
if (veRecInfo) {
veRecInfo->Set(NULL);
}
if (veScraperContent) {
veScraperContent->Set(NULL);
}
} }
void cViewReplay::SetCurrent(const char *current) { void cViewReplay::SetCurrent(const char *current) {
@ -239,7 +247,7 @@ void cViewReplay::SetTotal(const char *total) {
} }
void cViewReplay::SetEndTime(int current, int total) { void cViewReplay::SetEndTime(int current, int total) {
if (!veEndTime) if (!veEndTime || reclength == 0)
return; return;
int totalLength = total; int totalLength = total;
int recordingLength = reclength; int recordingLength = reclength;
@ -248,7 +256,7 @@ void cViewReplay::SetEndTime(int current, int total) {
recordingLength = timeShiftLength; recordingLength = timeShiftLength;
} }
double rest = (double)(totalLength - current) / (double)totalLength; double rest = (double)(totalLength - current) / (double)totalLength;
time_t end = time(0) + rest*recordingLength; time_t end = time(0) + rest * recordingLength;
veEndTime->Set(TimeString(end)); veEndTime->Set(TimeString(end));
Render((int)eVeDisplayReplay::endtime); Render((int)eVeDisplayReplay::endtime);
} }

View File

@ -25,10 +25,24 @@ void cVeDrRecTitle::SetTokenContainer(void) {
} }
void cVeDrRecTitle::Set(const cRecording *recording) { void cVeDrRecTitle::Set(const cRecording *recording) {
if (this->title) {
free(this->title);
this->title = NULL;
}
if (this->recording)
this->recording = NULL;
if (!recording)
return;
this->recording = recording; this->recording = recording;
} }
void cVeDrRecTitle::Set(const char *title) { void cVeDrRecTitle::Set(const char *title) {
if (this->title) {
free(this->title);
this->title = NULL;
}
if (this->recording)
this->recording = NULL;
if (!title) if (!title)
return; return;
free(this->title); free(this->title);

View File

@ -25,7 +25,14 @@ void cSDDisplayReplay::SetRecording(const cRecording *Recording) {
} }
void cSDDisplayReplay::SetTitle(const char *Title) { void cSDDisplayReplay::SetTitle(const char *Title) {
if (!ok)
return;
view->SetTitle(Title); view->SetTitle(Title);
if (init) {
view->SetRecordingLength(0);
view->SetTimeShiftValues(NULL);
init = false;
}
} }
void cSDDisplayReplay::SetMode(bool Play, bool Forward, int Speed) { void cSDDisplayReplay::SetMode(bool Play, bool Forward, int Speed) {