From a28d92d0490e75f2be7d7239ac491683e215c42f Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Sun, 25 Jun 2017 12:43:09 +0200 Subject: [PATCH] Whenever a change is made to the recordings in the video directory, the SVDRP command UPDR is now sent to all peer VDRs --- HISTORY | 4 ++++ recording.c | 4 +++- svdrp.c | 14 +++++++++++++- svdrp.h | 4 +++- 4 files changed, 23 insertions(+), 3 deletions(-) diff --git a/HISTORY b/HISTORY index d82501ce..7689974a 100644 --- a/HISTORY +++ b/HISTORY @@ -9156,3 +9156,7 @@ Video Disk Recorder Revision History (suggested by Frank Neumann). - Added a note to the log, indicating that no further invalid lock sequences will be reported until VDR is restarted. +- Whenever a change is made to the recordings in the video directory, the SVDRP command + UPDR is now sent to all peer VDRs, so that they will update their recordings list. + This is especially useful if one VDR mounts the video directory of an other one into + a subdirectory. diff --git a/recording.c b/recording.c index 7b1d158b..ca0ec798 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 4.9 2017/05/27 15:46:57 kls Exp $ + * $Id: recording.c 4.10 2017/06/25 12:31:46 kls Exp $ */ #include "recording.h" @@ -27,6 +27,7 @@ #include "remux.h" #include "ringbuffer.h" #include "skins.h" +#include "svdrp.h" #include "tools.h" #include "videodir.h" @@ -1493,6 +1494,7 @@ void cRecordings::TouchUpdate(void) TouchFile(UpdateFileName()); if (!needsUpdate) lastUpdate = time(NULL); // make sure we don't trigger ourselves + BroadcastSVDRPCommand("UPDR"); } bool cRecordings::NeedsUpdate(void) diff --git a/svdrp.c b/svdrp.c index 2b63c801..924acd36 100644 --- a/svdrp.c +++ b/svdrp.c @@ -10,7 +10,7 @@ * and interact with the Video Disk Recorder - or write a full featured * graphical interface that sits on top of an SVDRP connection. * - * $Id: svdrp.c 4.20 2017/05/31 14:02:17 kls Exp $ + * $Id: svdrp.c 4.21 2017/06/25 12:31:13 kls Exp $ */ #include "svdrp.h" @@ -2600,3 +2600,15 @@ bool ExecSVDRPCommand(const char *ServerName, const char *Command, cStringList * return SVDRPClientHandler->Execute(ServerName, Command, Response); return false; } + +void BroadcastSVDRPCommand(const char *Command) +{ + cMutexLock MutexLock(&SVDRPHandlerMutex); + cStringList ServerNames; + if (SVDRPClientHandler) { + if (SVDRPClientHandler->GetServerNames(&ServerNames)) { + for (int i = 0; i < ServerNames.Size(); i++) + ExecSVDRPCommand(ServerNames[i], Command); + } + } +} diff --git a/svdrp.h b/svdrp.h index ba33fc27..700a1300 100644 --- a/svdrp.h +++ b/svdrp.h @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: svdrp.h 4.5 2015/09/09 09:44:12 kls Exp $ + * $Id: svdrp.h 4.6 2017/06/25 12:27:57 kls Exp $ */ #ifndef __SVDRP_H @@ -42,6 +42,8 @@ bool ExecSVDRPCommand(const char *ServerName, const char *Command, cStringList * ///< resulting strings from the remote VDR, which can be accessed ///< through Response. If Response is given, it will be cleared before ///< the command is actually executed. +void BroadcastSVDRPCommand(const char *Command); + ///< Sends the given SVDRP Command string to all remote VDRs. inline int SVDRPCode(const char *s) { return s ? atoi(s) : 0; } ///< Returns the value of the three digit reply code of the given ///< SVDRP response string.