Fixed a remote timer problem

This commit is contained in:
kamel5 2020-02-12 13:14:17 +01:00
parent 66a0c15aea
commit 5d9ed1439a
10 changed files with 81 additions and 41 deletions

View File

@ -3,7 +3,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: vdr-tvguide 0.0.1\n" "Project-Id-Version: vdr-tvguide 0.0.1\n"
"Report-Msgid-Bugs-To: <see README>\n" "Report-Msgid-Bugs-To: <see README>\n"
"POT-Creation-Date: 2020-01-06 14:31+0100\n" "POT-Creation-Date: 2020-02-12 17:37+0100\n"
"PO-Revision-Date: 2013-09-21 17:49+0200\n" "PO-Revision-Date: 2013-09-21 17:49+0200\n"
"Last-Translator: My friend <Sampep> Thanks David <Gabychan> <gbonich@gmail.com>\n" "Last-Translator: My friend <Sampep> Thanks David <Gabychan> <gbonich@gmail.com>\n"
"Language-Team: \n" "Language-Team: \n"
@ -57,6 +57,9 @@ msgstr ""
msgid "images" msgid "images"
msgstr "" msgstr ""
msgid "tvguide: RemoteTimerModifications failed"
msgstr ""
msgid "root video folder" msgid "root video folder"
msgstr "Directori principal per a vídeo" msgstr "Directori principal per a vídeo"

View File

@ -3,7 +3,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: vdr-tvguide 0.0.1\n" "Project-Id-Version: vdr-tvguide 0.0.1\n"
"Report-Msgid-Bugs-To: <see README>\n" "Report-Msgid-Bugs-To: <see README>\n"
"POT-Creation-Date: 2020-01-06 14:31+0100\n" "POT-Creation-Date: 2020-02-12 17:37+0100\n"
"PO-Revision-Date: 2012-08-25 17:49+0200\n" "PO-Revision-Date: 2012-08-25 17:49+0200\n"
"Last-Translator: Horst\n" "Last-Translator: Horst\n"
"Language-Team: \n" "Language-Team: \n"
@ -54,6 +54,9 @@ msgstr "Favoriten"
msgid "images" msgid "images"
msgstr "Bilder" msgstr "Bilder"
msgid "tvguide: RemoteTimerModifications failed"
msgstr ""
msgid "root video folder" msgid "root video folder"
msgstr "Video Hauptverzeichnis" msgstr "Video Hauptverzeichnis"

View File

@ -3,7 +3,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: vdr-tvguide 0.0.1\n" "Project-Id-Version: vdr-tvguide 0.0.1\n"
"Report-Msgid-Bugs-To: <see README>\n" "Report-Msgid-Bugs-To: <see README>\n"
"POT-Creation-Date: 2020-01-06 14:31+0100\n" "POT-Creation-Date: 2020-02-12 17:37+0100\n"
"PO-Revision-Date: 2012-08-25 17:49+0200\n" "PO-Revision-Date: 2012-08-25 17:49+0200\n"
"Last-Translator: fiveten_59\n" "Last-Translator: fiveten_59\n"
"Language-Team: \n" "Language-Team: \n"
@ -54,6 +54,9 @@ msgstr "Favoriti"
msgid "images" msgid "images"
msgstr "Immagini" msgstr "Immagini"
msgid "tvguide: RemoteTimerModifications failed"
msgstr ""
msgid "root video folder" msgid "root video folder"
msgstr "cartella video di root" msgstr "cartella video di root"

View File

@ -3,7 +3,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: vdr-tvguide 1.0.0\n" "Project-Id-Version: vdr-tvguide 1.0.0\n"
"Report-Msgid-Bugs-To: <see README>\n" "Report-Msgid-Bugs-To: <see README>\n"
"POT-Creation-Date: 2020-01-06 14:31+0100\n" "POT-Creation-Date: 2020-02-12 17:37+0100\n"
"PO-Revision-Date: 2013-09-25 17:49+0400\n" "PO-Revision-Date: 2013-09-25 17:49+0400\n"
"Last-Translator: AmiD, ilya\n" "Last-Translator: AmiD, ilya\n"
"Language-Team: Russia-Cherepovets(wm.amid@gmail.com)\n" "Language-Team: Russia-Cherepovets(wm.amid@gmail.com)\n"
@ -54,6 +54,9 @@ msgstr ""
msgid "images" msgid "images"
msgstr "" msgstr ""
msgid "tvguide: RemoteTimerModifications failed"
msgstr ""
msgid "root video folder" msgid "root video folder"
msgstr "Главная видео директория" msgstr "Главная видео директория"

View File

@ -3,7 +3,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: vdr-tvguide 1.1.0\n" "Project-Id-Version: vdr-tvguide 1.1.0\n"
"Report-Msgid-Bugs-To: <see README>\n" "Report-Msgid-Bugs-To: <see README>\n"
"POT-Creation-Date: 2020-01-06 14:31+0100\n" "POT-Creation-Date: 2020-02-12 17:37+0100\n"
"PO-Revision-Date: 2013-09-15 00:12+0100\n" "PO-Revision-Date: 2013-09-15 00:12+0100\n"
"Last-Translator: Milan Hrala <hrala.milan@gmail.com>\n" "Last-Translator: Milan Hrala <hrala.milan@gmail.com>\n"
"Language-Team: \n" "Language-Team: \n"
@ -54,6 +54,9 @@ msgstr ""
msgid "images" msgid "images"
msgstr "" msgstr ""
msgid "tvguide: RemoteTimerModifications failed"
msgstr ""
msgid "root video folder" msgid "root video folder"
msgstr "Hlavný video adresár" msgstr "Hlavný video adresár"

View File

@ -96,10 +96,11 @@ cTimer *cRecManager::createTimer(const cEvent *event, std::string path) {
cTimer *cRecManager::createLocalTimer(const cEvent *event, std::string path) { cTimer *cRecManager::createLocalTimer(const cEvent *event, std::string path) {
cTimer *timer = new cTimer(event); cTimer *timer = new cTimer(event);
#if VDRVERSNUM >= 20301 #if VDRVERSNUM >= 20301
if (Setup.SVDRPPeering && *Setup.SVDRPDefaultHost)
((cTimer*)timer)->SetRemote(Setup.SVDRPDefaultHost);
LOCK_TIMERS_WRITE; LOCK_TIMERS_WRITE;
cTimers* timers = Timers; cTimers* timers = Timers;
timers->SetExplicitModify();
if (Setup.SVDRPPeering && *Setup.SVDRPDefaultHost)
timer->SetRemote(Setup.SVDRPDefaultHost);
#else #else
cTimers* timers = &Timers; cTimers* timers = &Timers;
#endif #endif
@ -115,11 +116,20 @@ cTimer *cRecManager::createLocalTimer(const cEvent *event, std::string path) {
timer = t; timer = t;
isyslog("timer %s reactivated", *t->ToDescr()); isyslog("timer %s reactivated", *t->ToDescr());
} else { } else {
SetTimerPath(timer, event, path);
timers->Add(timer); timers->Add(timer);
timers->SetModified();
#if VDRVERSNUM >= 20301
if (!HandleRemoteTimerModifications(timer)) {
timers->Del(timer);
esyslog(tr("tvguide: RemoteTimerModifications failed"));
} else {
isyslog("timer %s added (active)", *timer->ToDescr()); isyslog("timer %s added (active)", *timer->ToDescr());
} }
SetTimerPath(timer, event, path); #else
timers->SetModified(); isyslog("timer %s added (active)", *timer->ToDescr());
#endif
}
return timer; return timer;
} }
@ -204,6 +214,12 @@ void cRecManager::DeleteTimer(const cTimer *timer) {
#if VDRVERSNUM >= 20301 #if VDRVERSNUM >= 20301
LOCK_TIMERS_WRITE; LOCK_TIMERS_WRITE;
cTimers* timers = Timers; 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); cTimer* t = timers->GetTimer(timer);
#else #else
cTimers* timers = &Timers; cTimers* timers = &Timers;
@ -238,24 +254,33 @@ void cRecManager::DeleteRemoteTimer(const cEvent *event) {
} }
} }
void cRecManager::SaveTimer(const cTimer *t, cTimer newTimerSettings) { void cRecManager::SaveTimer(const cTimer *t, cTimer *newTimerSettings) {
if (!t) if (!t)
return; return;
#if VDRVERSNUM >= 20301 #if VDRVERSNUM >= 20301
LOCK_TIMERS_WRITE; 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"));
}
}
#else #else
cTimer *timer = Timers.GetTimer((cTimer*)t); cTimers* timers = &Timers;
#endif #endif
cTimer *timer = timers->GetTimer(t);
bool active = newTimerSettings.HasFlags(tfActive); if (!timer) {
int prio = newTimerSettings.Priority(); return;
int lifetime = newTimerSettings.Lifetime(); }
time_t day = newTimerSettings.Day(); bool active = newTimerSettings->HasFlags(tfActive);
int start = newTimerSettings.Start(); int prio = newTimerSettings->Priority();
int stop = newTimerSettings.Stop(); int lifetime = newTimerSettings->Lifetime();
std::string fileName = newTimerSettings.File(); time_t day = newTimerSettings->Day();
int start = newTimerSettings->Start();
int stop = newTimerSettings->Stop();
std::string fileName = newTimerSettings->File();
timer->SetDay(day); timer->SetDay(day);
timer->SetStart(start); timer->SetStart(start);
@ -264,10 +289,10 @@ void cRecManager::SaveTimer(const cTimer *t, cTimer newTimerSettings) {
timer->SetLifetime(lifetime); timer->SetLifetime(lifetime);
timer->SetFile(fileName.c_str()); timer->SetFile(fileName.c_str());
if (timer->HasFlags(tfActive) && !active) if (active)
timer->ClrFlags(tfActive);
else if (!timer->HasFlags(tfActive) && active)
timer->SetFlags(tfActive); timer->SetFlags(tfActive);
else
timer->ClrFlags(tfActive);
#if VDRVERSNUM < 20300 #if VDRVERSNUM < 20300
timer->SetEventFromSchedule(); timer->SetEventFromSchedule();
@ -280,9 +305,9 @@ void cRecManager::SaveTimer(const cTimer *t, cTimer newTimerSettings) {
RefreshRemoteTimers(); RefreshRemoteTimers();
} else { } else {
#if VDRVERSNUM >= 20301 #if VDRVERSNUM >= 20301
Timers->SetModified(); timers->SetModified();
#else #else
Timers.SetModified(); timers.SetModified();
#endif #endif
} }
} }

View File

@ -37,7 +37,7 @@ public:
void DeleteTimer(const cEvent *event); void DeleteTimer(const cEvent *event);
void DeleteLocalTimer(const cEvent *event); void DeleteLocalTimer(const cEvent *event);
void DeleteRemoteTimer(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); bool IsRecorded(const cEvent *event);
cTVGuideTimerConflicts *CheckTimerConflict(void); cTVGuideTimerConflicts *CheckTimerConflict(void);
void CreateSeriesTimer(cTimer *seriesTimer); void CreateSeriesTimer(cTimer *seriesTimer);

View File

@ -467,17 +467,17 @@ const cTimer *cRecMenuEditTimer::GetOriginalTimer(void) {
return originalTimer; return originalTimer;
} }
cTimer cRecMenuEditTimer::GetTimer(void) { cTimer *cRecMenuEditTimer::GetTimer(void) {
cTimer t; cTimer *t = (cTimer *)originalTimer;
if (timerActive) if (timerActive)
t.SetFlags(tfActive); t->SetFlags(tfActive);
else else
t.SetFlags(tfNone); t->ClrFlags(tfActive);
t.SetDay(day); t->SetDay(day);
t.SetStart(start); t->SetStart(start);
t.SetStop(stop); t->SetStop(stop);
t.SetPriority(prio); t->SetPriority(prio);
t.SetLifetime(lifetime); t->SetLifetime(lifetime);
std::string newFolder(folder); std::string newFolder(folder);
std::string newFile = originalTimer->File(); std::string newFile = originalTimer->File();
size_t found = newFile.find_last_of('~'); size_t found = newFile.find_last_of('~');
@ -492,7 +492,7 @@ cTimer cRecMenuEditTimer::GetTimer(void) {
newFile = *cString::sprintf("%s~%s", newFolder.c_str(), newFile.c_str()); newFile = *cString::sprintf("%s~%s", newFolder.c_str(), newFile.c_str());
} }
std::replace(newFile.begin(), newFile.end(), '/', '~'); std::replace(newFile.begin(), newFile.end(), '/', '~');
t.SetFile(newFile.c_str()); t->SetFile(newFile.c_str());
return t; return t;
} }

View File

@ -136,7 +136,7 @@ public:
cRecMenuEditTimer(const cTimer *timer, eRecMenuState nextState); cRecMenuEditTimer(const cTimer *timer, eRecMenuState nextState);
const cTimer *GetOriginalTimer(void); const cTimer *GetOriginalTimer(void);
virtual ~cRecMenuEditTimer(void) {}; virtual ~cRecMenuEditTimer(void) {};
cTimer GetTimer(void); cTimer *GetTimer(void);
}; };
/****************************************************************************************** /******************************************************************************************

View File

@ -206,7 +206,7 @@ eOSState cRecMenuView::StateMachine(eRecMenuState nextState) {
case rmsSaveTimer: { case rmsSaveTimer: {
//caller: cRecMenuEditTimer //caller: cRecMenuEditTimer
//save timer for active event //save timer for active event
cTimer timerModified; cTimer *timerModified;
const cTimer *originalTimer; const cTimer *originalTimer;
if (cRecMenuEditTimer *menu = dynamic_cast<cRecMenuEditTimer*>(activeMenu)) { if (cRecMenuEditTimer *menu = dynamic_cast<cRecMenuEditTimer*>(activeMenu)) {
timerModified = menu->GetTimer(); timerModified = menu->GetTimer();
@ -290,7 +290,7 @@ eOSState cRecMenuView::StateMachine(eRecMenuState nextState) {
case rmsSaveTimerConflictMenu: { case rmsSaveTimerConflictMenu: {
//caller: cRecMenuEditTimer //caller: cRecMenuEditTimer
//save timer from current timer conflict //save timer from current timer conflict
cTimer timerModified; cTimer *timerModified;
const cTimer *originalTimer; const cTimer *originalTimer;
if (cRecMenuEditTimer *menu = dynamic_cast<cRecMenuEditTimer*>(activeMenu)) { if (cRecMenuEditTimer *menu = dynamic_cast<cRecMenuEditTimer*>(activeMenu)) {
timerModified = menu->GetTimer(); timerModified = menu->GetTimer();
@ -749,7 +749,7 @@ eOSState cRecMenuView::StateMachine(eRecMenuState nextState) {
} }
break;} break;}
case rmsTimelineTimerSave: { case rmsTimelineTimerSave: {
cTimer timerModified; cTimer *timerModified;
const cTimer *originalTimer; const cTimer *originalTimer;
if (cRecMenuEditTimer *menu = dynamic_cast<cRecMenuEditTimer*>(activeMenu)) { if (cRecMenuEditTimer *menu = dynamic_cast<cRecMenuEditTimer*>(activeMenu)) {
timerModified = menu->GetTimer(); timerModified = menu->GetTimer();