diff options
| author | louis <louis.braun@gmx.de> | 2015-07-29 22:44:55 +0200 |
|---|---|---|
| committer | louis <louis.braun@gmx.de> | 2015-07-29 22:44:55 +0200 |
| commit | 5bb69c2a347901c7d9a4c1756c1bcf9ca652e43d (patch) | |
| tree | 23b20118999d3991962af5f7df85115d39d5790c /views/displaymenuitemcurrentview.c | |
| parent | 2efe2314e244e04f8d5fc61976e30a99240d54b2 (diff) | |
| download | vdr-plugin-skindesigner-5bb69c2a347901c7d9a4c1756c1bcf9ca652e43d.tar.gz vdr-plugin-skindesigner-5bb69c2a347901c7d9a4c1756c1bcf9ca652e43d.tar.bz2 | |
added {watched} and {percentseen} to displaymenurecordings current view
Diffstat (limited to 'views/displaymenuitemcurrentview.c')
| -rw-r--r-- | views/displaymenuitemcurrentview.c | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/views/displaymenuitemcurrentview.c b/views/displaymenuitemcurrentview.c index 357543e..1b8d09e 100644 --- a/views/displaymenuitemcurrentview.c +++ b/views/displaymenuitemcurrentview.c @@ -512,10 +512,34 @@ bool cDisplayMenuItemCurrentRecordingView::Render(void) { stringTokens.insert(pair<string,string>("name", buffer.c_str())); intTokens.insert(pair<string,int>("new", usedRecording->IsNew())); + int percSeen = 0; +#if APIVERSNUM < 20108 + percSeen = -1; +#else + percSeen = 0; + int framesSeen = usedRecording->GetResume(); + int framesTotal = usedRecording->NumFrames(); + if (framesTotal > 0) { + percSeen = (double)framesSeen / (double)framesTotal * 100; + } +#endif + intTokens.insert(pair<string,int>("percentseen", percSeen)); intTokens.insert(pair<string,int>("newrecordingsfolder", newRecs)); intTokens.insert(pair<string,int>("numrecordingsfolder", total)); intTokens.insert(pair<string,int>("cutted", usedRecording->IsEdited())); - + int recDuration = usedRecording->LengthInSeconds(); + bool watched = false; + if (usedRecording->IsEdited()) { + if (percSeen >= 85) + watched = true; + } else { + int watchedLimit = recDuration * 85 / 100 - (Setup.MarginStop + 5)*60; + int watchedTime = percSeen * recDuration / 100; + if (watchedLimit > 0 && watchedTime > 0 && (watchedTime > watchedLimit)) + watched = true; + } + intTokens.insert(pair<string,int>("watched", watched)); + SetScraperPoster(NULL, usedRecording); @@ -578,7 +602,6 @@ bool cDisplayMenuItemCurrentRecordingView::Render(void) { intTokens.insert(pair<string, int>("month", sStartTime->tm_mon+1)); int duration = event->Duration() / 60; - int recDuration = usedRecording->LengthInSeconds(); recDuration = (recDuration>0)?(recDuration / 60):0; stringTokens.insert(pair<string,string>("date", recDate.c_str())); stringTokens.insert(pair<string,string>("time", recTime.c_str())); |
