Fixed the SVDRP command UPDR, which didn't update the global recordings list

This commit is contained in:
Klaus Schmidinger 2012-04-26 10:48:18 +02:00
parent b5ddaedfb3
commit 71d53f2c63
4 changed files with 19 additions and 16 deletions

View File

@ -2723,6 +2723,7 @@ Lars Hanisch <dvb@flensrocker.de>
for suggesting to assign the source character 'V' to "Analog Video" for suggesting to assign the source character 'V' to "Analog Video"
for a patch that was used to implement SCR (Satellite Channel Routing) for a patch that was used to implement SCR (Satellite Channel Routing)
for implementing the SVDRP command 'UPDR' for implementing the SVDRP command 'UPDR'
for reporting that the SVDRP command UPDR didn't update the global recordings list
Alex Lasnier <alex@fepg.org> Alex Lasnier <alex@fepg.org>
for adding tuning support for ATSC devices for adding tuning support for ATSC devices

View File

@ -7087,3 +7087,5 @@ Video Disk Recorder Revision History
- The Timers list is now marked as modified whenever a recording starts or ends. - The Timers list is now marked as modified whenever a recording starts or ends.
- Fixed cDevice::StillPicture(), making sure it doesn't call the derived class's - Fixed cDevice::StillPicture(), making sure it doesn't call the derived class's
function if no buffer has been allocated. function if no buffer has been allocated.
- Fixed the SVDRP command UPDR, which didn't update the global recordings list
(reported by Lars Hanisch).

28
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 2.16 2012/03/04 12:05:56 kls Exp $ * $Id: svdrp.c 2.17 2012/04/26 10:36:11 kls Exp $
*/ */
#include "svdrp.h" #include "svdrp.h"
@ -662,14 +662,14 @@ void cSVDRP::CmdDELR(const char *Option)
{ {
if (*Option) { if (*Option) {
if (isnumber(Option)) { if (isnumber(Option)) {
cRecording *recording = Recordings.Get(strtol(Option, NULL, 10) - 1); cRecording *recording = recordings.Get(strtol(Option, NULL, 10) - 1);
if (recording) { if (recording) {
cRecordControl *rc = cRecordControls::GetRecordControl(recording->FileName()); cRecordControl *rc = cRecordControls::GetRecordControl(recording->FileName());
if (!rc) { if (!rc) {
if (!cCutter::Active(recording->FileName())) { if (!cCutter::Active(recording->FileName())) {
if (recording->Delete()) { if (recording->Delete()) {
Reply(250, "Recording \"%s\" deleted", Option); Reply(250, "Recording \"%s\" deleted", Option);
::Recordings.DelByName(recording->FileName()); Recordings.DelByName(recording->FileName());
} }
else else
Reply(554, "Error while deleting recording!"); Reply(554, "Error while deleting recording!");
@ -681,7 +681,7 @@ void cSVDRP::CmdDELR(const char *Option)
Reply(550, "Recording \"%s\" is in use by timer %d", Option, rc->Timer()->Index() + 1); Reply(550, "Recording \"%s\" is in use by timer %d", Option, rc->Timer()->Index() + 1);
} }
else else
Reply(550, "Recording \"%s\" not found%s", Option, Recordings.Count() ? "" : " (use LSTR before deleting)"); Reply(550, "Recording \"%s\" not found%s", Option, recordings.Count() ? "" : " (use LSTR before deleting)");
} }
else else
Reply(501, "Error in recording number \"%s\"", Option); Reply(501, "Error in recording number \"%s\"", Option);
@ -723,7 +723,7 @@ void cSVDRP::CmdEDIT(const char *Option)
{ {
if (*Option) { if (*Option) {
if (isnumber(Option)) { if (isnumber(Option)) {
cRecording *recording = Recordings.Get(strtol(Option, NULL, 10) - 1); cRecording *recording = recordings.Get(strtol(Option, NULL, 10) - 1);
if (recording) { if (recording) {
cMarks Marks; cMarks Marks;
if (Marks.Load(recording->FileName(), recording->FramesPerSecond(), recording->IsPesRecording()) && Marks.Count()) { if (Marks.Load(recording->FileName(), recording->FramesPerSecond(), recording->IsPesRecording()) && Marks.Count()) {
@ -740,7 +740,7 @@ void cSVDRP::CmdEDIT(const char *Option)
Reply(554, "No editing marks defined"); Reply(554, "No editing marks defined");
} }
else else
Reply(550, "Recording \"%s\" not found%s", Option, Recordings.Count() ? "" : " (use LSTR before editing)"); Reply(550, "Recording \"%s\" not found%s", Option, recordings.Count() ? "" : " (use LSTR before editing)");
} }
else else
Reply(501, "Error in recording number \"%s\"", Option); Reply(501, "Error in recording number \"%s\"", Option);
@ -1076,10 +1076,10 @@ void cSVDRP::CmdLSTE(const char *Option)
void cSVDRP::CmdLSTR(const char *Option) void cSVDRP::CmdLSTR(const char *Option)
{ {
bool recordings = Recordings.Update(true); recordings.Update(true);
if (*Option) { if (*Option) {
if (isnumber(Option)) { if (isnumber(Option)) {
cRecording *recording = Recordings.Get(strtol(Option, NULL, 10) - 1); cRecording *recording = recordings.Get(strtol(Option, NULL, 10) - 1);
if (recording) { if (recording) {
FILE *f = fdopen(file, "w"); FILE *f = fdopen(file, "w");
if (f) { if (f) {
@ -1097,11 +1097,11 @@ void cSVDRP::CmdLSTR(const char *Option)
else else
Reply(501, "Error in recording number \"%s\"", Option); Reply(501, "Error in recording number \"%s\"", Option);
} }
else if (recordings) { else if (recordings.Count()) {
cRecording *recording = Recordings.First(); cRecording *recording = recordings.First();
while (recording) { while (recording) {
Reply(recording == Recordings.Last() ? 250 : -250, "%d %s", recording->Index() + 1, recording->Title(' ', true)); Reply(recording == recordings.Last() ? 250 : -250, "%d %s", recording->Index() + 1, recording->Title(' ', true));
recording = Recordings.Next(recording); recording = recordings.Next(recording);
} }
} }
else else
@ -1367,7 +1367,7 @@ void cSVDRP::CmdPLAY(const char *Option)
char c = *option; char c = *option;
*option = 0; *option = 0;
if (isnumber(num)) { if (isnumber(num)) {
cRecording *recording = Recordings.Get(strtol(num, NULL, 10) - 1); cRecording *recording = recordings.Get(strtol(num, NULL, 10) - 1);
if (recording) { if (recording) {
if (c) if (c)
option = skipspace(++option); option = skipspace(++option);
@ -1389,7 +1389,7 @@ void cSVDRP::CmdPLAY(const char *Option)
Reply(250, "Playing recording \"%s\" [%s]", num, recording->Title()); Reply(250, "Playing recording \"%s\" [%s]", num, recording->Title());
} }
else else
Reply(550, "Recording \"%s\" not found%s", num, Recordings.Count() ? "" : " (use LSTR before playing)"); Reply(550, "Recording \"%s\" not found%s", num, recordings.Count() ? "" : " (use LSTR before playing)");
} }
else else
Reply(501, "Error in recording number \"%s\"", num); Reply(501, "Error in recording number \"%s\"", num);

View File

@ -4,7 +4,7 @@
* 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 2.2 2012/02/16 12:37:53 kls Exp $ * $Id: svdrp.h 2.3 2012/04/26 10:30:06 kls Exp $
*/ */
#ifndef __SVDRP_H #ifndef __SVDRP_H
@ -43,7 +43,7 @@ class cSVDRP {
private: private:
cSocket socket; cSocket socket;
cFile file; cFile file;
cRecordings Recordings; cRecordings recordings;
cPUTEhandler *PUTEhandler; cPUTEhandler *PUTEhandler;
int numChars; int numChars;
int length; int length;