mirror of
https://projects.vdr-developer.org/git/vdr-plugin-skindesigner.git
synced 2023-10-19 15:58:31 +00:00
added {watched} and {percentseen} to displaymenurecordings current view
This commit is contained in:
@@ -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()));
|
||||
|
||||
Reference in New Issue
Block a user