The info files of recordings are now only re-read if they have been modified

This commit is contained in:
Klaus Schmidinger 2025-01-15 10:50:29 +01:00
parent a7576f0b6c
commit e595eed57d
4 changed files with 14 additions and 2 deletions

View File

@ -3375,6 +3375,7 @@ Stefan Hofmann <stefan.hofmann@t-online.de>
for adding 1 to Utf8BufSize() for worst case for adding 1 to Utf8BufSize() for worst case
for adding a header to the backtrace for adding a header to the backtrace
for adding parameter checks to strn0cpy() for adding parameter checks to strn0cpy()
for making the info files of recordings only be re-read if they have been modified
Stefan Blochberger <Stefan.Blochberger@gmx.de> Stefan Blochberger <Stefan.Blochberger@gmx.de>
for suggesting to automatically display the progress display whenever replay of a for suggesting to automatically display the progress display whenever replay of a

View File

@ -10054,3 +10054,5 @@ Video Disk Recorder Revision History
to Markus Ehrnsperger). to Markus Ehrnsperger).
- Added a header to the backtrace (thanks to Stefan Hofmann). - Added a header to the backtrace (thanks to Stefan Hofmann).
- Added parameter checks to strn0cpy() (thanks to Stefan Hofmann). Same for Utf8Strn0Cpy(). - Added parameter checks to strn0cpy() (thanks to Stefan Hofmann). Same for Utf8Strn0Cpy().
- The info files of recordings are now only re-read if they have been modified (thanks
to Stefan Hofmann).

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * how to reach the author.
* *
* $Id: recording.c 5.35 2024/09/21 19:18:18 kls Exp $ * $Id: recording.c 5.36 2025/01/15 10:50:29 kls Exp $
*/ */
#include "recording.h" #include "recording.h"
@ -356,6 +356,7 @@ void cResumeFile::Delete(void)
cRecordingInfo::cRecordingInfo(const cChannel *Channel, const cEvent *Event) cRecordingInfo::cRecordingInfo(const cChannel *Channel, const cEvent *Event)
{ {
modified = 0;
channelID = Channel ? Channel->GetChannelID() : tChannelID::InvalidID; channelID = Channel ? Channel->GetChannelID() : tChannelID::InvalidID;
channelName = Channel ? strdup(Channel->Name()) : NULL; channelName = Channel ? strdup(Channel->Name()) : NULL;
ownEvent = Event ? NULL : new cEvent(0); ownEvent = Event ? NULL : new cEvent(0);
@ -420,6 +421,7 @@ cRecordingInfo::cRecordingInfo(const cChannel *Channel, const cEvent *Event)
cRecordingInfo::cRecordingInfo(const char *FileName) cRecordingInfo::cRecordingInfo(const char *FileName)
{ {
modified = 0;
channelID = tChannelID::InvalidID; channelID = tChannelID::InvalidID;
channelName = NULL; channelName = NULL;
ownEvent = new cEvent(0); ownEvent = new cEvent(0);
@ -488,6 +490,12 @@ void cRecordingInfo::SetErrors(int Errors)
bool cRecordingInfo::Read(FILE *f) bool cRecordingInfo::Read(FILE *f)
{ {
if (ownEvent) { if (ownEvent) {
struct stat st;
if (fstat(fileno(f), &st))
return false;
if (modified == st.st_mtime)
return true;
modified = st.st_mtime;
cReadLine ReadLine; cReadLine ReadLine;
char *s; char *s;
int line = 0; int line = 0;

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * how to reach the author.
* *
* $Id: recording.h 5.11 2024/09/19 20:21:58 kls Exp $ * $Id: recording.h 5.12 2025/01/15 10:50:29 kls Exp $
*/ */
#ifndef __RECORDING_H #ifndef __RECORDING_H
@ -64,6 +64,7 @@ public:
class cRecordingInfo { class cRecordingInfo {
friend class cRecording; friend class cRecording;
private: private:
time_t modified;
tChannelID channelID; tChannelID channelID;
char *channelName; char *channelName;
const cEvent *event; const cEvent *event;