Getting rid of redundant resume.vdr files.
Commit Message
Carsten Koch wrote:
...
> 2) vdr's recordings scan is slowed down further by the fact that
> VDR opens all resume.vdr files to see if the recording is rewound.
> This problem can be greatly reduced by two steps:
> a) Remove the resume.vdr file if it points to (almost) the
> beginning of the file.
Attached is an updated version of my patch for VDR 1.3.31.
> b) Never try to read it. If the directory entry is there,
> with the above patch it can be assumed that the recording
> is not rewound.
@@ -199,13 +199,19 @@
bool cResumeFile::Save(int Index)
{
if (fileName) {
- int f = open(fileName, O_WRONLY | O_CREAT | O_TRUNC, DEFFILEMODE);
- if (f >= 0) {
- if (safe_write(f, &Index, sizeof(Index)) < 0)
- LOG_ERROR_STR(fileName);
- close(f);
- return true;
- }
+ if (Index / FRAMESPERSEC < 60) {
+ Delete();
+ return true;
+ }
+ else {
+ int f = open(fileName, O_WRONLY | O_CREAT | O_TRUNC, DEFFILEMODE);
+ if (f >= 0) {
+ if (safe_write(f, &Index, sizeof(Index)) < 0)
+ LOG_ERROR_STR(fileName);
+ close(f);
+ return true;
+ }
+ }
}
return false;
}