1
0
mirror of https://github.com/VDR4Arch/vdr.git synced 2023-10-10 13:36:52 +02:00

The '.update' file in the video directory is now touched when a recording is added or deleted

This commit is contained in:
Klaus Schmidinger 2005-09-25 13:49:31 +02:00
parent f2183f9ff5
commit c3a76dfef6
7 changed files with 35 additions and 8 deletions

View File

@ -1491,3 +1491,5 @@ Patrick Rother <krd-vdr@gulu.net>
Alexander Rieger <Alexander.Rieger@inka.de>
for fixing two errors in 'newplugin'
for fixing handling color buttons in cMenuEditStrItem
for making the '.update' file in the video directory be touched when a recording is
added or deleted, so that other VDR instances can update their lists

View File

@ -3845,3 +3845,6 @@ Video Disk Recorder Revision History
Thomas Günther).
- Updated the Romanian OSD texts (thanks to Lucian Muresan).
- Updated the Russian OSD texts (thanks to Oleg ???).
- The '.update' file in the video directory is now touched when a recording is
added or deleted, so that other VDR instances can update their lists (thanks to
Alexander Rieger).

4
menu.c
View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: menu.c 1.361 2005/09/25 11:30:55 kls Exp $
* $Id: menu.c 1.362 2005/09/25 13:37:21 kls Exp $
*/
#include "menu.h"
@ -1670,8 +1670,8 @@ eOSState cMenuRecordings::Delete(void)
if (recording) {
if (recording->Delete()) {
cReplayControl::ClearLastReplayed(ri->FileName());
Recordings.DelByName(ri->FileName());
cOsdMenu::Del(Current());
Recordings.Del(recording);
SetHelpKeys();
Display();
if (!Count())

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 1.117 2005/09/25 12:28:40 kls Exp $
* $Id: recording.c 1.118 2005/09/25 13:45:13 kls Exp $
*/
#include "recording.h"
@ -746,6 +746,7 @@ cRecordings Recordings;
cRecordings::cRecordings(bool Deleted)
:cThread("video directory scanner")
{
updateFileName = strdup(AddDirectory(VideoDirectory, ".update"));
deleted = Deleted;
lastUpdate = 0;
state = 0;
@ -754,6 +755,7 @@ cRecordings::cRecordings(bool Deleted)
cRecordings::~cRecordings()
{
Cancel(3);
free(updateFileName);
}
void cRecordings::Action(void)
@ -821,9 +823,15 @@ bool cRecordings::StateChanged(int &State)
return Result;
}
void cRecordings::TouchUpdate(void)
{
TouchFile(updateFileName);
lastUpdate = time(NULL); // make sure we don't tigger ourselves
}
bool cRecordings::NeedsUpdate(void)
{
return lastUpdate < LastModifiedTime(AddDirectory(VideoDirectory, ".update"));
return lastUpdate < LastModifiedTime(updateFileName);
}
bool cRecordings::Update(bool Wait)
@ -854,6 +862,7 @@ void cRecordings::AddByName(const char *FileName)
recording = new cRecording(FileName);
Add(recording);
ChangeState();
TouchUpdate();
}
}
@ -864,6 +873,7 @@ void cRecordings::DelByName(const char *FileName)
if (recording) {
Del(recording);
ChangeState();
TouchUpdate();
}
}

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: recording.h 1.42 2005/09/25 11:31:28 kls Exp $
* $Id: recording.h 1.43 2005/09/25 13:47:07 kls Exp $
*/
#ifndef __RECORDING_H
@ -93,6 +93,7 @@ public:
class cRecordings : public cList<cRecording>, public cThread {
private:
char *updateFileName;
bool deleted;
time_t lastUpdate;
int state;
@ -113,7 +114,10 @@ public:
///< function returns only after the update has completed.
///< Returns true if Wait is true and there is anyting in the list
///< of recordings, false otherwise.
void TriggerUpdate(void) { lastUpdate = 0; }
void TouchUpdate(void);
///< Touches the '.update' file in the video directory, so that other
///< instances of VDR that access the same video directory can be triggered
///< to update their recordings list.
bool NeedsUpdate(void);
void ChangeState(void) { state++; }
bool StateChanged(int &State);

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 1.98 2005/09/11 13:11:05 kls Exp $
* $Id: tools.c 1.99 2005/09/25 12:56:06 kls Exp $
*/
#include "tools.h"
@ -17,6 +17,7 @@
#include <sys/vfs.h>
#include <time.h>
#include <unistd.h>
#include <utime.h>
#include "i18n.h"
int SysLogLevel = 3;
@ -475,6 +476,12 @@ bool SpinUpDisk(const char *FileName)
return false;
}
void TouchFile(const char *FileName)
{
if (utime(FileName, NULL) == -1 && errno != ENOENT)
LOG_ERROR_STR(FileName);
}
time_t LastModifiedTime(const char *FileName)
{
struct stat fs;

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 1.77 2005/09/17 15:33:40 kls Exp $
* $Id: tools.h 1.78 2005/09/25 12:54:58 kls Exp $
*/
#ifndef __TOOLS_H
@ -113,6 +113,7 @@ bool RemoveFileOrDir(const char *FileName, bool FollowSymlinks = false);
bool RemoveEmptyDirectories(const char *DirName, bool RemoveThis = false);
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);
time_t LastModifiedTime(const char *FileName);
cString WeekDayName(int WeekDay);
cString WeekDayName(time_t t);