summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKlaus Schmidinger <vdr@tvdr.de>2005-09-25 13:49:31 +0200
committerKlaus Schmidinger <vdr@tvdr.de>2005-09-25 13:49:31 +0200
commitc3a76dfef6b62a003f159f2ec1ef0ca6d2290db7 (patch)
tree852a9b9177f3ec7c666ab4e6c01976bfcd41bf0a
parentf2183f9ff56f6f0024d9c55df6472f37f638adc0 (diff)
downloadvdr-c3a76dfef6b62a003f159f2ec1ef0ca6d2290db7.tar.gz
vdr-c3a76dfef6b62a003f159f2ec1ef0ca6d2290db7.tar.bz2
The '.update' file in the video directory is now touched when a recording is added or deleted
-rw-r--r--CONTRIBUTORS2
-rw-r--r--HISTORY3
-rw-r--r--menu.c4
-rw-r--r--recording.c14
-rw-r--r--recording.h8
-rw-r--r--tools.c9
-rw-r--r--tools.h3
7 files changed, 35 insertions, 8 deletions
diff --git a/CONTRIBUTORS b/CONTRIBUTORS
index efe1157f..afced900 100644
--- a/CONTRIBUTORS
+++ b/CONTRIBUTORS
@@ -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
diff --git a/HISTORY b/HISTORY
index 5dde6128..5cbd6eef 100644
--- a/HISTORY
+++ b/HISTORY
@@ -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).
diff --git a/menu.c b/menu.c
index 5423416c..a28c8a8b 100644
--- a/menu.c
+++ b/menu.c
@@ -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())
diff --git a/recording.c b/recording.c
index 35aefc80..de657698 100644
--- a/recording.c
+++ b/recording.c
@@ -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();
}
}
diff --git a/recording.h b/recording.h
index aa33dd3b..9230540f 100644
--- a/recording.h
+++ b/recording.h
@@ -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);
diff --git a/tools.c b/tools.c
index 28b2bbed..dbd78c97 100644
--- a/tools.c
+++ b/tools.c
@@ -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;
diff --git a/tools.h b/tools.h
index 1ee69d32..7ad3e763 100644
--- a/tools.h
+++ b/tools.h
@@ -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);