Add tokens eventstart and eventstop to eDRRecTitleST

Tokens eventstart and eventstop can be used in displayreplay timshiftmode to
display the start and end time of the coresponding event
This commit is contained in:
kamel5 2021-02-12 15:20:34 +01:00
parent 808fba2367
commit 7a70ed13a7
6 changed files with 29 additions and 4 deletions

View File

@ -1491,6 +1491,13 @@ enum class eDRRecTitleST {
recsubtitle, recsubtitle,
recdate, recdate,
rectime, rectime,
eventstart,
eventstop,
count
};
enum class eDRRecTitleIT {
timeshift = 0,
count count
}; };

View File

@ -210,7 +210,7 @@ void cViewReplay::SetTimeShiftValues(int current, int total) {
const cEvent *eventReplay = Schedule->GetEventAround(time(NULL) - secondsafter); const cEvent *eventReplay = Schedule->GetEventAround(time(NULL) - secondsafter);
// Display title at replay position // Display title at replay position
if (eventReplay && eventReplay != lastEvent && veRecTitle) { if (eventReplay && eventReplay != lastEvent && veRecTitle) {
veRecTitle->Set(recording, eventReplay); veRecTitle->Set(recording, eventReplay, true);
veRecTitle->Parse(); veRecTitle->Parse();
lastEvent = eventReplay; lastEvent = eventReplay;
} }

View File

@ -22,10 +22,14 @@ void cVeDrRecTitle::SetTokenContainer(void) {
tokenContainer->DefineStringToken("{recsubtitle}", (int)eDRRecTitleST::recsubtitle); tokenContainer->DefineStringToken("{recsubtitle}", (int)eDRRecTitleST::recsubtitle);
tokenContainer->DefineStringToken("{recdate}", (int)eDRRecTitleST::recdate); tokenContainer->DefineStringToken("{recdate}", (int)eDRRecTitleST::recdate);
tokenContainer->DefineStringToken("{rectime}", (int)eDRRecTitleST::rectime); tokenContainer->DefineStringToken("{rectime}", (int)eDRRecTitleST::rectime);
tokenContainer->DefineStringToken("{eventstart}", (int)eDRRecTitleST::eventstart);
tokenContainer->DefineStringToken("{eventstop}", (int)eDRRecTitleST::eventstop);
tokenContainer->DefineIntToken("{timeshift}", (int)eDRRecTitleIT::timeshift);
InheritTokenContainer(); InheritTokenContainer();
} }
void cVeDrRecTitle::Set(const cRecording *recording, const cEvent *event) { void cVeDrRecTitle::Set(const cRecording *recording, const cEvent *event, bool timeshiftActive) {
this->timeshiftActive = timeshiftActive;
if (this->title) { if (this->title) {
free(this->title); free(this->title);
this->title = NULL; this->title = NULL;
@ -83,6 +87,11 @@ bool cVeDrRecTitle::Parse(bool force) {
tokenContainer->AddStringToken((int)eDRRecTitleST::recsubtitle, recShortText); tokenContainer->AddStringToken((int)eDRRecTitleST::recsubtitle, recShortText);
tokenContainer->AddStringToken((int)eDRRecTitleST::recdate, *ShortDateString(recording->Start())); tokenContainer->AddStringToken((int)eDRRecTitleST::recdate, *ShortDateString(recording->Start()));
tokenContainer->AddStringToken((int)eDRRecTitleST::rectime, *TimeString(recording->Start())); tokenContainer->AddStringToken((int)eDRRecTitleST::rectime, *TimeString(recording->Start()));
tokenContainer->AddIntToken((int)eDRRecTitleIT::timeshift, timeshiftActive);
if (event) {
tokenContainer->AddStringToken((int)eDRRecTitleST::eventstart, *TimeString(event->StartTime()));
tokenContainer->AddStringToken((int)eDRRecTitleST::eventstop, *TimeString(event->EndTime()));
}
} else if (title) { } else if (title) {
tokenContainer->AddStringToken((int)eDRRecTitleST::rectitle, title); tokenContainer->AddStringToken((int)eDRRecTitleST::rectitle, title);
} }

View File

@ -12,11 +12,12 @@ private:
const cRecording *recording; const cRecording *recording;
const cEvent *event; const cEvent *event;
char *title; char *title;
bool timeshiftActive;
public: public:
cVeDrRecTitle(void); cVeDrRecTitle(void);
virtual ~cVeDrRecTitle(void); virtual ~cVeDrRecTitle(void);
void SetTokenContainer(void); void SetTokenContainer(void);
void Set(const cRecording *recording = NULL, const cEvent *event = NULL); void Set(const cRecording *recording = NULL, const cEvent *event = NULL, bool timeshiftActive = false);
void Set(const char *title = NULL); void Set(const char *title = NULL);
bool Parse(bool forced = false); bool Parse(bool forced = false);
}; };

View File

@ -38,7 +38,12 @@
</scrapercontent> </scrapercontent>
<rectitle> <rectitle>
<area x="12%" y="75%" width="63%" height="6%" layer="2"> <area condition="{timeshift}" x="12%" y="75%" width="63%" height="6%" layer="2">
<drawtext name="eventtime" align="right" y="0" fontsize="{areaheight}*{replaytitlesize}/100" font="{bold}" color="{fontactive}" text= "{eventstart} - {eventstop}" />
<drawtext name="title" x="0" y="0" width="{areawidth} - {width(eventtime)} - 2" fontsize="{areaheight}*{replaytitlesize}/100" font="{regular}" color="{fontdefault}" text="{rectitle}" />
<drawtext condition="isset{title} ++ isset{recsubtitle}" x="{width(title)}" y="0" width="{areawidth} - {width(title)} - {width(eventtime)} - 2" fontsize="{areaheight}*{replaytitlesize}/100" font="{regular}" color="{fontdefault}" text=" - {recsubtitle}" />
</area>
<area condition="not{timeshift}" x="12%" y="75%" width="63%" height="6%" layer="2">
<drawtext name="title" x="0" y="0" fontsize="{areaheight}*{replaytitlesize}/100" font="{regular}" color="{fontdefault}" text="{rectitle}" /> <drawtext name="title" x="0" y="0" fontsize="{areaheight}*{replaytitlesize}/100" font="{regular}" color="{fontdefault}" text="{rectitle}" />
<drawtext condition="isset{title} ++ isset{recsubtitle}" x="{width(title)}" y="0" fontsize="{areaheight}*{replaytitlesize}/100" font="{regular}" color="{fontdefault}" text=" - {recsubtitle}" /> <drawtext condition="isset{title} ++ isset{recsubtitle}" x="{width(title)}" y="0" fontsize="{areaheight}*{replaytitlesize}/100" font="{regular}" color="{fontdefault}" text=" - {recsubtitle}" />
</area> </area>

View File

@ -56,6 +56,9 @@
{recsubtitle} Subtitle of the Recording {recsubtitle} Subtitle of the Recording
{recdate} Date Recording in dd.mm.yy {recdate} Date Recording in dd.mm.yy
{rectime} Time of Recording in hh:mm {rectime} Time of Recording in hh:mm
{eventstart} Starttime of coresponding event in timeshiftmode in hh:mm
{eventstop} Endtime of coresponding event in timeshiftmode in hh:mm
{timeshift} true if a timeshifted recording is displayed
--> -->
<rectitle> <rectitle>
</rectitle> </rectitle>