diff --git a/epg_events.cpp b/epg_events.cpp index cd4996ec..1bf89351 100644 --- a/epg_events.cpp +++ b/epg_events.cpp @@ -1,6 +1,7 @@ #include #include #include +#include #include "tools.h" #include "recman.h" @@ -194,8 +195,35 @@ namespace vdrlive #if VDRVERSNUM < 10726 return m_recording ? m_recording->start : 0; #else - return m_recording ? m_recording->Start() : 0; + time_t endTime = 0; + if (m_recording) + { + time_t startTime = m_recording->Start(); + int length = m_recording->LengthInSeconds(); + + endTime = (length < 0) ? startTime : startTime + length; + } + return endTime; +#endif + } + + int EpgRecording::Elapsed() const + { +#if VDRVERSNUM >= 10726 + cControl* pControl = cControl::Control(); + if (pControl) + { + int current, total; + if (pControl->GetIndex(current,total)) + { + if (total) + { + return (100 * current) / total; + } + } + } #endif + return 0; } const string EpgRecording::Name() const diff --git a/epg_events.h b/epg_events.h index 7d05b458..3417f6ab 100644 --- a/epg_events.h +++ b/epg_events.h @@ -234,6 +234,8 @@ namespace vdrlive virtual time_t GetEndTime() const; + virtual int Elapsed() const; + private: const cRecording* m_recording; bool m_ownCaption;