summaryrefslogtreecommitdiff
path: root/svdrp.c
diff options
context:
space:
mode:
authorKlaus Schmidinger <vdr@tvdr.de>2013-01-15 13:29:39 +0100
committerKlaus Schmidinger <vdr@tvdr.de>2013-01-15 13:29:39 +0100
commit89dc5927278d7ff348c380ab58e66e6b7642530b (patch)
tree76b12460fcf117c2b71729f4e0365c26366c5f48 /svdrp.c
parenta5a8bf0164a5b47ab7624346d346dafd623727a1 (diff)
downloadvdr-89dc5927278d7ff348c380ab58e66e6b7642530b.tar.gz
vdr-89dc5927278d7ff348c380ab58e66e6b7642530b.tar.bz2
The SVDRP command LSTR now knows the additional parameter "path", which can be given to get the actual file name of a recording's directory
Diffstat (limited to 'svdrp.c')
-rw-r--r--svdrp.c46
1 files changed, 37 insertions, 9 deletions
diff --git a/svdrp.c b/svdrp.c
index 0313280b..89cd000e 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 2.21 2012/12/04 12:08:36 kls Exp $
+ * $Id: svdrp.c 2.22 2013/01/15 13:21:10 kls Exp $
*/
#include "svdrp.h"
@@ -236,9 +236,11 @@ const char *HelpPages[] = {
" only data for that channel is listed. 'now', 'next', or 'at <time>'\n"
" restricts the returned data to present events, following events, or\n"
" events at the given time (which must be in time_t form).",
- "LSTR [ <number> ]\n"
+ "LSTR [ <number> [ path ] ]\n"
" List recordings. Without option, all recordings are listed. Otherwise\n"
- " the information for the given recording is listed.",
+ " the information for the given recording is listed. If a recording\n"
+ " number and the keyword 'path' is given, the actual file name of that\n"
+ " recording's directory is listed.",
"LSTT [ <number> ] [ id ]\n"
" List timers. Without option, all timers are listed. Otherwise\n"
" only the given timer is listed. If the keyword 'id' is given, the\n"
@@ -1080,16 +1082,44 @@ void cSVDRP::CmdLSTE(const char *Option)
void cSVDRP::CmdLSTR(const char *Option)
{
+ int Number = 0;
+ bool Path = false;
recordings.Update(true);
if (*Option) {
- if (isnumber(Option)) {
+ char buf[strlen(Option) + 1];
+ strcpy(buf, Option);
+ const char *delim = " \t";
+ char *strtok_next;
+ char *p = strtok_r(buf, delim, &strtok_next);
+ while (p) {
+ if (!Number) {
+ if (isnumber(p))
+ Number = strtol(p, NULL, 10);
+ else {
+ Reply(501, "Error in recording number \"%s\"", Option);
+ return;
+ }
+ }
+ else if (strcasecmp(p, "PATH") == 0)
+ Path = true;
+ else {
+ Reply(501, "Unknown option: \"%s\"", p);
+ return;
+ }
+ p = strtok_r(NULL, delim, &strtok_next);
+ }
+ if (Number) {
cRecording *recording = recordings.Get(strtol(Option, NULL, 10) - 1);
if (recording) {
FILE *f = fdopen(file, "w");
if (f) {
- recording->Info()->Write(f, "215-");
- fflush(f);
- Reply(215, "End of recording information");
+ if (Path)
+ Reply(250, "%s", recording->FileName());
+ else {
+ recording->Info()->Write(f, "215-");
+ fflush(f);
+ Reply(215, "End of recording information");
+ }
// don't 'fclose(f)' here!
}
else
@@ -1098,8 +1128,6 @@ void cSVDRP::CmdLSTR(const char *Option)
else
Reply(550, "Recording \"%s\" not found", Option);
}
- else
- Reply(501, "Error in recording number \"%s\"", Option);
}
else if (recordings.Count()) {
cRecording *recording = recordings.First();