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

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

This commit is contained in:
Klaus Schmidinger 2013-01-15 13:29:39 +01:00
parent a5a8bf0164
commit 89dc592727
3 changed files with 45 additions and 10 deletions

View File

@ -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

View File

@ -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).

46
svdrp.c
View File

@ -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();