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

New SVDRP commands LSTR and DELR to list and delete recordings

This commit is contained in:
Klaus Schmidinger 2001-10-27 11:47:46 +02:00
parent 02b5a40539
commit 576ba802fe
4 changed files with 75 additions and 2 deletions

View File

@ -153,3 +153,6 @@ Simon Bauschulte <SemiSchwabe@Brutzel.de>
Andy Grobb <Charly98@01019freenet.de> Andy Grobb <Charly98@01019freenet.de>
for completing storing the current audio volume in the setup.conf file for completing storing the current audio volume in the setup.conf file
Thomas Heiligenmann <thomas@heiligenmann.de>
for implementing the SVDRP commands LSTR and DELR

View File

@ -837,3 +837,5 @@ Video Disk Recorder Revision History
to Andy Grobb). to Andy Grobb).
- Fixed closing the progress display with the "Back" key when in trick mode - Fixed closing the progress display with the "Back" key when in trick mode
and Setup.ShowReplayMode is enabled. and Setup.ShowReplayMode is enabled.
- New SVDRP commands LSTR and DELR to list and delete recordings (thanks to
Thomas Heiligenmann).

66
svdrp.c
View File

@ -10,7 +10,7 @@
* and interact with the Video Disk Recorder - or write a full featured * and interact with the Video Disk Recorder - or write a full featured
* graphical interface that sits on top of an SVDRP connection. * graphical interface that sits on top of an SVDRP connection.
* *
* $Id: svdrp.c 1.25 2001/10/07 15:13:42 kls Exp $ * $Id: svdrp.c 1.26 2001/10/27 11:35:38 kls Exp $
*/ */
#include "svdrp.h" #include "svdrp.h"
@ -120,6 +120,12 @@ const char *HelpPages[] = {
" it returns the current channel number and name.", " it returns the current channel number and name.",
"DELC <number>\n" "DELC <number>\n"
" Delete channel.", " Delete channel.",
"DELR <number>\n"
" Delete the recording with the given number. Before a recording can be\n"
" deleted, an LSTR command must have been executed in order to retrieve\n"
" the recording numbers. The numbers don't change during subsequent DELR\n"
" commands. CAUTION: THERE IS NO CONFIRMATION PROMPT WHEN DELETING A\n"
" RECORDING - BE SURE YOU KNOW WHAT YOU ARE DOING!",
"DELT <number>\n" "DELT <number>\n"
" Delete timer.", " Delete timer.",
"GRAB <filename> [ jpeg | pnm [ <quality> [ <sizex> <sizey> ] ] ]\n" "GRAB <filename> [ jpeg | pnm [ <quality> [ <sizex> <sizey> ] ] ]\n"
@ -137,6 +143,9 @@ const char *HelpPages[] = {
" containing the given string as part of their name are listed.", " containing the given string as part of their name are listed.",
"LSTE\n" "LSTE\n"
" List EPG data.", " 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" "LSTT [ <number> ]\n"
" List timers. Without option, all timers are listed. Otherwise\n" " List timers. Without option, all timers are listed. Otherwise\n"
" only the given timer is listed.", " only the given timer is listed.",
@ -380,6 +389,27 @@ void cSVDRP::CmdDELC(const char *Option)
Reply(502, "DELC not yet implemented"); 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(554, "Error while deleting recording!");
}
else
Reply(550, "Recording \"%s\" not found%s", Option, Recordings.Count() ? "" : " (use LSTR before deleting)");
}
else
Reply(501, "Error in recording number \"%s\"", Option);
}
else
Reply(501, "Missing recording number");
}
void cSVDRP::CmdDELT(const char *Option) void cSVDRP::CmdDELT(const char *Option)
{ {
if (*Option) { if (*Option) {
@ -589,6 +619,38 @@ void cSVDRP::CmdLSTE(const char *Option)
Reply(451, "Can't get EPG data"); 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()) {
char *summary = strdup(recording->Summary());
Reply(250, "%s", strreplace(summary,'\n','|'));
delete summary;
}
else
Reply(550, "No summary availabe");
}
else
Reply(550, "Recording \"%s\" not found", 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(550, "No recordings available");
}
void cSVDRP::CmdLSTT(const char *Option) void cSVDRP::CmdLSTT(const char *Option)
{ {
if (*Option) { if (*Option) {
@ -910,12 +972,14 @@ void cSVDRP::Execute(char *Cmd)
s = skipspace(s); s = skipspace(s);
if (CMD("CHAN")) CmdCHAN(s); if (CMD("CHAN")) CmdCHAN(s);
else if (CMD("DELC")) CmdDELC(s); else if (CMD("DELC")) CmdDELC(s);
else if (CMD("DELR")) CmdDELR(s);
else if (CMD("DELT")) CmdDELT(s); else if (CMD("DELT")) CmdDELT(s);
else if (CMD("GRAB")) CmdGRAB(s); else if (CMD("GRAB")) CmdGRAB(s);
else if (CMD("HELP")) CmdHELP(s); else if (CMD("HELP")) CmdHELP(s);
else if (CMD("HITK")) CmdHITK(s); else if (CMD("HITK")) CmdHITK(s);
else if (CMD("LSTC")) CmdLSTC(s); else if (CMD("LSTC")) CmdLSTC(s);
else if (CMD("LSTE")) CmdLSTE(s); else if (CMD("LSTE")) CmdLSTE(s);
else if (CMD("LSTR")) CmdLSTR(s);
else if (CMD("LSTT")) CmdLSTT(s); else if (CMD("LSTT")) CmdLSTT(s);
else if (CMD("MESG")) CmdMESG(s); else if (CMD("MESG")) CmdMESG(s);
else if (CMD("MODC")) CmdMODC(s); else if (CMD("MODC")) CmdMODC(s);

View File

@ -4,13 +4,14 @@
* See the main source file 'vdr.c' for copyright information and * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * how to reach the author.
* *
* $Id: svdrp.h 1.11 2001/09/14 14:35:34 kls Exp $ * $Id: svdrp.h 1.12 2001/10/27 11:36:49 kls Exp $
*/ */
#ifndef __SVDRP_H #ifndef __SVDRP_H
#define __SVDRP_H #define __SVDRP_H
#include "dvbapi.h" #include "dvbapi.h"
#include "recording.h"
#include "tools.h" #include "tools.h"
class cSocket { class cSocket {
@ -31,6 +32,7 @@ private:
cSocket socket; cSocket socket;
cFile file; cFile file;
CRect ovlClipRects[MAXCLIPRECTS]; CRect ovlClipRects[MAXCLIPRECTS];
cRecordings Recordings;
uint numChars; uint numChars;
char cmdLine[MAXPARSEBUFFER]; char cmdLine[MAXPARSEBUFFER];
char *message; char *message;
@ -40,12 +42,14 @@ private:
void Reply(int Code, const char *fmt, ...); void Reply(int Code, const char *fmt, ...);
void CmdCHAN(const char *Option); void CmdCHAN(const char *Option);
void CmdDELC(const char *Option); void CmdDELC(const char *Option);
void CmdDELR(const char *Option);
void CmdDELT(const char *Option); void CmdDELT(const char *Option);
void CmdGRAB(const char *Option); void CmdGRAB(const char *Option);
void CmdHELP(const char *Option); void CmdHELP(const char *Option);
void CmdHITK(const char *Option); void CmdHITK(const char *Option);
void CmdLSTC(const char *Option); void CmdLSTC(const char *Option);
void CmdLSTE(const char *Option); void CmdLSTE(const char *Option);
void CmdLSTR(const char *Option);
void CmdLSTT(const char *Option); void CmdLSTT(const char *Option);
void CmdMESG(const char *Option); void CmdMESG(const char *Option);
void CmdMODC(const char *Option); void CmdMODC(const char *Option);