added token {watched} to displaymenurecordings

This commit is contained in:
louis 2015-05-10 14:19:36 +02:00
parent 71fa86f1cc
commit 57999a442f
3 changed files with 15 additions and 2 deletions

View File

@ -315,3 +315,4 @@ Version 0.4.5
- added {numtimers} Token to lastrecordings viewelement - added {numtimers} Token to lastrecordings viewelement
- fixed time display bug in displaymenurecordings - fixed time display bug in displaymenurecordings
- added token {watched} to displaymenurecordings

View File

@ -18,6 +18,7 @@
{current} true if item is currently selected {current} true if item is currently selected
{new} true if recording is new {new} true if recording is new
{percentseen} percent already watched, -1 for VDR < 2.1.8 {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

@ -753,13 +753,25 @@ void cDisplayMenuItemRecordingView::SetTokens(void) {
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));
const cEvent *event = NULL; const cEvent *event = NULL;
const cRecordingInfo *info = usedRecording->Info(); const cRecordingInfo *info = usedRecording->Info();
if (!info) return; if (!info) return;
event = info->GetEvent(); event = info->GetEvent();
if (!event) return; if (!event) return;
string recDate = *(event->GetDateString()); string recDate = *(event->GetDateString());
string recTime = *(event->GetTimeString()); string recTime = *(event->GetTimeString());
if (recDate.find("1970") != string::npos) { if (recDate.find("1970") != string::npos) {
@ -777,7 +789,6 @@ void cDisplayMenuItemRecordingView::SetTokens(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()));