mb.cpp: little better solution to trigger seen tag

Origin commit data
------------------
Branch: ni/coolstream
Commit: 88a3db4b1f
Author: GetAway <get-away@t-online.de>
Date: 2019-05-25 (Sat, 25 May 2019)


------------------
No further description and justification available within origin commit message!

------------------
This commit was generated by Migit
This commit is contained in:
GetAway
2019-05-25 22:07:35 +02:00
committed by vanhofen
parent fc91ee0d67
commit 1024ada89e

View File

@@ -45,6 +45,7 @@
#include <driver/screen_max.h>
#include <algorithm>
#include <cmath>
//#include <cstdlib>
#include "mb.h"
#include "mb_functions.h"
@@ -1969,16 +1970,20 @@ void CMovieBrowser::refreshBrowserList(void) //P1
* NOTE: Get threshold offset from record safety settings to trigger the "seen" tag.
* Better solutions are welcome!
*/
int pre = 0,post = 0;
int pre = 0, post = 0;
float trigger_offset = 0;
g_Timerd->getRecordingSafety(pre,post);
g_settings.record_safety_time_before = pre/60;
g_settings.record_safety_time_after = post/60;
int trigger_offset = (g_settings.record_safety_time_before + g_settings.record_safety_time_after) * m_vHandleBrowserList[handle]->length / 100;
if (post < 120)
post = 120;
if (m_vHandleBrowserList[handle]->length * 60 > post)
trigger_offset = round((float)post * 100.0 / (m_vHandleBrowserList[handle]->length * 60.0));
int elapsed_percent = atoi(string_item);
string_item.clear(); // reset not needed
if (elapsed_percent < 100-trigger_offset)
if ((float)elapsed_percent < 100.0-trigger_offset)
{
if (elapsed_percent > 0)
{