Implemented the SVDRP command MOVC

This commit is contained in:
Klaus Schmidinger 2005-09-03 14:10:01 +02:00
parent 06117cbaab
commit 9e864aba12
3 changed files with 48 additions and 3 deletions

View File

@ -830,6 +830,7 @@ Andreas Brachold <vdr04@deltab.de>
umask settings
for reporting that there are empty info.vdr files created if there is no EPG
info available
for implementing the SVDRP command MOVC
Manuel Hartl <icecep@gmx.net>
for suggesting to extend the logging info when starting/stopping timers

View File

@ -3789,3 +3789,4 @@ Video Disk Recorder Revision History
creates a VDR that always behaves as if it were called with '--vfat'.
- Replaced the ':' delimiter between hour and minute in recording file names with
a '.' under Linux, too. Existing recordings with ':' as delimiter will still work.
- Implemented the SVDRP command MOVC (thanks to Andreas Brachold).

49
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 1.79 2005/09/03 12:46:57 kls Exp $
* $Id: svdrp.c 1.80 2005/09/03 14:09:02 kls Exp $
*/
#include "svdrp.h"
@ -1039,8 +1039,51 @@ void cSVDRP::CmdMODT(const char *Option)
void cSVDRP::CmdMOVC(const char *Option)
{
//TODO combine this with menu action (timers must be updated)
Reply(502, "MOVC not yet implemented");
if (*Option) {
if (!Channels.BeingEdited() && !Timers.BeingEdited()) {
char *tail;
int From = strtol(Option, &tail, 10);
if (tail && tail != Option) {
tail = skipspace(tail);
if (tail && tail != Option) {
int To = strtol(tail, NULL, 10);
int CurrentChannelNr = cDevice::CurrentChannel();
cChannel *CurrentChannel = Channels.GetByNumber(CurrentChannelNr);
cChannel *FromChannel = Channels.GetByNumber(From);
if (FromChannel) {
cChannel *ToChannel = Channels.GetByNumber(To);
if (ToChannel) {
int FromNumber = FromChannel->Number();
int ToNumber = ToChannel->Number();
if (FromNumber != ToNumber) {
Channels.Move(FromChannel, ToChannel);
Channels.ReNumber();
Channels.SetModified(true);
if (CurrentChannel && CurrentChannel->Number() != CurrentChannelNr)
Channels.SwitchTo(CurrentChannel->Number());
isyslog("channel %d moved to %d", FromNumber, ToNumber);
Reply(250,"Channel \"%d\" moved to \"%d\"", From, To);
}
else
Reply(501, "Can't move channel to same postion");
}
else
Reply(501, "Channel \"%d\" not defined", To);
}
else
Reply(501, "Channel \"%d\" not defined", From);
}
else
Reply(501, "Error in channel number");
}
else
Reply(501, "Error in channel number");
}
else
Reply(550, "Channels or timers are being edited - try again later");
}
else
Reply(501, "Missing channel number");
}
void cSVDRP::CmdMOVT(const char *Option)