vdr-1.3.31 - Implement moving channels via svdrp
Commit Message
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
Comments
Andreas Brachold wrote:
> 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.
Thanks, added for version 1.3.32.
Although, the formatting was still pretty off... ;-)
I wonder what it is with people not putting a blank between 'if'
and the opening '(', or after a ','...
Klaus
@@ -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)