From dc6666d53c1873f01376bdd67fa3e3bc324bb349 Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Sat, 3 Jun 2006 09:25:13 +0200 Subject: [PATCH] Applied the fixes to moving and deleting channels from version 1.4.0-2 to the SVDRP commands MOVC and DELC as well --- HISTORY | 4 +++- svdrp.c | 25 ++++++++++++++++++++++--- 2 files changed, 25 insertions(+), 4 deletions(-) diff --git a/HISTORY b/HISTORY index c064ac17..c3d5c4d7 100644 --- a/HISTORY +++ b/HISTORY @@ -4746,7 +4746,7 @@ Video Disk Recorder Revision History - Fixed deleting channels in case the current channel's number changes (reported by Mirko Dölle). -2006-06-02: Version 1.4.0-3 +2006-06-03: Version 1.4.0-3 - Fixed the PremiereContentTransmissionDescriptor in 'libsi' (thanks to Stefan Huelswitt). @@ -4758,3 +4758,5 @@ Video Disk Recorder Revision History presumably a NOP, anyway. - Fixed the 'clean-plugins' target in the Makefile to also remove additional plugin libraries (thanks to Wayne Keer). +- Applied the fixes to moving and deleting channels from version 1.4.0-2 to the + SVDRP commands MOVC and DELC as well. diff --git a/svdrp.c b/svdrp.c index e0b56e43..0f6060c1 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.95 2006/04/17 09:02:23 kls Exp $ + * $Id: svdrp.c 1.96 2006/06/03 09:17:17 kls Exp $ */ #include "svdrp.h" @@ -550,10 +550,25 @@ void cSVDRP::CmdDELC(const char *Option) return; } } + int CurrentChannelNr = cDevice::CurrentChannel(); + cChannel *CurrentChannel = Channels.GetByNumber(CurrentChannelNr); + if (CurrentChannel && channel == CurrentChannel) { + int n = Channels.GetNextNormal(CurrentChannel->Index()); + if (n < 0) + n = Channels.GetPrevNormal(CurrentChannel->Index()); + CurrentChannel = Channels.Get(n); + CurrentChannelNr = 0; // triggers channel switch below + } Channels.Del(channel); Channels.ReNumber(); Channels.SetModified(true); isyslog("channel %s deleted", Option); + if (CurrentChannel && CurrentChannel->Number() != CurrentChannelNr) { + if (!cDevice::PrimaryDevice()->Replaying() || cDevice::PrimaryDevice()->Transferring()) + Channels.SwitchTo(CurrentChannel->Number()); + else + cDevice::SetCurrentChannel(CurrentChannel); + } Reply(250, "Channel \"%s\" deleted", Option); } else @@ -1158,8 +1173,12 @@ void cSVDRP::CmdMOVC(const char *Option) Channels.Move(FromChannel, ToChannel); Channels.ReNumber(); Channels.SetModified(true); - if (CurrentChannel && CurrentChannel->Number() != CurrentChannelNr) - Channels.SwitchTo(CurrentChannel->Number()); + if (CurrentChannel && CurrentChannel->Number() != CurrentChannelNr) { + if (!cDevice::PrimaryDevice()->Replaying() || cDevice::PrimaryDevice()->Transferring()) + Channels.SwitchTo(CurrentChannel->Number()); + else + cDevice::SetCurrentChannel(CurrentChannel); + } isyslog("channel %d moved to %d", FromNumber, ToNumber); Reply(250,"Channel \"%d\" moved to \"%d\"", From, To); }