added {watched} and {percentseen} to displaymenurecordings current view

This commit is contained in:
louis 2015-07-29 22:44:55 +02:00
parent 2efe2314e2
commit 5bb69c2a34
4 changed files with 30 additions and 5 deletions

View File

@ -400,5 +400,5 @@ Version 0.6.2
- added progressmodeonly viewelement in displayreplay - added progressmodeonly viewelement in displayreplay
- fixed bug in checking skin version - fixed bug in checking skin version
- added {watched} and {percentseen} to displaymenurecordings
current view

View File

@ -112,7 +112,7 @@
{minutes} Duration, rest of minutes {minutes} Duration, rest of minutes
{elapsed} Elapsed time of current Schedule in min (0 for recordings) {elapsed} Elapsed time of current Schedule in min (0 for recordings)
{remaining} Remaining time of current Schedule in min (0 for recordings) {remaining} Remaining time of current Schedule in min (0 for recordings)
{hasPoster} true if poster is available {hasposter} true if poster is available
{posterpath} Full Path of Poster to use in image path attribute {posterpath} Full Path of Poster to use in image path attribute
{posterwidth} width of poster in pixel {posterwidth} width of poster in pixel
{posterheight} height of poster in pixel {posterheight} height of poster in pixel

View File

@ -58,6 +58,8 @@
{durationeventhours} event duration, full hours {durationeventhours} event duration, full hours
{durationeventminutes} event duration, rest of minutes {durationeventminutes} event duration, rest of minutes
{new} true if recording is new {new} true if recording is new
{percentseen} percent already watched, -1 for VDR < 2.1.8
{watched} true if percentseen > 85% including MarginStop of not cutted recording
{cutted} true if recording is cutted {cutted} true if recording is cutted
{folder} true if item is a folder {folder} true if item is a folder
{numrecordingsfolder} if item is a folder, number of recordings in this folder {numrecordingsfolder} if item is a folder, number of recordings in this folder

View File

@ -512,9 +512,33 @@ bool cDisplayMenuItemCurrentRecordingView::Render(void) {
stringTokens.insert(pair<string,string>("name", buffer.c_str())); stringTokens.insert(pair<string,string>("name", buffer.c_str()));
intTokens.insert(pair<string,int>("new", usedRecording->IsNew())); 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>("newrecordingsfolder", newRecs));
intTokens.insert(pair<string,int>("numrecordingsfolder", total)); intTokens.insert(pair<string,int>("numrecordingsfolder", total));
intTokens.insert(pair<string,int>("cutted", usedRecording->IsEdited())); 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); SetScraperPoster(NULL, usedRecording);
@ -578,7 +602,6 @@ bool cDisplayMenuItemCurrentRecordingView::Render(void) {
intTokens.insert(pair<string, int>("month", sStartTime->tm_mon+1)); intTokens.insert(pair<string, int>("month", sStartTime->tm_mon+1));
int duration = event->Duration() / 60; int duration = event->Duration() / 60;
int recDuration = usedRecording->LengthInSeconds();
recDuration = (recDuration>0)?(recDuration / 60):0; recDuration = (recDuration>0)?(recDuration / 60):0;
stringTokens.insert(pair<string,string>("date", recDate.c_str())); stringTokens.insert(pair<string,string>("date", recDate.c_str()));
stringTokens.insert(pair<string,string>("time", recTime.c_str())); stringTokens.insert(pair<string,string>("time", recTime.c_str()));