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 ""
"Project-Id-Version: vdr-tvguide 0.0.1\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"
"Last-Translator: My friend <Sampep> Thanks David <Gabychan> <gbonich@gmail.com>\n"
"Language-Team: \n"
@ -57,6 +57,9 @@ msgstr ""
msgid "images"
msgstr ""
msgid "tvguide: RemoteTimerModifications failed"
msgstr ""
msgid "root video folder"
msgstr "Directori principal per a vídeo"

View File

@ -3,7 +3,7 @@ msgid ""
msgstr ""
"Project-Id-Version: vdr-tvguide 0.0.1\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"
"Last-Translator: Horst\n"
"Language-Team: \n"
@ -54,6 +54,9 @@ msgstr "Favoriten"
msgid "images"
msgstr "Bilder"
msgid "tvguide: RemoteTimerModifications failed"
msgstr ""
msgid "root video folder"
msgstr "Video Hauptverzeichnis"

View File

@ -3,7 +3,7 @@ msgid ""
msgstr ""
"Project-Id-Version: vdr-tvguide 0.0.1\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"
"Last-Translator: fiveten_59\n"
"Language-Team: \n"
@ -54,6 +54,9 @@ msgstr "Favoriti"
msgid "images"
msgstr "Immagini"
msgid "tvguide: RemoteTimerModifications failed"
msgstr ""
msgid "root video folder"
msgstr "cartella video di root"

View File

@ -3,7 +3,7 @@ msgid ""
msgstr ""
"Project-Id-Version: vdr-tvguide 1.0.0\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"
"Last-Translator: AmiD, ilya\n"
"Language-Team: Russia-Cherepovets(wm.amid@gmail.com)\n"
@ -54,6 +54,9 @@ msgstr ""
msgid "images"
msgstr ""
msgid "tvguide: RemoteTimerModifications failed"
msgstr ""
msgid "root video folder"
msgstr "Главная видео директория"

View File

@ -3,7 +3,7 @@ msgid ""
msgstr ""
"Project-Id-Version: vdr-tvguide 1.1.0\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"
"Last-Translator: Milan Hrala <hrala.milan@gmail.com>\n"
"Language-Team: \n"
@ -54,6 +54,9 @@ msgstr ""
msgid "images"
msgstr ""
msgid "tvguide: RemoteTimerModifications failed"
msgstr ""
msgid "root video folder"
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 *timer = new cTimer(event);
#if VDRVERSNUM >= 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
@ -115,11 +116,20 @@ 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 VDRVERSNUM >= 20301
if (!HandleRemoteTimerModifications(timer)) {
timers->Del(timer);
esyslog(tr("tvguide: RemoteTimerModifications failed"));
} else {
isyslog("timer %s added (active)", *timer->ToDescr());
}
SetTimerPath(timer, event, path);
timers->SetModified();
#else
isyslog("timer %s added (active)", *timer->ToDescr());
#endif
}
return timer;
}
@ -204,6 +214,12 @@ void cRecManager::DeleteTimer(const cTimer *timer) {
#if VDRVERSNUM >= 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;
@ -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)
return;
#if VDRVERSNUM >= 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"));
}
}
#else
cTimer *timer = Timers.GetTimer((cTimer*)t);
cTimers* timers = &Timers;
#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();
cTimer *timer = timers->GetTimer(t);
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);
@ -264,10 +289,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)
if (active)
timer->SetFlags(tfActive);
else
timer->ClrFlags(tfActive);
#if VDRVERSNUM < 20300
timer->SetEventFromSchedule();
@ -280,9 +305,9 @@ void cRecManager::SaveTimer(const cTimer *t, cTimer newTimerSettings) {
RefreshRemoteTimers();
} else {
#if VDRVERSNUM >= 20301
Timers->SetModified();
timers->SetModified();
#else
Timers.SetModified();
timers.SetModified();
#endif
}
}

View File

@ -37,7 +37,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);

View File

@ -467,17 +467,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);
t->SetFlags(tfActive);
else
t.SetFlags(tfNone);
t.SetDay(day);
t.SetStart(start);
t.SetStop(stop);
t.SetPriority(prio);
t.SetLifetime(lifetime);
t->ClrFlags(tfActive);
t->SetDay(day);
t->SetStart(start);
t->SetStop(stop);
t->SetPriority(prio);
t->SetLifetime(lifetime);
std::string newFolder(folder);
std::string newFile = originalTimer->File();
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());
}
std::replace(newFile.begin(), newFile.end(), '/', '~');
t.SetFile(newFile.c_str());
t->SetFile(newFile.c_str());
return t;
}

View File

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

View File

@ -206,7 +206,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();
@ -290,7 +290,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();
@ -749,7 +749,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();