From patchwork Sat Sep 3 13:55:21 2005 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Brachold X-Patchwork-Id: 12004 Received: from web1.dns-net.de ([212.91.231.162]) by www.linuxtv.org with esmtp (Exim 4.34) id 1EBYUa-0000Jg-Io for vdr@linuxtv.org; Sat, 03 Sep 2005 15:55:36 +0200 Received: from wopr.deltab.de (n117-020.dsl.de.inter.net [213.73.117.20]) by web1.dns-net.de (8.11.6/8.11.6) with ESMTP id j83DtRT06377 for ; Sat, 3 Sep 2005 15:55:27 +0200 Subject: [vdr] vdr-1.3.31 - Implement moving channels via svdrp From: Andreas Brachold To: "Klaus Schmidinger's VDR" In-Reply-To: <431976BD.1050405@cadsoft.de> References: <1125738125.6283.14.camel@wopr.deltab.de> <431976BD.1050405@cadsoft.de> Date: Sat, 03 Sep 2005 15:55:21 +0200 Message-Id: <1125755721.6330.4.camel@wopr.deltab.de> Mime-Version: 1.0 X-Mailer: Evolution 2.0.4 X-BeenThere: vdr@linuxtv.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Klaus Schmidinger's VDR List-Id: Klaus Schmidinger's VDR List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 03 Sep 2005 13:55:36 -0000 Status: O X-Status: X-Keywords: X-UID: 4723 Hi, Klaus Schmidinger wrote: > Andreas Brachold wrote: > > ... > > BTW : Is there any chance that my patch for SVDRP/MOVC integrated, > > it completed only the listed SVDRP commands !? > > This function a missed for external channels editing. > > http://www.linuxtv.org/pipermail/vdr/2005-August/004512.html > > Chances would be better if you had structured and formatted it the > same way all the other SVDRP command functions are formatted ;-) > Ok, i don't would break the prior codings style. Here is a reformated patch, that too implement moving channels via svdrp. Andreas --- svdrp.c.orig 2005-09-03 13:43:32.000000000 +0200 +++ svdrp.c 2005-09-03 13:59:03.000000000 +0200 @@ -1035,8 +1035,52 @@ 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 settings"); + } + else + Reply(501, "Error in channel settings"); + } + else + Reply(550, "Channels or Timers are being edited - try again later"); + } + else + Reply(501, "Error in channel settings"); } void cSVDRP::CmdMOVT(const char *Option)