From ee27180c94a6644d23986bb7b66c4b001aee3a76 Mon Sep 17 00:00:00 2001 From: vanhofen Date: Sun, 25 Sep 2016 01:36:49 +0200 Subject: [PATCH 1/9] imageinfo_ni: smoother view when no .version file is found Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/74b5e4acec3171f03098447e0dcacd4e8f3511bb Author: vanhofen Date: 2016-09-25 (Sun, 25 Sep 2016) Origin message was: ------------------ - imageinfo_ni: smoother view when no .version file is found --- src/gui/imageinfo_ni.cpp | 49 ++++++++++++++++++++-------------------- 1 file changed, 25 insertions(+), 24 deletions(-) diff --git a/src/gui/imageinfo_ni.cpp b/src/gui/imageinfo_ni.cpp index eb8da53ae..a5c22102b 100644 --- a/src/gui/imageinfo_ni.cpp +++ b/src/gui/imageinfo_ni.cpp @@ -222,9 +222,6 @@ void CImageInfoNI::paint() const char * head_string; int xpos = x+10; - std::ostringstream imageversion; - std::ostringstream commits; - ypos = y; head_string = g_Locale->getText(LOCALE_IMAGEINFO_HEAD); @@ -241,52 +238,56 @@ void CImageInfoNI::paint() CConfigFile config('\t'); config.loadConfig("/.version"); - std::string imagename = config.getString("imagename", "NI-Neutrino-HD"); - std::string homepage = config.getString("homepage", "www.neutrino-images.de"); - std::string creator = config.getString("creator", "NI-Team"); - std::string version = config.getString("version", "no version"); - std::string origin_commit = config.getString("origin-commit", "no commit"); - std::string builddate = config.getString("builddate", "no builddate"); + std::string imagename = config.getString("imagename", "NI-Neutrino-HD"); + std::string homepage = config.getString("homepage", "www.neutrino-images.de"); + std::string creator = config.getString("creator", "NI-Team"); + std::string version = config.getString("version", "n/a"); + std::string commit = config.getString("commit", "n/a"); + std::string builddate = config.getString("builddate", "n/a"); - static CFlashVersionInfo versionInfo(version); - std::string releaseCycle = versionInfo.getReleaseCycle(); - - struct utsname uts_info; + std::ostringstream imageversion; + imageversion.str("n/a"); - imageversion << releaseCycle << " (" << versionInfo.getType() << ")"; - commits << "NI: " << origin_commit; + if (version.compare("n/a") != 0) + { + static CFlashVersionInfo versionInfo(version); + std::string releaseCycle = versionInfo.getReleaseCycle(); + imageversion.str(""); + imageversion << releaseCycle << " (" << versionInfo.getType() << ")"; + } ypos += iheight; - paintLine(xpos , font_info, g_Locale->getText(LOCALE_IMAGEINFO_IMAGE)); + paintLine(xpos, font_info, g_Locale->getText(LOCALE_IMAGEINFO_IMAGE)); paintLine(xpos+offset, font_info, imagename); ypos += iheight; - paintLine(xpos , font_info, g_Locale->getText(LOCALE_IMAGEINFO_VERSION)); + paintLine(xpos, font_info, g_Locale->getText(LOCALE_IMAGEINFO_VERSION)); paintLine(xpos+offset, font_info, imageversion.str()); ypos += iheight; - paintLine(xpos , font_info, "Commit:"); - paintLine(xpos+offset, font_info, commits.str()); + paintLine(xpos, font_info, "Commit:"); + paintLine(xpos+offset, font_info, commit); + + struct utsname uts_info; ypos += iheight; - paintLine(xpos , font_info, "Kernel:"); + paintLine(xpos, font_info, "Kernel:"); paintLine(xpos+offset, font_info, uname(&uts_info) < 0 ? "n/a" : uts_info.release); ypos += iheight; - paintLine(xpos , font_info, g_Locale->getText(LOCALE_IMAGEINFO_DATE)); + paintLine(xpos, font_info, g_Locale->getText(LOCALE_IMAGEINFO_DATE)); paintLine(xpos+offset, font_info, builddate ); ypos += iheight; - paintLine(xpos , font_info, g_Locale->getText(LOCALE_IMAGEINFO_CREATOR)); + paintLine(xpos, font_info, g_Locale->getText(LOCALE_IMAGEINFO_CREATOR)); paintLine(xpos+offset, font_info, creator); ypos += iheight; - paintLine(xpos , font_info, g_Locale->getText(LOCALE_IMAGEINFO_HOMEPAGE)); + paintLine(xpos, font_info, g_Locale->getText(LOCALE_IMAGEINFO_HOMEPAGE)); paintLine(xpos+offset, font_info, homepage); ypos += iheight; - ypos += sheight; get_MTD_Info(); From a5afc7df3c66a0bde5e74c696561b611a6e50f4d Mon Sep 17 00:00:00 2001 From: vanhofen Date: Mon, 26 Sep 2016 13:04:47 +0200 Subject: [PATCH 2/9] src/zapit/src/Makefile.am: add @FREETYPE_CFLAGS@ to avoid build fails Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/9a36f6f1e6f028d77254737fb7f00fb3e336ddee Author: vanhofen Date: 2016-09-26 (Mon, 26 Sep 2016) Origin message was: ------------------ - src/zapit/src/Makefile.am: add @FREETYPE_CFLAGS@ to avoid build fails --- src/zapit/src/Makefile.am | 1 + 1 file changed, 1 insertion(+) diff --git a/src/zapit/src/Makefile.am b/src/zapit/src/Makefile.am index 9ece8df27..a1dac17bc 100644 --- a/src/zapit/src/Makefile.am +++ b/src/zapit/src/Makefile.am @@ -10,6 +10,7 @@ AM_CPPFLAGS += \ -I$(top_srcdir)/lib/connection \ -I$(top_srcdir)/lib/libeventserver \ -I$(top_srcdir)/lib/xmltree \ + @FREETYPE_CFLAGS@ \ @HWLIB_CFLAGS@ noinst_LIBRARIES = libzapit.a From 6836ea5d78747ddc8ee232e97ac9f8231f4aff11 Mon Sep 17 00:00:00 2001 From: martii Date: Mon, 26 Sep 2016 13:04:48 +0200 Subject: [PATCH 3/9] timerd: adjust recording timers to epg Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/c07b0f0b6c82bac3e98f9d1ccd541ee35d7acc55 Author: martii Date: 2016-09-26 (Mon, 26 Sep 2016) --- lib/timerdclient/timerdclient.cpp | 1 + lib/timerdclient/timerdclient.h | 4 ++- lib/timerdclient/timerdtypes.h | 4 +++ src/gui/epgview.cpp | 4 +-- src/gui/followscreenings.cpp | 2 +- src/gui/timerlist.cpp | 2 ++ src/timerd/timerd.cpp | 6 ++-- src/timerd/timermanager.cpp | 49 ++++++++++++++++++++++++++++++- src/timerd/timermanager.h | 6 +++- 9 files changed, 70 insertions(+), 8 deletions(-) diff --git a/lib/timerdclient/timerdclient.cpp b/lib/timerdclient/timerdclient.cpp index f25f8ffcf..abd65735e 100644 --- a/lib/timerdclient/timerdclient.cpp +++ b/lib/timerdclient/timerdclient.cpp @@ -330,6 +330,7 @@ int CTimerdClient::addTimerEvent( CTimerd::CTimerEventTypes evType, void* data, tri.epg_starttime = ri->epg_starttime; tri.epgID = ri->epgID; tri.recordingSafety = ri->recordingSafety; + tri.autoAdjustToEPG = ri->autoAdjustToEPG; strncpy(tri.recordingDir, ri->recordingDir, RECORD_DIR_MAXLEN-1); length = sizeof( CTimerd::TransferRecordingInfo); data = &tri; diff --git a/lib/timerdclient/timerdclient.h b/lib/timerdclient/timerdclient.h index 212f94cfa..94ae1b483 100644 --- a/lib/timerdclient/timerdclient.h +++ b/lib/timerdclient/timerdclient.h @@ -111,7 +111,7 @@ class CTimerdClient:private CBasicClient // adds new record timer event int addRecordTimerEvent(const t_channel_id channel_id, time_t alarmtime, time_t stoptime, uint64_t epgID=0, time_t epg_starttime=0, time_t announcetime = 0, - unsigned char apids=TIMERD_APIDS_STD, bool safety=false,std::string recDir="", bool forceAdd=true) + unsigned char apids=TIMERD_APIDS_STD, bool safety=false,bool autoAdjust=false, std::string recDir="", bool forceAdd=true) { CTimerd::RecordingInfo eventInfo; eventInfo.channel_id = channel_id; @@ -119,6 +119,7 @@ class CTimerdClient:private CBasicClient eventInfo.epg_starttime = epg_starttime; eventInfo.apids = apids; eventInfo.recordingSafety = safety; + eventInfo.autoAdjustToEPG = autoAdjust; strncpy(eventInfo.recordingDir, recDir.c_str(), RECORD_DIR_MAXLEN); return addTimerEvent(CTimerd::TIMER_RECORD, &eventInfo, announcetime, alarmtime, stoptime,CTimerd::TIMERREPEAT_ONCE, 0,forceAdd); }; @@ -132,6 +133,7 @@ class CTimerdClient:private CBasicClient eventInfo.epg_starttime = epg_starttime; eventInfo.apids = apids; eventInfo.recordingSafety = false; + eventInfo.autoAdjustToEPG = false; return addTimerEvent(CTimerd::TIMER_IMMEDIATE_RECORD, &eventInfo, 0, alarmtime, stoptime); }; diff --git a/lib/timerdclient/timerdtypes.h b/lib/timerdclient/timerdtypes.h index 7e5146771..4e0c5001f 100644 --- a/lib/timerdclient/timerdtypes.h +++ b/lib/timerdclient/timerdtypes.h @@ -87,6 +87,7 @@ class CTimerd t_channel_id channel_id; unsigned char apids; bool recordingSafety; + bool autoAdjustToEPG; }; struct TransferEventInfo @@ -96,6 +97,7 @@ class CTimerd t_channel_id channel_id; unsigned char apids; bool recordingSafety; + bool autoAdjustToEPG; }; struct TransferRecordingInfo : TransferEventInfo @@ -116,6 +118,7 @@ class CTimerd epgID = e.epgID; epg_starttime = e.epg_starttime; recordingSafety = e.recordingSafety; + autoAdjustToEPG = e.autoAdjustToEPG; }; RecordingInfo& operator = (EventInfo& e) { @@ -124,6 +127,7 @@ class CTimerd epgID = e.epgID; epg_starttime = e.epg_starttime; recordingSafety = e.recordingSafety; + autoAdjustToEPG = e.autoAdjustToEPG; return *this; } unsigned char apids; diff --git a/src/gui/epgview.cpp b/src/gui/epgview.cpp index d05cc7e1c..e9343a52d 100644 --- a/src/gui/epgview.cpp +++ b/src/gui/epgview.cpp @@ -1121,7 +1121,7 @@ int CEpgData::show(const t_channel_id channel_id, uint64_t a_id, time_t* a_start epgData.epg_times.startzeit + epgData.epg_times.dauer, epgData.eventID, epgData.epg_times.startzeit, epgData.epg_times.startzeit - (ANNOUNCETIME + 120 ), - TIMERD_APIDS_CONF, true, recDir,false) == -1) + TIMERD_APIDS_CONF, true, true, recDir, false) == -1) { if (askUserOnTimerConflict(epgData.epg_times.startzeit - (ANNOUNCETIME + 120), epgData.epg_times.startzeit + epgData.epg_times.dauer)) @@ -1131,7 +1131,7 @@ int CEpgData::show(const t_channel_id channel_id, uint64_t a_id, time_t* a_start epgData.epg_times.startzeit + epgData.epg_times.dauer, epgData.eventID, epgData.epg_times.startzeit, epgData.epg_times.startzeit - (ANNOUNCETIME + 120 ), - TIMERD_APIDS_CONF, true, recDir,true); + TIMERD_APIDS_CONF, true, true, recDir, true); ShowMsg(LOCALE_TIMER_EVENTRECORD_TITLE, LOCALE_TIMER_EVENTRECORD_MSG, CMessageBox::mbrBack, CMessageBox::mbBack, NEUTRINO_ICON_INFO); timeoutEnd = CRCInput::calcTimeoutEnd(g_settings.timing[SNeutrinoSettings::TIMING_EPG]); } diff --git a/src/gui/followscreenings.cpp b/src/gui/followscreenings.cpp index cb1933d6e..1d5e80bff 100644 --- a/src/gui/followscreenings.cpp +++ b/src/gui/followscreenings.cpp @@ -105,7 +105,7 @@ int CFollowScreenings::exec(CMenuTarget* /*parent*/, const std::string & actionK } if (g_Timerd->addRecordTimerEvent(channel_id, e->startTime, e->startTime + e->duration, e->eventID, - e->startTime, e->startTime - (ANNOUNCETIME + 120 ), apids, true, recDir, true) == -1) { + e->startTime, e->startTime - (ANNOUNCETIME + 120 ), apids, true, true, recDir, true) == -1) { //FIXME -- no error handling, but this shouldn't happen ... } else { #if 0 diff --git a/src/gui/timerlist.cpp b/src/gui/timerlist.cpp index 8af61afe6..ebdfb6d66 100644 --- a/src/gui/timerlist.cpp +++ b/src/gui/timerlist.cpp @@ -316,6 +316,7 @@ int CTimerList::exec(CMenuTarget* parent, const std::string & actionKey) eventinfo.channel_id=timerNew.channel_id; eventinfo.apids = TIMERD_APIDS_CONF; eventinfo.recordingSafety = false; + eventinfo.autoAdjustToEPG = true; timerNew.standby_on = (timerNew_standby_on == 1); void *data=NULL; if (timerNew.eventType == CTimerd::TIMER_STANDBY) @@ -333,6 +334,7 @@ int CTimerList::exec(CMenuTarget* parent, const std::string & actionKey) recinfo.channel_id=timerNew.channel_id; recinfo.apids=TIMERD_APIDS_CONF; recinfo.recordingSafety = false; + recinfo.autoAdjustToEPG = true; // FIXME -- add GUI option? timerNew.announceTime-= 120; // 2 more mins for rec timer strncpy(recinfo.recordingDir,timerNew.recordingDir,sizeof(recinfo.recordingDir)-1); diff --git a/src/timerd/timerd.cpp b/src/timerd/timerd.cpp index 5f79230a0..6589e62c0 100644 --- a/src/timerd/timerd.cpp +++ b/src/timerd/timerd.cpp @@ -303,7 +303,7 @@ bool timerd_parse_command(CBasicMessage::Header &rmsg, int connfd) CTimerd::TransferRecordingInfo recInfo; CBasicServer::receive_data(connfd, &recInfo, sizeof(CTimerd::TransferRecordingInfo)); - if(recInfo.recordingSafety) + if(recInfo.recordingSafety) { int pre,post; CTimerManager::getInstance()->getRecordingSafety(pre,post); @@ -321,7 +321,9 @@ bool timerd_parse_command(CBasicMessage::Header &rmsg, int connfd) recInfo.apids, msgAddTimer.eventRepeat, msgAddTimer.repeatCount, - recInfo.recordingDir); + recInfo.recordingDir, + recInfo.recordingSafety, + recInfo.autoAdjustToEPG); rspAddTimer.eventID = CTimerManager::getInstance()->addEvent(event); break; diff --git a/src/timerd/timermanager.cpp b/src/timerd/timermanager.cpp index 1e3329800..f117cfc8e 100644 --- a/src/timerd/timermanager.cpp +++ b/src/timerd/timermanager.cpp @@ -1132,7 +1132,8 @@ CTimerEvent_Record::CTimerEvent_Record(time_t announce_Time, time_t alarm_Time, event_id_t epgID, time_t epg_starttime, unsigned char apids, CTimerd::CTimerEventRepeat evrepeat, - uint32_t repeatcount, const std::string &recDir) : + uint32_t repeatcount, const std::string &recDir, + bool _recordingSafety, bool _autoAdjustToEPG) : CTimerEvent(getEventType(), announce_Time, alarm_Time, stop_Time, evrepeat, repeatcount) { eventInfo.epgID = epgID; @@ -1141,6 +1142,8 @@ CTimerEvent_Record::CTimerEvent_Record(time_t announce_Time, time_t alarm_Time, eventInfo.apids = apids; recordingDir = recDir; epgTitle=""; + autoAdjustToEPG = _autoAdjustToEPG; + recordingSafety = _recordingSafety; CShortEPGData epgdata; if (CEitManager::getInstance()->getEPGidShort(epgID, &epgdata)) epgTitle=epgdata.title; @@ -1170,10 +1173,18 @@ CTimerEvent_Record::CTimerEvent_Record(CConfigFile *config, int iId): epgTitle = config->getString("EPG_TITLE_"+id); dprintf("read EPG_TITLE_%s %s (%p)\n",id.c_str(),epgTitle.c_str(),&epgTitle); + + recordingSafety = config->getInt32("RECORDING_SAFETY_"+id, true); + dprintf("read RECORDING_SAFETY_%s %d\n",id.c_str(), recordingSafety); + + autoAdjustToEPG = config->getInt32("EPG_AUTO_ADJUST_"+id, true); + dprintf("read EPG_AUTO_ADJUST_TO_EPG_%s %d\n",id.c_str(), autoAdjustToEPG); } //------------------------------------------------------------ void CTimerEvent_Record::fireEvent() { + if (adjustToCurrentEPG()) + return; Refresh(); CTimerd::RecordingInfo ri=eventInfo; ri.eventID=eventID; @@ -1188,6 +1199,8 @@ void CTimerEvent_Record::fireEvent() //------------------------------------------------------------ void CTimerEvent_Record::announceEvent() { + if (adjustToCurrentEPG()) + return; Refresh(); CTimerd::RecordingInfo ri=eventInfo; ri.eventID=eventID; @@ -1236,6 +1249,12 @@ void CTimerEvent_Record::saveToConfig(CConfigFile *config) config->setString("EPG_TITLE_"+id,epgTitle); dprintf("set EPG_TITLE_%s to %s (%p)\n",id.c_str(),epgTitle.c_str(), &epgTitle); + + config->setInt32("RECORDING_SAFETY_"+id, recordingSafety); + dprintf("set RECORDING_SAFETY_%s to %d\n",id.c_str(), recordingSafety); + + config->setInt32("EPG_AUTO_ADJUST_"+id, autoAdjustToEPG); + dprintf("set EPG_AUTO_ADJUST_TO_EPG_%s to %d\n",id.c_str(), autoAdjustToEPG); } //------------------------------------------------------------ void CTimerEvent_Record::Reschedule() @@ -1277,6 +1296,34 @@ void CTimerEvent_Record::Refresh() if (eventInfo.epgID == 0) getEpgId(); } +//------------------------------------------------------------ +bool CTimerEvent_Record::adjustToCurrentEPG() +{ + CChannelEventList evtlist; + CEitManager::getInstance()->getEventsServiceKey(eventInfo.channel_id, evtlist); + + time_t now = time(NULL); + CChannelEventList::iterator first = evtlist.end(); + for (CChannelEventList::iterator e = evtlist.begin(); e != evtlist.end(); ++e) + { + if (e->startTime < now) + continue; + if (first == evtlist.end() || first->startTime > e->startTime) + first = e; + if (alarmTime <= e->startTime && e->startTime + (int)e->duration <= stopTime) + return false; + } + if (first == evtlist.end()) + return false; + + CTimerEvent_Record *event= new CTimerEvent_Record(first->startTime - (alarmTime - announceTime), first->startTime, first->startTime + first->duration, + eventInfo.channel_id, eventInfo.epgID, first->startTime, eventInfo.apids, + CTimerd::TIMERREPEAT_ONCE, 1, recordingDir, recordingSafety, autoAdjustToEPG); + CTimerManager::getInstance()->addEvent(event,false); + setState(CTimerd::TIMERSTATE_HASFINISHED); + + return true; +} //============================================================= // Zapto Event //============================================================= diff --git a/src/timerd/timermanager.h b/src/timerd/timermanager.h index 7d9a18b22..188751e45 100644 --- a/src/timerd/timermanager.h +++ b/src/timerd/timermanager.h @@ -117,13 +117,16 @@ class CTimerEvent_Record : public CTimerEvent CTimerd::EventInfo eventInfo; std::string recordingDir; std::string epgTitle; + bool recordingSafety; + bool autoAdjustToEPG; CTimerEvent_Record(time_t announceTime, time_t alarmTime, time_t stopTime, t_channel_id channel_id, event_id_t epgID = 0, time_t epg_starttime = 0, unsigned char apids = TIMERD_APIDS_STD, CTimerd::CTimerEventRepeat evrepeat = CTimerd::TIMERREPEAT_ONCE, - uint32_t repeatcount = 1, const std::string &recDir = ""); + uint32_t repeatcount = 1, const std::string &recDir = "", + bool _recordingSafety = true, bool _autoAdjustToEPG = true); CTimerEvent_Record(CConfigFile *config, int iId); virtual ~CTimerEvent_Record(){}; virtual CTimerd::CTimerEventTypes getEventType(void) const { return CTimerd::TIMER_RECORD; }; @@ -134,6 +137,7 @@ class CTimerEvent_Record : public CTimerEvent virtual void Reschedule(); virtual void getEpgId(); virtual void Refresh(); + virtual bool adjustToCurrentEPG(); }; class CTimerEvent_Zapto : public CTimerEvent_Record From 9aae39eab874d199614f9aee88d153c3642280e4 Mon Sep 17 00:00:00 2001 From: martii Date: Mon, 26 Sep 2016 13:04:48 +0200 Subject: [PATCH 4/9] timerd/timermanager: fix EPG auto-adjustment of recordings Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/2cebd62aee251c54d143fc0e87a2b7c30add2bcd Author: martii Date: 2016-09-26 (Mon, 26 Sep 2016) --- src/gui/epgview.cpp | 4 ++-- src/gui/followscreenings.cpp | 2 +- src/timerd/timermanager.cpp | 3 +++ 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/gui/epgview.cpp b/src/gui/epgview.cpp index e9343a52d..f56574e1b 100644 --- a/src/gui/epgview.cpp +++ b/src/gui/epgview.cpp @@ -1121,7 +1121,7 @@ int CEpgData::show(const t_channel_id channel_id, uint64_t a_id, time_t* a_start epgData.epg_times.startzeit + epgData.epg_times.dauer, epgData.eventID, epgData.epg_times.startzeit, epgData.epg_times.startzeit - (ANNOUNCETIME + 120 ), - TIMERD_APIDS_CONF, true, true, recDir, false) == -1) + TIMERD_APIDS_CONF, true, epgData.epg_times.startzeit - (ANNOUNCETIME + 120) > time(NULL), recDir, false) == -1) { if (askUserOnTimerConflict(epgData.epg_times.startzeit - (ANNOUNCETIME + 120), epgData.epg_times.startzeit + epgData.epg_times.dauer)) @@ -1131,7 +1131,7 @@ int CEpgData::show(const t_channel_id channel_id, uint64_t a_id, time_t* a_start epgData.epg_times.startzeit + epgData.epg_times.dauer, epgData.eventID, epgData.epg_times.startzeit, epgData.epg_times.startzeit - (ANNOUNCETIME + 120 ), - TIMERD_APIDS_CONF, true, true, recDir, true); + TIMERD_APIDS_CONF, true, epgData.epg_times.startzeit - (ANNOUNCETIME + 120) > time(NULL), recDir, true); ShowMsg(LOCALE_TIMER_EVENTRECORD_TITLE, LOCALE_TIMER_EVENTRECORD_MSG, CMessageBox::mbrBack, CMessageBox::mbBack, NEUTRINO_ICON_INFO); timeoutEnd = CRCInput::calcTimeoutEnd(g_settings.timing[SNeutrinoSettings::TIMING_EPG]); } diff --git a/src/gui/followscreenings.cpp b/src/gui/followscreenings.cpp index 1d5e80bff..292878930 100644 --- a/src/gui/followscreenings.cpp +++ b/src/gui/followscreenings.cpp @@ -105,7 +105,7 @@ int CFollowScreenings::exec(CMenuTarget* /*parent*/, const std::string & actionK } if (g_Timerd->addRecordTimerEvent(channel_id, e->startTime, e->startTime + e->duration, e->eventID, - e->startTime, e->startTime - (ANNOUNCETIME + 120 ), apids, true, true, recDir, true) == -1) { + e->startTime, e->startTime - (ANNOUNCETIME + 120 ), apids, true, e->startTime - (ANNOUNCETIME + 120) > time(NULL), recDir, true) == -1) { //FIXME -- no error handling, but this shouldn't happen ... } else { #if 0 diff --git a/src/timerd/timermanager.cpp b/src/timerd/timermanager.cpp index f117cfc8e..b0a5b5439 100644 --- a/src/timerd/timermanager.cpp +++ b/src/timerd/timermanager.cpp @@ -1299,6 +1299,9 @@ void CTimerEvent_Record::Refresh() //------------------------------------------------------------ bool CTimerEvent_Record::adjustToCurrentEPG() { + if (!autoAdjustToEPG) + return false; + CChannelEventList evtlist; CEitManager::getInstance()->getEventsServiceKey(eventInfo.channel_id, evtlist); From 257f0403151dc733d1690bed00cf91e35353f4a7 Mon Sep 17 00:00:00 2001 From: martii Date: Mon, 26 Sep 2016 13:04:48 +0200 Subject: [PATCH 5/9] gui/timerlist: don't auto-adjust manually-added timer to EPG (untested) Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/250926daff2ccaa3b597f8cadc05d797c7913e5a Author: martii Date: 2016-09-26 (Mon, 26 Sep 2016) --- src/gui/timerlist.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gui/timerlist.cpp b/src/gui/timerlist.cpp index ebdfb6d66..e899611e5 100644 --- a/src/gui/timerlist.cpp +++ b/src/gui/timerlist.cpp @@ -316,7 +316,7 @@ int CTimerList::exec(CMenuTarget* parent, const std::string & actionKey) eventinfo.channel_id=timerNew.channel_id; eventinfo.apids = TIMERD_APIDS_CONF; eventinfo.recordingSafety = false; - eventinfo.autoAdjustToEPG = true; + eventinfo.autoAdjustToEPG = false; timerNew.standby_on = (timerNew_standby_on == 1); void *data=NULL; if (timerNew.eventType == CTimerd::TIMER_STANDBY) @@ -334,7 +334,7 @@ int CTimerList::exec(CMenuTarget* parent, const std::string & actionKey) recinfo.channel_id=timerNew.channel_id; recinfo.apids=TIMERD_APIDS_CONF; recinfo.recordingSafety = false; - recinfo.autoAdjustToEPG = true; // FIXME -- add GUI option? + recinfo.autoAdjustToEPG = false; // FIXME -- add GUI option? timerNew.announceTime-= 120; // 2 more mins for rec timer strncpy(recinfo.recordingDir,timerNew.recordingDir,sizeof(recinfo.recordingDir)-1); From 05e98f85b94f429eb47bdb826083e0543ac82cfb Mon Sep 17 00:00:00 2001 From: TangoCash Date: Mon, 26 Sep 2016 13:04:48 +0200 Subject: [PATCH 6/9] add autoAdjustToEPG to webif API Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/3f323506453f5f1d59e32ec55e6ee30f8c9cf899 Author: TangoCash Date: 2016-09-26 (Mon, 26 Sep 2016) --- src/nhttpd/tuxboxapi/controlapi.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/nhttpd/tuxboxapi/controlapi.cpp b/src/nhttpd/tuxboxapi/controlapi.cpp index d1bc6b106..b63c8199d 100644 --- a/src/nhttpd/tuxboxapi/controlapi.cpp +++ b/src/nhttpd/tuxboxapi/controlapi.cpp @@ -2804,7 +2804,8 @@ void CControlAPI::doNewTimer(CyhookHandler *hh) eventinfo.epgID = 0; eventinfo.epg_starttime = 0; eventinfo.apids = TIMERD_APIDS_CONF; - eventinfo.recordingSafety = (hh->ParamList["rs"] == "1"); + eventinfo.recordingSafety = (hh->ParamList["rs"] == "1") || (hh->ParamList["rs"] == "on"); + eventinfo.autoAdjustToEPG = (hh->ParamList["aj"] == "1") || (hh->ParamList["aj"] == "on"); // channel by Id or name if(!hh->ParamList["channel_id"].empty()) From a2d979e1ab96c2942df094a281f7008952d0e93a Mon Sep 17 00:00:00 2001 From: TangoCash Date: Mon, 26 Sep 2016 13:04:48 +0200 Subject: [PATCH 7/9] always refresh EPG for timer recordings Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/e86b28a50e367872628254e318ae029c2e57ea38 Author: TangoCash Date: 2016-09-26 (Mon, 26 Sep 2016) --- src/timerd/timermanager.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/timerd/timermanager.cpp b/src/timerd/timermanager.cpp index b0a5b5439..d374e1140 100644 --- a/src/timerd/timermanager.cpp +++ b/src/timerd/timermanager.cpp @@ -1185,7 +1185,7 @@ void CTimerEvent_Record::fireEvent() { if (adjustToCurrentEPG()) return; - Refresh(); + getEpgId(); CTimerd::RecordingInfo ri=eventInfo; ri.eventID=eventID; strcpy(ri.recordingDir, recordingDir.substr(0,sizeof(ri.recordingDir)-1).c_str()); From 3c544ff0667b745c769f16c6c05e0a305612610d Mon Sep 17 00:00:00 2001 From: martii Date: Mon, 26 Sep 2016 13:57:34 +0200 Subject: [PATCH 8/9] timerd: honor recording safety when modifying timers Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/67a375f4daf555083dd6e5416bb70ce73c30be4d Author: martii Date: 2016-09-26 (Mon, 26 Sep 2016) --- src/timerd/timermanager.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/timerd/timermanager.cpp b/src/timerd/timermanager.cpp index d374e1140..7a5572c01 100644 --- a/src/timerd/timermanager.cpp +++ b/src/timerd/timermanager.cpp @@ -1319,7 +1319,18 @@ bool CTimerEvent_Record::adjustToCurrentEPG() if (first == evtlist.end()) return false; - CTimerEvent_Record *event= new CTimerEvent_Record(first->startTime - (alarmTime - announceTime), first->startTime, first->startTime + first->duration, + time_t _announceTime = first->startTime - (alarmTime - announceTime); + time_t _alarmTime = first->startTime; + time_t _stopTime = first->startTime + first->duration; + if (recordingSafety) { + int pre, post; + CTimerManager::getInstance()->getRecordingSafety(pre, post); + _announceTime -= pre; + _alarmTime -= pre; + _stopTime += post; + } + + CTimerEvent_Record *event= new CTimerEvent_Record(_announceTime, _alarmTime, _stopTime, eventInfo.channel_id, eventInfo.epgID, first->startTime, eventInfo.apids, CTimerd::TIMERREPEAT_ONCE, 1, recordingDir, recordingSafety, autoAdjustToEPG); CTimerManager::getInstance()->addEvent(event,false); From f53433c98ac436dd425b0e512167f2ee3bffb0c5 Mon Sep 17 00:00:00 2001 From: martii Date: Mon, 26 Sep 2016 13:57:34 +0200 Subject: [PATCH 9/9] timerd: honor recording safety when modifying timers (fix) Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/aaaa9745a7e07428498a3043cfa793b8f9592d08 Author: martii Date: 2016-09-26 (Mon, 26 Sep 2016) --- src/timerd/timermanager.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/timerd/timermanager.cpp b/src/timerd/timermanager.cpp index 7a5572c01..d9a54e36a 100644 --- a/src/timerd/timermanager.cpp +++ b/src/timerd/timermanager.cpp @@ -1325,7 +1325,6 @@ bool CTimerEvent_Record::adjustToCurrentEPG() if (recordingSafety) { int pre, post; CTimerManager::getInstance()->getRecordingSafety(pre, post); - _announceTime -= pre; _alarmTime -= pre; _stopTime += post; }