diff options
author | kamel5 <vdr.kamel5 (at) gmx (dot) net> | 2020-07-15 17:03:38 +0200 |
---|---|---|
committer | kamel5 <vdr.kamel5 (at) gmx (dot) net> | 2020-07-15 17:38:01 +0200 |
commit | 0400ff1b029baee8900e465712903b5ddf6c5f07 (patch) | |
tree | 9b77c798904b21949c9469799b917b4ff0257788 | |
parent | a1619348198d1b485aaebc91176403c15dbec47d (diff) | |
download | vdr-plugin-tvguideng-0400ff1b029baee8900e465712903b5ddf6c5f07.tar.gz vdr-plugin-tvguideng-0400ff1b029baee8900e465712903b5ddf6c5f07.tar.bz2 |
Fixed a remote timer problem
-rw-r--r-- | config.c | 4 | ||||
-rw-r--r-- | config.h | 9 | ||||
-rw-r--r-- | po/de_DE.po | 11 | ||||
-rw-r--r-- | recmanager.c | 112 | ||||
-rw-r--r-- | recmanager.h | 2 | ||||
-rw-r--r-- | recmenus.c | 22 | ||||
-rw-r--r-- | recmenus.h | 2 | ||||
-rw-r--r-- | recmenuview.c | 6 | ||||
-rw-r--r-- | setup.c | 5 | ||||
-rw-r--r-- | setup.h | 1 |
10 files changed, 119 insertions, 55 deletions
@@ -13,6 +13,7 @@ cTVGuideConfig::cTVGuideConfig(void) { hugeStepHours = 24; hideLastChannelGroup = 0; channelJumpMode = eGroupJump; + addSubtitleToTimer = 1; closeOnSwitch = 0; numKeyMode = eChannelJump; blueKeyMode = eBlueKeyFavorites; @@ -67,6 +68,7 @@ bool cTVGuideConfig::SetupParse(const char *Name, const char *Value) { else if (!strcasecmp(Name, "useRemoteTimers")) useRemoteTimers = atoi(Value); else if (!strcasecmp(Name, "instRecFolderMode")) instRecFolderMode = atoi(Value); else if (!strcasecmp(Name, "instRecFixedFolder")) instRecFixedFolder = atoi(Value); + else if (!strcasecmp(Name, "addSubtitleToTimer")) addSubtitleToTimer = atoi(Value); else if (!strcasecmp(Name, "favWhatsOnNow")) favWhatsOnNow = atoi(Value); else if (!strcasecmp(Name, "favWhatsOnNext")) favWhatsOnNext = atoi(Value); else if (!strcasecmp(Name, "favUseTime1")) favUseTime1 = atoi(Value); @@ -88,4 +90,4 @@ bool cTVGuideConfig::SetupParse(const char *Name, const char *Value) { else return false; return true; -}
\ No newline at end of file +} @@ -33,6 +33,12 @@ enum eInstRecFolderMode { eFolderFixed }; +typedef enum { + addSubtitleNever = 0, + addSubtitleSmart, + addSubtitleAlways +} addSubtitleToTimerMode; + class cTVGuideConfig { private: public: @@ -49,6 +55,7 @@ public: int hugeStepHours; int hideLastChannelGroup; int channelJumpMode; + int addSubtitleToTimer; int closeOnSwitch; int numKeyMode; int blueKeyMode; @@ -89,4 +96,4 @@ public: extern cPlugin *pRemoteTimers; #endif -#endif //__TVGUIDE_CONFIG_H
\ No newline at end of file +#endif //__TVGUIDE_CONFIG_H diff --git a/po/de_DE.po b/po/de_DE.po index 8dcde82..3626b88 100644 --- a/po/de_DE.po +++ b/po/de_DE.po @@ -3,7 +3,7 @@ msgid "" msgstr "" "Project-Id-Version: vdr-tvguideng 0.0.1\n" "Report-Msgid-Bugs-To: <see README>\n" -"POT-Creation-Date: 2015-06-30 17:27+0200\n" +"POT-Creation-Date: 2020-07-15 16:59+0200\n" "PO-Revision-Date: 2015-03-08 17:49+0200\n" "Last-Translator: Louis\n" "Language-Team: \n" @@ -36,6 +36,9 @@ msgstr "Detailiertes EPG" msgid "Favorites" msgstr "Favoriten" +msgid "tvguide: RemoteTimerModifications failed" +msgstr "" + msgid "all Channels" msgstr "alle Kanäle" @@ -519,6 +522,9 @@ msgstr "falls vorhanden" msgid "always" msgstr "immer" +msgid "smart" +msgstr "" + msgid "Show Main Menu Entry" msgstr "Hauptmenüeintrag anzeigen" @@ -576,6 +582,9 @@ msgstr "keine Beschränkung" msgid "Folder for instant Recordings" msgstr "Verzeichnis für Direktaufnahmen" +msgid "Add episode to manual timers" +msgstr "" + msgid "Use Remotetimers" msgstr "Remotetimers verwenden" diff --git a/recmanager.c b/recmanager.c index 2ef1d67..9465176 100644 --- a/recmanager.c +++ b/recmanager.c @@ -6,6 +6,10 @@ #include <algorithm> #include <vdr/menu.h> +#include "services/remotetimers.h" +#include "helpers.h" +#include "switchtimer.h" +#include "timerconflict.h" #include <vdr/timers.h> #include "recmanager.h" @@ -39,7 +43,7 @@ bool cRecManager::RefreshRemoteTimers(void) { bool cRecManager::CheckEventForTimer(const cEvent *event) { bool hasTimer = false; - + if (config.useRemoteTimers && pRemoteTimers) { RemoteTimers_GetMatch_v1_0 rtMatch; rtMatch.event = event; @@ -47,7 +51,7 @@ bool cRecManager::CheckEventForTimer(const cEvent *event) { if (rtMatch.timerMatch == tmFull) hasTimer = true; } else { -#if VDRVERSNUM >= 20301 +#if defined (APIVERSNUM) && (APIVERSNUM >= 20301) eTimerMatch TimerMatch = tmNone; LOCK_TIMERS_READ; const cTimers *timers = Timers; @@ -92,17 +96,18 @@ cTimer *cRecManager::createTimer(const cEvent *event, std::string path) { cTimer *cRecManager::createLocalTimer(const cEvent *event, std::string path) { cTimer *timer = new cTimer(event); #if defined (APIVERSNUM) && (APIVERSNUM >= 20301) - if (Setup.SVDRPPeering && *Setup.SVDRPDefaultHost) - ((cTimer*)timer)->SetRemote(Setup.SVDRPDefaultHost); LOCK_TIMERS_WRITE; cTimers* timers = Timers; + timers->SetExplicitModify(); + if (Setup.SVDRPPeering && *Setup.SVDRPDefaultHost) + timer->SetRemote(Setup.SVDRPDefaultHost); #else cTimers* timers = &Timers; #endif - cTimer* t = timers->GetTimer(timer); + cTimer *t = timers->GetTimer(timer); if (t) { t->OnOff(); -#if VDRVERSNUM >= 20301 +#if defined (APIVERSNUM) && (APIVERSNUM >= 20301) t->SetEvent(event); #else t->SetEventFromSchedule(); @@ -111,12 +116,21 @@ cTimer *cRecManager::createLocalTimer(const cEvent *event, std::string path) { timer = t; isyslog("timer %s reactivated", *t->ToDescr()); } else { + SetTimerPath(timer, event, path); timers->Add(timer); + timers->SetModified(); +#if defined (APIVERSNUM) && (APIVERSNUM >= 20301) + if (!HandleRemoteTimerModifications(timer)) { + timers->Del(timer); + esyslog(tr("tvguide: RemoteTimerModifications failed")); + } else { + isyslog("timer %s added (active)", *timer->ToDescr()); + } +#else isyslog("timer %s added (active)", *timer->ToDescr()); +#endif } - SetTimerPath(timer, event, path); - timers->SetModified(); - return timer; + return timers->GetTimer(timer); } cTimer *cRecManager::createRemoteTimer(const cEvent *event, std::string path) { @@ -161,12 +175,25 @@ void cRecManager::SetTimerPath(cTimer *timer, const cEvent *event, std::string p return; } //Set choosen path + bool addSubtitle = false; + if (!isempty(event->ShortText())) { // add subtitle if present + addSubtitle = (config.addSubtitleToTimer != addSubtitleNever); + if (config.addSubtitleToTimer == addSubtitleSmart) + if (event->Duration() > 80 * 60) + addSubtitle = false; + } cString newFileName; if (path.size() > 0) { std::replace(path.begin(), path.end(), '/', '~'); - newFileName = cString::sprintf("%s~%s", path.c_str(), timer->File()); + if (addSubtitle) + newFileName = cString::sprintf("%s~%s~%s", path.c_str(), event->Title(), event->ShortText()); + else + newFileName = cString::sprintf("%s~%s", path.c_str(), timer->File()); } else { - newFileName = event->Title(); + if (addSubtitle) + newFileName = cString::sprintf("%s~%s", event->Title(), event->ShortText()); + else + newFileName = event->Title(); } timer->SetFile(*newFileName); } @@ -215,6 +242,12 @@ void cRecManager::DeleteTimer(const cTimer *timer) { #if defined (APIVERSNUM) && (APIVERSNUM >= 20301) LOCK_TIMERS_WRITE; cTimers* timers = Timers; + if (timer && timer->Remote() && !timer->Recording()) { + if (HandleRemoteTimerModifications(NULL, (cTimer*)timer)) { + timers->Del((cTimer*)timer); + } + timers->SetModified(); + } cTimer* t = timers->GetTimer(timer); #else cTimers* timers = &Timers; @@ -249,24 +282,34 @@ void cRecManager::DeleteRemoteTimer(const cEvent *event) { } } -void cRecManager::SaveTimer(const cTimer *t, cTimer newTimerSettings) { +void cRecManager::SaveTimer(const cTimer *t, cTimer *newTimerSettings) { if (!t) return; -#if VDRVERSNUM >= 20301 +#if defined (APIVERSNUM) && (APIVERSNUM >= 20301) LOCK_TIMERS_WRITE; - cTimer *timer = Timers->GetTimer(t); + cTimers* timers = Timers; + timers->SetExplicitModify(); + if (t && t->Remote()) { + if (!HandleRemoteTimerModifications(newTimerSettings, (cTimer *)t)) { + esyslog(tr("tvguide: RemoteTimerModifications failed")); + } + } + cTimer *timer = timers->GetTimer(t); #else - cTimer *timer = Timers.GetTimer((cTimer*)t); + cTimers* timers = &Timers; + cTimer *timer = timers->GetTimer((cTimer *)t); #endif - - bool active = newTimerSettings.HasFlags(tfActive); - int prio = newTimerSettings.Priority(); - int lifetime = newTimerSettings.Lifetime(); - time_t day = newTimerSettings.Day(); - int start = newTimerSettings.Start(); - int stop = newTimerSettings.Stop(); - std::string fileName = newTimerSettings.File(); + if (!timer) { + return; + } + bool active = newTimerSettings->HasFlags(tfActive); + int prio = newTimerSettings->Priority(); + int lifetime = newTimerSettings->Lifetime(); + time_t day = newTimerSettings->Day(); + int start = newTimerSettings->Start(); + int stop = newTimerSettings->Stop(); + std::string fileName = newTimerSettings->File(); timer->SetDay(day); timer->SetStart(start); @@ -275,10 +318,10 @@ void cRecManager::SaveTimer(const cTimer *t, cTimer newTimerSettings) { timer->SetLifetime(lifetime); timer->SetFile(fileName.c_str()); - if (timer->HasFlags(tfActive) && !active) - timer->ClrFlags(tfActive); - else if (!timer->HasFlags(tfActive) && active) - timer->SetFlags(tfActive); + if (active) + timer->SetFlags(tfActive); + else + timer->ClrFlags(tfActive); #if VDRVERSNUM < 20300 timer->SetEventFromSchedule(); @@ -290,22 +333,17 @@ void cRecManager::SaveTimer(const cTimer *t, cTimer newTimerSettings) { rt.timer = NULL; RefreshRemoteTimers(); } else { -#if defined (APIVERSNUM) && (APIVERSNUM >= 20301) - Timers->SetModified(); -#else - Timers.SetModified(); -#endif + timers->SetModified(); } } bool cRecManager::IsRecorded(const cEvent *event) { #if defined (APIVERSNUM) && (APIVERSNUM >= 20301) - LOCK_TIMERS_WRITE; - cTimers* timers = Timers; + LOCK_TIMERS_WRITE; + cTimer *timer = Timers->GetMatch(event); #else - cTimers* timers = &Timers; + cTimer *timer = Timers.GetMatch(event); #endif - cTimer *timer = timers->GetMatch(event); if (!timer) return false; return timer->Recording(); @@ -397,8 +435,10 @@ const cEvent **cRecManager::PerformSearchTimerSearch(std::string epgSearchString searchResults = new const cEvent *[numResults]; const cSchedules *schedules; #if defined (APIVERSNUM) && (APIVERSNUM >= 20301) + { LOCK_SCHEDULES_READ; schedules = Schedules; + } #else cSchedulesLock schedulesLock; schedules = cSchedules::Schedules(schedulesLock); diff --git a/recmanager.h b/recmanager.h index a901049..50edfd8 100644 --- a/recmanager.h +++ b/recmanager.h @@ -39,7 +39,7 @@ public: void DeleteTimer(const cEvent *event); void DeleteLocalTimer(const cEvent *event); void DeleteRemoteTimer(const cEvent *event); - void SaveTimer(const cTimer *timer, cTimer newTimerSettings); + void SaveTimer(const cTimer *timer, cTimer *newTimerSettings); bool IsRecorded(const cEvent *event); cTVGuideTimerConflicts *CheckTimerConflict(void); void CreateSeriesTimer(cTimer *seriesTimer); @@ -341,17 +341,17 @@ const cTimer *cRecMenuEditTimer::GetOriginalTimer(void) { return originalTimer; } -cTimer cRecMenuEditTimer::GetTimer(void) { - cTimer t; +cTimer *cRecMenuEditTimer::GetTimer(void) { + cTimer *t = (cTimer *)originalTimer; if (timerActive) - t.SetFlags(tfActive); - else - t.SetFlags(tfNone); - t.SetDay(day); - t.SetStart(start); - t.SetStop(stop); - t.SetPriority(prio); - t.SetLifetime(lifetime); + t->SetFlags(tfActive); + else + t->ClrFlags(tfActive); + t->SetDay(day); + t->SetStart(start); + t->SetStop(stop); + t->SetPriority(prio); + t->SetLifetime(lifetime); string newFolder(folder); string newFile = originalTimer->File(); size_t found = newFile.find_last_of('~'); @@ -366,7 +366,7 @@ cTimer cRecMenuEditTimer::GetTimer(void) { newFile = *cString::sprintf("%s~%s", newFolder.c_str(), newFile.c_str()); } std::replace(newFile.begin(), newFile.end(), '/', '~'); - t.SetFile(newFile.c_str()); + t->SetFile(newFile.c_str()); return t; } @@ -126,7 +126,7 @@ private: public: cRecMenuEditTimer(const cTimer *timer, eRecMenuState nextState); virtual ~cRecMenuEditTimer(void) {}; - cTimer GetTimer(void); + cTimer *GetTimer(void); const cTimer *GetOriginalTimer(void); }; diff --git a/recmenuview.c b/recmenuview.c index a3f7ee4..ecb21e2 100644 --- a/recmenuview.c +++ b/recmenuview.c @@ -264,7 +264,7 @@ eOSState cRecMenuView::StateMachine(eRecMenuState nextState) { case rmsSaveTimer: { //caller: cRecMenuEditTimer //save timer for active event - cTimer timerModified; + cTimer *timerModified; const cTimer *originalTimer; if (cRecMenuEditTimer *menu = dynamic_cast<cRecMenuEditTimer*>(activeMenu)) { timerModified = menu->GetTimer(); @@ -341,7 +341,7 @@ eOSState cRecMenuView::StateMachine(eRecMenuState nextState) { case rmsSaveTimerConflictMenu: { //caller: cRecMenuEditTimer //save timer from current timer conflict - cTimer timerModified; + cTimer *timerModified; const cTimer *originalTimer; if (cRecMenuEditTimer *menu = dynamic_cast<cRecMenuEditTimer*>(activeMenu)) { timerModified = menu->GetTimer(); @@ -784,7 +784,7 @@ eOSState cRecMenuView::StateMachine(eRecMenuState nextState) { } break;} case rmsTimelineTimerSave: { - cTimer timerModified; + cTimer *timerModified; const cTimer *originalTimer; if (cRecMenuEditTimer *menu = dynamic_cast<cRecMenuEditTimer*>(activeMenu)) { timerModified = menu->GetTimer(); @@ -22,6 +22,9 @@ cTvGuideSetup::cTvGuideSetup() { useSubtitleRerunTexts[0] = tr("never"); useSubtitleRerunTexts[1] = tr("if exists"); useSubtitleRerunTexts[2] = tr("always"); + addSubtitleMode[0] = tr("never"); + addSubtitleMode[1] = tr("smart"); + addSubtitleMode[2] = tr("always"); Setup(); } @@ -56,6 +59,7 @@ void cTvGuideSetup::Setup(void) { if (tmpConfig.instRecFolderMode == eFolderFixed) { Add(new cMenuEditStrItem(cString::sprintf("%s%s", *indent, tr("Folder")), fixedFolder, sizeof(fixedFolder), trVDR(FileNameChars))); } + Add(new cMenuEditStraItem(tr("Add episode to manual timers"), &tmpConfig.addSubtitleToTimer, 3, addSubtitleMode)); if (pRemoteTimers) Add(new cMenuEditBoolItem(tr("Use Remotetimers"), &tmpConfig.useRemoteTimers)); @@ -114,6 +118,7 @@ void cTvGuideSetup::Store(void) { SetupStore("useRemoteTimers", config.useRemoteTimers); SetupStore("instRecFolderMode", config.instRecFolderMode); SetupStore("instRecFixedFolder", config.instRecFixedFolder.c_str()); + SetupStore("AddSubtitleToTimerMode", config.addSubtitleToTimer); SetupStore("favWhatsOnNow", config.favWhatsOnNow); SetupStore("favWhatsOnNext", config.favWhatsOnNext); SetupStore("favUseTime1", config.favUseTime1); @@ -23,6 +23,7 @@ class cTvGuideSetup : public cMenuSetupPage { const char * recFolderMode[3]; char fixedFolder[256]; const char *useSubtitleRerunTexts[3]; + const char *addSubtitleMode[3]; void Setup(void); virtual eOSState ProcessKey(eKeys Key); virtual void Store(void); |