The '.update' file in the video directory is now created if it doesn't already exist

This commit is contained in:
Klaus Schmidinger 2024-09-01 20:43:40 +02:00
parent 1df138d876
commit 5d539be071
5 changed files with 23 additions and 11 deletions

View File

@ -9952,7 +9952,7 @@ Video Disk Recorder Revision History
- Added the lines from 'Fixed a timeout in cDvbDevice while tuning after the frontend
has been reopened' to cDvbTuner::ProvidesFrontend() (suggested by Markus Ehrnsperger).
2024-08-30:
2024-09-01:
- Removed deprecated function cDevice::SetCurrentChannel(const cChannel *Channel).
- Removed deprecated function cSkinDisplayMenu::SetItemEvent(const cEvent *Event, int Index,
@ -9978,3 +9978,4 @@ Video Disk Recorder Revision History
and select one of them.
- Fixed a crash when deleting a recording that is currently being edited, and then
immediately deleting the edited version, too (reported by Marko Mäkelä).
- The '.update' file in the video directory is now created if it doesn't already exist.

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: recording.c 5.29 2024/08/30 20:43:26 kls Exp $
* $Id: recording.c 5.30 2024/09/01 20:43:40 kls Exp $
*/
#include "recording.h"
@ -1631,7 +1631,7 @@ const char *cRecordings::UpdateFileName(void)
void cRecordings::TouchUpdate(void)
{
bool needsUpdate = NeedsUpdate();
TouchFile(UpdateFileName());
TouchFile(UpdateFileName(), true);
if (!needsUpdate)
lastUpdate = time(NULL); // make sure we don't trigger ourselves
}

14
tools.c
View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: tools.c 5.13 2024/07/15 14:42:22 kls Exp $
* $Id: tools.c 5.14 2024/09/01 20:43:40 kls Exp $
*/
#include "tools.h"
@ -719,9 +719,17 @@ bool SpinUpDisk(const char *FileName)
return false;
}
void TouchFile(const char *FileName)
void TouchFile(const char *FileName, bool Create)
{
if (utime(FileName, NULL) == -1 && errno != ENOENT)
if (Create && access(FileName, F_OK) != 0) { // the file does not exist
isyslog("creating file '%s'", FileName);
int f = open(FileName, O_WRONLY | O_CREAT, DEFFILEMODE);
if (f >= 0)
close(f);
else
LOG_ERROR_STR(FileName);
}
if (utime(FileName, NULL) == -1 && errno != ENOENT)
LOG_ERROR_STR(FileName);
}

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: tools.h 5.9 2024/07/15 14:42:22 kls Exp $
* $Id: tools.h 5.10 2024/09/01 20:43:40 kls Exp $
*/
#ifndef __TOOLS_H
@ -319,7 +319,7 @@ bool RemoveEmptyDirectories(const char *DirName, bool RemoveThis = false, const
int DirSizeMB(const char *DirName); ///< returns the total size of the files in the given directory, or -1 in case of an error
char *ReadLink(const char *FileName); ///< returns a new string allocated on the heap, which the caller must delete (or NULL in case of an error)
bool SpinUpDisk(const char *FileName);
void TouchFile(const char *FileName);
void TouchFile(const char *FileName, bool Create = false);
time_t LastModifiedTime(const char *FileName);
off_t FileSize(const char *FileName); ///< returns the size of the given file, or -1 in case of an error (e.g. if the file doesn't exist)
cString WeekDayName(int WeekDay);

9
vdr.1
View File

@ -8,7 +8,7 @@
.\" License as specified in the file COPYING that comes with the
.\" vdr distribution.
.\"
.\" $Id: vdr.1 5.2 2021/12/27 13:31:04 kls Exp $
.\" $Id: vdr.1 5.3 2024/09/01 20:43:40 kls Exp $
.\"
.TH vdr 1 "27 Dec 2021" "2.6" "Video Disk Recorder"
.SH NAME
@ -311,8 +311,11 @@ as the first character of the pattern. File names are appended to this file afte
a recording has finished, and the entire file is read upon startup of VDR.
.TP
.I .update
If this file is present in the video directory, its last modification time will
be used to trigger an update of the list of recordings in the "Recordings" menu.
This file (in the video directory) will be touched whenever VDR makes changes
to the content of the directory. Its last modification time will
be used to trigger an update of the list of recordings in any VDRs that use
the same video directory.
The file will be created if it doesn't already exist.
.SH SEE ALSO
.BR vdr (5), svdrpsend (1)
.SH AUTHOR