diff options
author | Klaus Schmidinger <vdr@tvdr.de> | 2013-01-15 13:29:39 +0100 |
---|---|---|
committer | Klaus Schmidinger <vdr@tvdr.de> | 2013-01-15 13:29:39 +0100 |
commit | 89dc5927278d7ff348c380ab58e66e6b7642530b (patch) | |
tree | 76b12460fcf117c2b71729f4e0365c26366c5f48 | |
parent | a5a8bf0164a5b47ab7624346d346dafd623727a1 (diff) | |
download | vdr-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
-rw-r--r-- | CONTRIBUTORS | 4 | ||||
-rw-r--r-- | HISTORY | 5 | ||||
-rw-r--r-- | svdrp.c | 46 |
3 files changed, 45 insertions, 10 deletions
diff --git a/CONTRIBUTORS b/CONTRIBUTORS index bb59d228..7e565ebb 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -3040,3 +3040,7 @@ Stefan Blochberger <Stefan.Blochberger@gmx.de> Cedric Dewijs <cedric.dewijs@telfort.nl> for adding maximum SNR value for PCTV Systems PCTV 73ESE + +Stefan Stolz <st.stolz@gmail.com> + for suggesting to make the SVDRP command LSTR optionally list the actual file name of + a recording's directory @@ -7494,7 +7494,7 @@ Video Disk Recorder Revision History use it. - Added maximum SNR value for PCTV Systems PCTV 73ESE (thanks to Cedric Dewijs). -2013-01-13: Version 1.7.36 +2013-01-15: Version 1.7.36 - Added maximum SNR value for PCTV Systems nanoStick T2 290e (thanks to Antti Hartikainen). @@ -7518,3 +7518,6 @@ Video Disk Recorder Revision History as in "abc" and "abc2" (reported by Andreas Mair). - Added "repeat" function when using the keyboard to control VDR (thanks to Reinhard Nissl). +- 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 (suggested by + Stefan Stolz). @@ -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(); |