diff options
author | Christian Wieninger <cwieninger (at) gmx (dot) de> | 2009-01-29 19:13:14 +0100 |
---|---|---|
committer | Christian Wieninger <cwieninger (at) gmx (dot) de> | 2009-01-29 19:13:14 +0100 |
commit | 2e8ffba44e4611f214e87391d4000b1b90edf4c6 (patch) | |
tree | b9d966af294db2381393dcee4ff876826b4895e4 /switchtimer_thread.c | |
parent | 3f7d506918dd62b5dda2d559aa6f81efbb98fe5f (diff) | |
download | vdr-plugin-epgsearch-2e8ffba44e4611f214e87391d4000b1b90edf4c6.tar.gz vdr-plugin-epgsearch-2e8ffba44e4611f214e87391d4000b1b90edf4c6.tar.bz2 |
new search timer action 'announce and switch', headers adjusted to 2009
Diffstat (limited to 'switchtimer_thread.c')
-rw-r--r-- | switchtimer_thread.c | 40 |
1 files changed, 30 insertions, 10 deletions
diff --git a/switchtimer_thread.c b/switchtimer_thread.c index 2988498..88d4696 100644 --- a/switchtimer_thread.c +++ b/switchtimer_thread.c @@ -1,5 +1,5 @@ /* -Copyright (C) 2004-2008 Christian Wieninger +Copyright (C) 2004-2009 Christian Wieninger This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License @@ -88,24 +88,44 @@ void cSwitchTimerThread::Action(void) if (event && event->StartTime() - now < switchTimer->switchMinsBefore*60 + MSG_DELAY + 1) { cChannel *channel = Channels.GetByChannelID(event->ChannelID(), true, true); - bool doswitch = (switchTimer->announceOnly == 0); + bool doSwitch = (switchTimer->mode == 0); + bool doAsk = (switchTimer->mode == 2); + bool doUnmute = switchTimer->unmute; SwitchTimers.Del(switchTimer); + if (channel && (event->EndTime() >= now)) { - // announce and switch - if (doswitch) + cString Message = cString::sprintf("%s: %s - %s", event->Title(), + CHANNELNAME(channel), GETTIMESTRING(event)); + cString SwitchCmd = cString::sprintf("CHAN %d", channel->Number()); + // switch + if (doSwitch) { LogFile.Log(1,"switching to channel %d", channel->Number()); - cString cmd = cString::sprintf("CHAN %d", channel->Number()); if (cDevice::CurrentChannel() != channel->Number()) - SendViaSVDRP(cmd); + SendViaSVDRP(SwitchCmd); - if (switchTimer->unmute && cDevice::PrimaryDevice()->IsMute()) + if (doUnmute && cDevice::PrimaryDevice()->IsMute()) cDevice::PrimaryDevice()->ToggleMute(); } - cString Message = cString::sprintf("%s: %s - %s", event->Title(), - CHANNELNAME(channel), GETTIMESTRING(event)); - SendMsg(Message); + if (!doAsk) + SendMsg(Message); + + if (doAsk) + { + cString Message = cString::sprintf(tr("%s starts: switch to?"), event->Title()); + if(SendMsg(Message, true,7) == kOk) + { + LogFile.Log(1,"switching to channel %d", channel->Number()); + if (cDevice::CurrentChannel() != channel->Number()) + SendViaSVDRP(SwitchCmd); + + if (doUnmute && cDevice::PrimaryDevice()->IsMute()) + cDevice::PrimaryDevice()->ToggleMute(); + + } + } + if (m_Active) Wait.Wait(1000 * MSG_DELAY); } |