vdr-1.7.30 & call cmd after a recording is deleted

Message ID 5a1878ee42f366cf0c7979001d99f995.squirrel@yaris.dyndns.org
State New
Headers

Commit Message

hondansx@gmx.de Sept. 11, 2012, 7:29 a.m. UTC
  Hi,

attached is a patch which extends the cmd call function to: if a recording
is deleted.
The cmd call 'edited' where not mentioned, which I now did.

Would be nice, if it find's a way into the main vdr.

Alexander
  

Comments

Klaus Schmidinger Sept. 11, 2012, 7:41 a.m. UTC | #1
On 11.09.2012 09:29, hondansx@gmx.de wrote:
> Hi,
>
> attached is a patch which extends the cmd call function to: if a recording
> is deleted.
> The cmd call 'edited' where not mentioned, which I now did.
>
> Would be nice, if it find's a way into the main vdr.

What would this be good for?

Klaus
  
hondansx@gmx.de Sept. 11, 2012, 8:28 a.m. UTC | #2
| On 11.09.2012 09:29, hondansx@gmx.de wrote:
|> Hi,
|>
|> attached is a patch which extends the cmd call function to: if a
|> recording
|> is deleted.
|> The cmd call 'edited' where not mentioned, which I now did.
|>
|> Would be nice, if it find's a way into the main vdr.
|
| What would this be good for?

If a recording is deleted, you could do everything you want.
For example:
rename, restore, move it to another location in condition this is a
important/not seen or a autocut+deleted recording.

I use vdr in a server environment with multiple clients and I will get
noticed if somebody deletes anything.
So I assume this make more sense in a server environment. ;-)
Alexander
  
Stephan Loescher Sept. 15, 2012, 11:58 a.m. UTC | #3
Hi Klaus,

I would like this function, too.
Because I have a script, which converts VDR-recordings to smaller mp4 
for my mobile.
And with that vdr-cmd-script, running after a recording was deleted, it 
would be possible to delete the associated mp4-file automatically.

Greetings,
Stephan.

Am 09/11/12 09:41, schrieb Klaus Schmidinger:
> On 11.09.2012 09:29, hondansx@gmx.de wrote:
>> Hi,
>>
>> attached is a patch which extends the cmd call function to: if a
>> recording
>> is deleted.
>> The cmd call 'edited' where not mentioned, which I now did.
>>
>> Would be nice, if it find's a way into the main vdr.
>
> What would this be good for?
>
> Klaus
  

Patch

Alexander Wenzel, <HondaNSX@Gmx.de>
call CMD after a recording where deleted

diff -ruNp vdr-1.7.30/recording.c vdr-1.7.30-patched/recording.c
--- vdr-1.7.30/recording.c	2012-09-06 11:57:31.000000000 +0200
+++ vdr-1.7.30-patched/recording.c	2012-09-11 08:56:57.512288266 +0200
@@ -1010,8 +1010,10 @@  bool cRecording::Delete(void)
         RemoveVideoFile(NewName);
         }
      isyslog("deleting recording '%s'", FileName());
-     if (access(FileName(), F_OK) == 0)
+     if (access(FileName(), F_OK) == 0) {
         result = RenameVideoFile(FileName(), NewName);
+        cRecordingUserCommand::InvokeCommand(RUC_DELETERECORDING, NewName);
+     }
      else {
         isyslog("recording '%s' vanished", FileName());
         result = true; // well, we were going to delete it, anyway
diff -ruNp vdr-1.7.30/recording.h vdr-1.7.30-patched/recording.h
--- vdr-1.7.30/recording.h	2012-09-06 11:59:11.000000000 +0200
+++ vdr-1.7.30-patched/recording.h	2012-09-11 08:58:04.896762990 +0200
@@ -240,6 +240,7 @@  public:
 #define RUC_BEFORERECORDING "before"
 #define RUC_AFTERRECORDING  "after"
 #define RUC_EDITEDRECORDING "edited"
+#define RUC_DELETERECORDING "deleted"
 
 class cRecordingUserCommand {
 private:
diff -ruNp vdr-1.7.30/vdr.c vdr-1.7.30-patched/vdr.c
--- vdr-1.7.30/vdr.c	2012-09-01 15:30:19.000000000 +0200
+++ vdr-1.7.30-patched/vdr.c	2012-09-11 09:01:35.334205183 +0200
@@ -466,7 +466,7 @@  int main(int argc, char *argv[])
                "  -p PORT,  --port=PORT    use PORT for SVDRP (default: %d)\n"
                "                           0 turns off SVDRP\n"
                "  -P OPT,   --plugin=OPT   load a plugin defined by the given options\n"
-               "  -r CMD,   --record=CMD   call CMD before and after a recording\n"
+               "  -r CMD,   --record=CMD   call CMD before, after, edited or delete a recording\n"
                "            --resdir=DIR   read resource files from DIR (default: %s)\n"
                "  -s CMD,   --shutdown=CMD call CMD to shutdown the computer\n"
                "            --split        split edited files at the editing marks (only\n"