An error with the remaining time in the channel display has been fixed

The remaining time in the channel display wasn't updated.
A new token "currentremaining" was introduced in the Progressbar section
of displaychannel.xml.
This commit is contained in:
kamel5 2021-02-10 13:33:54 +01:00
parent 78d424d256
commit 538d59ca4e
6 changed files with 22 additions and 6 deletions

View File

@ -433,6 +433,7 @@ enum class eDCProgressBarIT {
remaining,
permashift,
livebuffer,
currentremaining,
count
};

View File

@ -216,16 +216,19 @@ void cVeDcProgressBar::SetTokenContainer(void) {
tokenContainer->DefineIntToken("{remaining}", (int)eDCProgressBarIT::remaining);
tokenContainer->DefineIntToken("{permashift}", (int)eDCProgressBarIT::permashift);
tokenContainer->DefineIntToken("{livebuffer}", (int)eDCProgressBarIT::livebuffer);
tokenContainer->DefineIntToken("{currentremaining}", (int)eDCProgressBarIT::currentremaining);
InheritTokenContainer();
}
void cVeDcProgressBar::Set(const cEvent *p) {
if (!p) {
startTime = -1;
endTime = -1;
duration = -1;
return;
}
startTime = p->StartTime();
endTime = p-> EndTime();
duration = p->Duration();
int current = 0;
@ -249,18 +252,24 @@ void cVeDcProgressBar::Set(const cEvent *p) {
} else {
tokenContainer->AddIntToken((int)eDCProgressBarIT::permashift, 0);
}
tokenContainer->AddIntToken((int)eDCProgressBarIT::currentremaining, (int)round((endTime - t) / 60));
}
bool cVeDcProgressBar::Parse(bool force) {
if (!cViewElement::Parse(force))
return false;
int current = 0;
time_t t = time(NULL);
if (t > startTime)
current = t - startTime;
if (!(current > currentLast + 3) && !force && !Dirty())
return false;
currentLast = current;
SetDirty();
if (duration <= 0) {
tokenContainer->AddIntToken((int)eDCProgressBarIT::duration, 0);
tokenContainer->AddIntToken((int)eDCProgressBarIT::elapsed, 0);
@ -276,6 +285,7 @@ bool cVeDcProgressBar::Parse(bool force) {
} else {
tokenContainer->AddIntToken((int)eDCProgressBarIT::permashift, 0);
}
tokenContainer->AddIntToken((int)eDCProgressBarIT::currentremaining, (int)round((endTime - t) / 60));
}
return true;
}

View File

@ -51,6 +51,7 @@ class cVeDcProgressBar : public cViewElement {
private:
int currentLast;
int startTime;
int endTime;
int duration;
int GetLiveBuffer(void);
public:
@ -199,4 +200,4 @@ public:
cVeDcGroupChannelListDetail(void) {};
virtual ~cVeDcGroupChannelListDetail(void) {};
};
#endif //__VIEWELEMENTSDC_H
#endif //__VIEWELEMENTSDC_H

View File

@ -37,9 +37,6 @@
<drawtext condition="isset{currentsubtitle}" x="0" y="{areaheight}*{epgsubtextposy}/100" fontsize="{areaheight}*{epgsubtextfontsize}/100" width="{areawidth} - {width(startstop)} - 10" font="{regular}" color="{fontdefault}" text="{currentsubtitle}" />
<drawtext condition="empty{currentsubtitle}" x="0" valign="center" fontsize="{areaheight}*{epgtextfontsizelarge}/100" width="{areawidth} - {width(startstop)} - 10" font="{regular}" color="{fontdefault}" text="{currenttitle}" />
</area>
<area x="70%" y="83%" width="10%" height="3%" layer="2">
<drawtext align="right" y="0" fontsize="100%" font="{regular}" color="{fontactive}" text="+{currentremaining} min" />
</area>
<!-- next schedule -->
<area x="20%" y="88%" width="60%" height="10%" layer="2">
<drawtext name="startstop" align="right" valign="center" fontsize="{areaheight}*{startstopfontsize}/100" font="{bold}" color="{fontdefault}" text="{nextstart} - {nextstop}" />
@ -58,6 +55,10 @@
<drawrectangle condition="{permashift}" x="{elapsed}/{duration}*{areawidth} - {livebuffer}/{duration}*{areawidth}" y="0" width="{livebuffer}/{duration}*{areawidth}" height="100%" color="{progressbartimeshift}" />
<drawrectangle condition="{permashift}" x="0" y="{areaheight}*0.2" width="{areawidth}*{elapsed}/{duration} - 1" height="{areaheight}*0.6" color="{progressbar}" />
</area>
<!-- time remaining -->
<area x="70%" y="83%" width="10%" height="3%" layer="2">
<drawtext align="right" y="0" fontsize="100%" font="{regular}" color="{fontactive}" text="+{currentremaining} min" />
</area>
</progressbar>
<statusinfo>

View File

@ -28,7 +28,6 @@
<area x="22%" y="80%" width="76%" height="7%" layer="2">
<drawtext name="title" x="0" valign="center" font="{light}" fontsize="99%" color="{fontdefault}" text="{currenttitle}" width="{areawidth} - {width(startstop)}"/>
<drawtext name="startstop" align="right" y="0" font="{light}" fontsize="60%" color="{fontdefault}" text="{currentstart} - {currentstop}" />
<drawtext align="right" y="45%" font="{light}" fontsize="60%" color="{fontdefault}" text="+ {currentremaining} min" />
</area>
<area x="22%" y="87%" width="76%" height="7%" layer="2">
<drawtext x="0" valign="center" font="{light}" fontsize="80%" color="{fontdefault}" text="{nexttitle}" width="{areawidth} - {width(startstop)}"/>
@ -47,6 +46,9 @@
<drawrectangle x="{elapsed}/{duration}*{areawidth} - {livebuffer}/{duration}*{areawidth}" y="0" width="{livebuffer}/{duration}*{areawidth}" height="5" color="{clrRed}" />
<drawrectangle x="0" y="1" width="{elapsed}/{duration}*{areawidth}" height="3" color="{menuheader}" />
</area>
<area x="22%" y="80%" width="76%" height="7%" layer="2">
<drawtext align="right" y="45%" font="{light}" fontsize="60%" color="{fontdefault}" text="+ {currentremaining} min" />
</area>
</progressbar>
<statusinfo>

View File

@ -25,7 +25,7 @@
{currentdurationhours} Duration, full hours
{currentdurationminutes} Duration, rest of minutes
{currentelapsed} Elapsed time of current Schedule in min
{currentremaining} Remaining time of current Schedule in min
{currentremaining} Remaining time of current Schedule in min -> DEPRECATED, it doesn't work as expected
{currentrecording} true if current Schedule is recorded
{hasVPS} true if current Schedule has VPS
{nexttitle} Title of next Schedule
@ -48,6 +48,7 @@
{remaining} Remaining time of current Schedule in seconds
{permashift} true if permashift plugin is in use
{livebuffer} current buffered data in seconds
{currentremaining} Remaining time of current Schedule in min
-->
<progressbar>
</progressbar>