From 9e864aba12553c2bd5a157cf94b7fee49c6d88ce Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Sat, 3 Sep 2005 14:10:01 +0200 Subject: Implemented the SVDRP command MOVC --- CONTRIBUTORS | 1 + HISTORY | 1 + svdrp.c | 49 ++++++++++++++++++++++++++++++++++++++++++++++--- 3 files changed, 48 insertions(+), 3 deletions(-) diff --git a/CONTRIBUTORS b/CONTRIBUTORS index 4d7b64c0..c5c7fe72 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -830,6 +830,7 @@ Andreas Brachold 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 for suggesting to extend the logging info when starting/stopping timers diff --git a/HISTORY b/HISTORY index bbddc4e1..a9ced0a9 100644 --- a/HISTORY +++ b/HISTORY @@ -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). diff --git a/svdrp.c b/svdrp.c index e1364df5..2c567aa1 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 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) -- cgit v1.2.3