Mailing List archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[vdr] Re: Programming VDR over Web



Thomas Koch wrote:
> 
> Am 9.10.2001 um 13:48 schrieb Axel Gruber:
> 
> > > line 19/20. All HTML stuff is templated, so we can (i hope) change simple
> > > language and layout.
> > I donīt have it tryed it yet - but is it possible to use it for Delete
> > recordings and switching Channel too?
> 
> Switching channels is possible (but not yet implemented). Manage
> recordings is not possible since VDR does not support this.
> 
> @Klaus: Is it possible to add some commands to manage recordings in SVDRP?
>         (list, delete...). What sense makes the GRAB command? The
>         resulting picture is stored localy, is it possible to change this
>         that the picuture is delivered via SVDRP?
> 

Should be simple since the functionality of the OSD is already available
in the code - you just have to make it usable via svdrp. This could make
a powerful interface to web-or-whatever-gateways or fancier remote
controls ;-)

Thre following patch implements the commands DELR (delete recording) and
LSTR (list recording) into svdrp. Hope it helps.

Thomas

<--------------------- cut here --------------------->
--- VDR-0.96/svdrp.h	Fri Sep 14 16:35:34 2001
+++ VDR/svdrp.h	Tue Oct  9 19:29:47 2001
@@ -12,6 +12,7 @@
 
 #include "dvbapi.h"
 #include "tools.h"
+#include "recording.h"
 
 class cSocket {
 private:
@@ -28,6 +29,7 @@
 
 class cSVDRP {
 private:
+  cRecordings Recordings;
   cSocket socket;
   cFile file;
   CRect ovlClipRects[MAXCLIPRECTS];
@@ -40,12 +42,14 @@
   void Reply(int Code, const char *fmt, ...);
   void CmdCHAN(const char *Option);
   void CmdDELC(const char *Option);
+  void CmdDELR(const char *Option);
   void CmdDELT(const char *Option);
   void CmdGRAB(const char *Option);
   void CmdHELP(const char *Option);
   void CmdHITK(const char *Option);
   void CmdLSTC(const char *Option);
   void CmdLSTE(const char *Option);
+  void CmdLSTR(const char *Option);
   void CmdLSTT(const char *Option);
   void CmdMESG(const char *Option);
   void CmdMODC(const char *Option);
--- VDR-0.96/svdrp.c	Sat Sep 22 15:30:02 2001
+++ VDR/svdrp.c	Tue Oct  9 19:29:47 2001
@@ -122,6 +122,8 @@
   "    it returns the current channel number and name.",
   "DELC <number>\n"
   "    Delete channel.",
+  "DELR <number>\n"
+  "    Delete recording.",
   "DELT <number>\n"
   "    Delete timer.",
   "GRAB <filename> [ jpeg | pnm [ <quality> [ <sizex> <sizey> ] ] ]\n"
@@ -139,6 +141,9 @@
   "    containing the given string as part of their name are listed.",
   "LSTE\n"
   "    List EPG data.",
+  "LSTR [ <number> ]\n"
+  "    List recordings. Without option, all recordings are listed.
Otherwise\n"
+  "    the summary for the given recording is listed.",
   "LSTT [ <number> ]\n"
   "    List timers. Without option, all timers are listed. Otherwise\n"
   "    only the given timer is listed.",
@@ -382,6 +387,27 @@
   Reply(502, "DELC not yet implemented");
 }
 
+void cSVDRP::CmdDELR(const char *Option)
+{
+  if (*Option) {
+     if (isnumber(Option)) {
+        cRecording *recording = Recordings.Get(strtol(Option, NULL, 10)
- 1);
+        if (recording) {
+           if (recording->Delete())
+              Reply(250, "Recording \"%s\" deleted", Option);
+           else
+              Reply(501, "Error while deleting recording!");
+           }
+        else
+           Reply(501, "Recording \"%s\" not defined", Option);
+        }
+     else
+        Reply(501, "Error in recording number \"%s\"", Option);
+     }
+  else
+     Reply(501, "Missing recording number");
+}
+
 void cSVDRP::CmdDELT(const char *Option)
 {
   if (*Option) {
@@ -591,6 +617,38 @@
      Reply(451, "Can't get EPG data");
 }
 
+void cSVDRP::CmdLSTR(const char *Option)
+{
+  bool recordings = Recordings.Load();
+  if (*Option) {
+     if (isnumber(Option)) {
+        cRecording *recording = Recordings.Get(strtol(Option, NULL, 10)
- 1);
+        if (recording) {
+           if (recording->Summary()) {
+              delete message;
+              message = strdup(recording->Summary());
+              Reply(250, "%d %s", recording->Index() + 1,
strreplace(message,'\n','|'));
+              }
+           else
+              Reply(550, "%d No summary", recording->Index() + 1);
+           }
+        else
+           Reply(501, "Recording \"%s\" not defined", Option);
+        }
+     else
+        Reply(501, "Error in recording number \"%s\"", Option);
+     }
+  else if (recordings) {
+     cRecording *recording = Recordings.First();
+     while (recording) {
+         Reply(recording == Recordings.Last() ? 250 : -250, "%d %s",
recording->Index() + 1, recording->Title(' ', true));
+         recording = Recordings.Next(recording);
+         }
+     }
+  else
+     Reply(501, "No recordings defined");
+}
+
 void cSVDRP::CmdLSTT(const char *Option)
 {
   if (*Option) {
@@ -912,12 +970,14 @@
   s = skipspace(s);
   if      (CMD("CHAN"))  CmdCHAN(s);
   else if (CMD("DELC"))  CmdDELC(s);
+  else if (CMD("DELR"))  CmdDELR(s);
   else if (CMD("DELT"))  CmdDELT(s);
   else if (CMD("GRAB"))  CmdGRAB(s);
   else if (CMD("HELP"))  CmdHELP(s);
   else if (CMD("HITK"))  CmdHITK(s);
   else if (CMD("LSTC"))  CmdLSTC(s);
   else if (CMD("LSTE"))  CmdLSTE(s);
+  else if (CMD("LSTR"))  CmdLSTR(s);
   else if (CMD("LSTT"))  CmdLSTT(s);
   else if (CMD("MESG"))  CmdMESG(s);
   else if (CMD("MODC"))  CmdMODC(s);



Home | Main Index | Thread Index