diff options
author | Timo Eskola <timo@tolleri.net> | 2018-09-05 09:03:20 +0300 |
---|---|---|
committer | Timo Eskola <timo@tolleri.net> | 2018-09-05 09:03:20 +0300 |
commit | bad9290d3d3cfd335fca6ac38d5eefbee976b33e (patch) | |
tree | b9305ee3cd8f8eeb0d5de898e89a8975dbfe3574 | |
parent | f0cd07ff71b9c9a48003501d47f1c192224193fa (diff) | |
download | vdr-plugin-duplicates-bad9290d3d3cfd335fca6ac38d5eefbee976b33e.tar.gz vdr-plugin-duplicates-bad9290d3d3cfd335fca6ac38d5eefbee976b33e.tar.bz2 |
Check for vanished recorgins in info menu.
-rw-r--r-- | HISTORY | 1 | ||||
-rw-r--r-- | menu.c | 35 |
2 files changed, 33 insertions, 3 deletions
@@ -8,6 +8,7 @@ VDR Plugin 'duplicates' Revision History - Added missing recordings lock release. - Simplified toggle hidden. - Fixed recordings locking sequence. +- Check for vanished recorgins in info menu. 2018-08-30: Version 0.2.1 @@ -45,6 +45,11 @@ eOSState cDuplicatesReplayControl::ProcessKey(eKeys Key) { class cMenuDuplicate : public cOsdMenu { private: const cRecording *recording; +#if VDRVERSNUM >= 20301 + cString originalFileName; + cStateKey recordingsStateKey; + bool RefreshRecording(void); +#endif public: cMenuDuplicate(const cRecording *Recording); virtual void Display(void); @@ -57,9 +62,29 @@ cMenuDuplicate::cMenuDuplicate(const cRecording *Recording) SetMenuCategory(mcRecording); #endif recording = Recording; +#if VDRVERSNUM >= 20301 + originalFileName = recording->FileName(); +#endif SetHelp(trVDR("Button$Play")); } +#if VDRVERSNUM >= 20301 +bool cMenuDuplicate::RefreshRecording(void) +{ + if (const cRecordings *Recordings = cRecordings::GetRecordingsRead(recordingsStateKey)) { + if ((recording = Recordings->GetByName(originalFileName)) != NULL) + Display(); + else { + recordingsStateKey.Remove(); + Skins.Message(mtWarning, trVDR("Recording vanished!")); + return false; + } + recordingsStateKey.Remove(); + } + return true; +} +#endif + void cMenuDuplicate::Display(void) { cOsdMenu::Display(); DisplayMenu()->SetRecording(recording); @@ -67,8 +92,11 @@ void cMenuDuplicate::Display(void) { cStatus::MsgOsdTextItem(recording->Info()->Description()); } -eOSState cMenuDuplicate::ProcessKey(eKeys Key) -{ +eOSState cMenuDuplicate::ProcessKey(eKeys Key) { +#if VDRVERSNUM >= 20301 + if (!RefreshRecording()) + return osBack; // the recording has vanished, so close this menu +#endif switch (int(Key)) { case kUp|k_Repeat: case kUp: @@ -401,10 +429,11 @@ eOSState cMenuDuplicates::Info(void) { cRecording *recording = Recordings.GetByName(ri->FileName()); #endif if (recording && recording->Info()->Title()) { + cMenuDuplicate *MenuDuplicate = new cMenuDuplicate(recording); #if VDRVERSNUM >= 20301 stateKey.Remove(); #endif - return AddSubMenu(new cMenuDuplicate(recording)); + return AddSubMenu(MenuDuplicate); } #if VDRVERSNUM >= 20301 else |