diff options
author | Matti Lehtimäki <matti.lehtimaki@gmail.com> | 2018-04-17 00:30:29 +0300 |
---|---|---|
committer | Matti Lehtimäki <matti.lehtimaki@gmail.com> | 2018-04-17 00:30:29 +0300 |
commit | dce75c2b7fac2b5017ffc2d9d4d98786f7a82e40 (patch) | |
tree | 48d4209793db798e98c442decf12d50ff33d5a81 | |
parent | 1f4b15851bac522e45056ce7e5055458f28c7206 (diff) | |
download | vdr-plugin-history-master.tar.gz vdr-plugin-history-master.tar.bz2 |
-rw-r--r-- | history.c | 10 | ||||
-rw-r--r-- | logger.c | 10 | ||||
-rw-r--r-- | menu.c | 33 | ||||
-rw-r--r-- | menu.h | 3 |
4 files changed, 52 insertions, 4 deletions
@@ -163,8 +163,16 @@ cString cPluginHistory::SVDRPCommand(const char *Command, const char *Option, in char *time = item->GetReplayTimeString(); string = cString::sprintf("%s%s\n", *string, time); free(time); + const cRecording *recording; +#if VDRVERSNUM >= 20301 + { + LOCK_RECORDINGS_READ; + recording = Recordings->GetByName(item->GetFilename()); + } +#else cThreadLock RecordingsLock(&Recordings); - cRecording *recording = Recordings.GetByName(item->GetFilename()); + recording = Recordings.GetByName(item->GetFilename()); +#endif if (recording) string = cString::sprintf("%s%s\n", *string, recording->Title(' ')); item = (cHistoryRecordingItem *)item->Next(); @@ -71,8 +71,16 @@ void cHistoryLogger::Replaying(const cControl *Control, const char *Name, const if (On) { if (FileName) { // Check if file is a VDR recording + const cRecording *recording; +#if VDRVERSNUM >= 20301 + { + LOCK_RECORDINGS_READ; + recording = Recordings->GetByName(FileName); + } +#else cThreadLock RecordingsLock(&Recordings); - cRecording *recording = Recordings.GetByName(FileName); + recording = Recordings.GetByName(FileName); +#endif // Use name only if not a VDR recording replay_history->Ins(new cHistoryRecordingItem(!recording ? Name : NULL, FileName)); if (replay_history->Count() > HistorySetup.replay_history_size) @@ -86,8 +86,16 @@ cHistoryRecordingMenuItem::cHistoryRecordingMenuItem(const char *Name, const cha name = Name ? strdup(Name) : NULL; if (filename) { if (!name) { + const cRecording *recording; +#if VDRVERSNUM >= 20301 + { + LOCK_RECORDINGS_READ; + recording = Recordings->GetByName(filename); + } +#else cThreadLock RecordingsLock(&Recordings); - cRecording *recording = Recordings.GetByName(filename); + recording = Recordings.GetByName(filename); +#endif if (recording) { active = true; SetText(recording->Title('\t')); @@ -151,10 +159,26 @@ void cHistoryMainMenu::SetMenu() } } +#if VDRVERSNUM >= 20301 +const cRecording *cHistoryMainMenu::GetRecordingRead(cHistoryRecordingMenuItem *Item) +{ + LOCK_RECORDINGS_READ; + const cRecording *recording = Recordings->GetByName(Item->GetFilename()); + if (!recording) + Skins.Message(mtError, trVDR("Error while accessing recording!")); + return recording; +} +#endif + cRecording *cHistoryMainMenu::GetRecording(cHistoryRecordingMenuItem *Item) { +#if VDRVERSNUM >= 20301 + LOCK_RECORDINGS_WRITE; + cRecording *recording = Recordings->GetByName(Item->GetFilename()); +#else cThreadLock RecordingsLock(&Recordings); cRecording *recording = Recordings.GetByName(Item->GetFilename()); +#endif if (!recording) Skins.Message(mtError, trVDR("Error while accessing recording!")); return recording; @@ -181,7 +205,12 @@ eOSState cHistoryMainMenu::Info() { cHistoryRecordingMenuItem *ri = (cHistoryRecordingMenuItem *)Get(Current()); if (ri) { - cRecording *recording = GetRecording(ri); + const cRecording *recording; +#if VDRVERSNUM >= 20301 + recording = GetRecordingRead(ri); +#else + recording = GetRecording(ri); +#endif if (recording && recording->Info()->Title()) return AddSubMenu(new cHistoryRecordingMenu(recording)); } @@ -24,6 +24,9 @@ private: eOSState Info(); eOSState Play(); eOSState Rewind(); +#if VDRVERSNUM >= 20301 + const cRecording *GetRecordingRead(cHistoryRecordingMenuItem *Item); +#endif cRecording *GetRecording(cHistoryRecordingMenuItem *Item); public: |