diff options
author | Manuel Reimer <manuel.reimer@gmx.de> | 2021-02-05 19:21:35 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-05 19:21:35 +0100 |
commit | 74e176589043610a3f65bcb37bf3180aa39061fc (patch) | |
tree | cff7d41ca70afebf02ab7f9cb44edaea293b1926 | |
parent | a21ba806ef957fc42c9d9eb9378fae6b5d186dcf (diff) | |
parent | a96ef369124640874361cf108c47d3e5705df5cc (diff) | |
download | vdr-plugin-graphlcd-74e176589043610a3f65bcb37bf3180aa39061fc.tar.gz vdr-plugin-graphlcd-74e176589043610a3f65bcb37bf3180aa39061fc.tar.bz2 |
Merge pull request #5 from pbiering/enhance-up-to-three-recordings
Enhance up to three recordings lines in skin
-rw-r--r-- | HISTORY | 6 | ||||
-rw-r--r-- | graphlcd/skins/reelbox/reelbox.skin | 21 | ||||
-rw-r--r-- | plugin.c | 10 | ||||
-rw-r--r-- | skinconfig.c | 20 | ||||
-rw-r--r-- | state.c | 35 | ||||
-rw-r--r-- | state.h | 3 |
6 files changed, 80 insertions, 15 deletions
@@ -1,5 +1,11 @@ VDR Plugin 'graphlcd' Revision History ------------------------------------- + +2021-02-04: +- [pbiering] add support for new feature: NumRecordings and ListRecordings +- [pbiering] extend reelbox.skin for using NumRecordings and ListRecordings (up to 3) +- [pbiering] fix Wformat-truncation Wliteral-suffix. log levels + 2021-01-24: Version 1.0.3 - [pbiering] fix deadlock for vdr >= 2.4.4 (at least found here) in case of deleting a channel diff --git a/graphlcd/skins/reelbox/reelbox.skin b/graphlcd/skins/reelbox/reelbox.skin index 9132fb9..6b90de2 100644 --- a/graphlcd/skins/reelbox/reelbox.skin +++ b/graphlcd/skins/reelbox/reelbox.skin @@ -253,7 +253,7 @@ <text x="0" y="#PresentShortTextY" condition="gt(#ProginfoLines,2)" width="#PresentShortTextW" height="FontLineHeight('FontTitleSmall')" color="#ColPresentTitle" align="left" font="FontTitleSmall"> {PresentShortText} </text> - <block condition="{FollowingValid}"> + <block condition="and({FollowingValid},not({IsRecording}))"> <text x="0" y="#FollowingTitleY" condition="or(gt(#ProginfoLines,3),and(ge(#ProginfoLines,2),not({IsRecording})))" height="FontLineHeight('FontInfoSmall')" color="#ColPresentTitle" align="left" font="FontInfoSmall"> {FollowingStartDateTime:%H\:%M} </text> @@ -265,11 +265,20 @@ </text> </block> - <rectangle x1="0" x2="-1" y="#RecordingsLineY" height="#LineThickness" condition="{IsRecording}" color="#ColBorder" filled="yes"/> - <image x="0" y="#RecordingsSymbolY" color="#ColSymbol" path="#SymbolRecording" condition="{IsRecording}"/> - <text x1="add(#SymbolW,2)" x2="-1" y="#RecordingsTextY" height="FontLineHeight('FontInfoSmall2')" color="#ColRecText" align="left" font="FontInfoSmall2"> - {Recordings} - </text> + <block condition="ge({NumRecordings},1)"> + <image x="0" y="#FollowingTitleY" color="#ColSymbol" path="#SymbolRecording"/> + <text x1="add(#SymbolW,2)" x2="-1" y="add(#FollowingTitleY,1)" height="FontLineHeight('FontInfoSmall2')" color="#ColRecText" align="left" font="FontInfoSmall2">{ListRecordings:1}</text> + </block> + + <block condition="ge({NumRecordings},2)"> + <image x="0" y="add(#FollowingTitleY,FontLineHeight('FontInfoSmall2'),1)" color="#ColSymbol" path="#SymbolRecording"/> + <text x1="add(#SymbolW,2)" x2="-1" y="add(#FollowingTitleY,FontLineHeight('FontInfoSmall2'),2)" height="FontLineHeight('FontInfoSmall2')" color="#ColRecText" align="left" font="FontInfoSmall2">{ListRecordings:2}</text> + </block> + + <block condition="ge({NumRecordings},3)"> + <image x="0" y="add(#FollowingTitleY,mul(FontLineHeight('FontInfoSmall2'),2),2)" color="#ColSymbol" path="#SymbolRecording"/> + <text x1="add(#SymbolW,2)" x2="-1" y="add(#FollowingTitleY,mul(FontLineHeight('FontInfoSmall2'),2),3)" height="FontLineHeight('FontInfoSmall2')" color="#ColRecText" align="left" font="FontInfoSmall2">{ListRecordings:3}</text> + </block> </display> <display id="volume"> @@ -128,7 +128,7 @@ cPluginGraphLCD::~cPluginGraphLCD() const char * cPluginGraphLCD::CommandLineHelp() { - return " -c, --config=CFG use CFG as driver config file (default is \""PLUGIN_GRAPHLCDCONF"\")\n" + return " -c, --config=CFG use CFG as driver config file (default is \"" PLUGIN_GRAPHLCDCONF "\")\n" " -d, --display=DISP[,DISP]... use display DISP for output or if DISP=none: start w/o any display\n" " -s, --skin=SKIN[,SKIN]... use skin SKIN (default is \"default\")\n" " -p, --skinspath=PATH use path PATH for skins (default is \"<plugin_config>/skins/\")\n"; @@ -341,14 +341,14 @@ void cPluginGraphLCD::MainThreadHook() { if (mDisplay[index].Disp->Active()) { - dsyslog("graphlcd plugin: DEBUG: Display thread for %s is ready", mDisplay[index].Name.c_str()); + isyslog("graphlcd plugin: INFO: Display thread for %s is ready", mDisplay[index].Name.c_str()); mDisplay[index].Status = CONNECTED; } else { if ( (cTimeMs::Now() - mDisplay[index].to_timestamp) > (uint64_t) 10000) { - dsyslog ("graphlcd plugin: DEBUG: Timeout while waiting for display thread %s", mDisplay[index].Name.c_str()); + esyslog ("graphlcd plugin: ERROR: Timeout while waiting for display thread %s", mDisplay[index].Name.c_str()); /* no activity after 10 secs: display is unusable */ //GraphLCDSetup.PluginActive = 0; DisconnectDisplay(index); @@ -510,9 +510,9 @@ cString cPluginGraphLCD::SVDRPCommand(const char *Command, const char *Option, i } } } - char buf[25]; + char buf[64]; std::string retval = "RECONNECT status: "; - snprintf(buf, 24, "OK = %1d, FAILED = %1d", count_ok, count_fail); + snprintf(buf, sizeof(buf), "OK = %1d, FAILED = %1d", count_ok, count_fail); retval += buf; return retval.c_str(); } diff --git a/skinconfig.c b/skinconfig.c index 39b6c75..b6a27ef 100644 --- a/skinconfig.c +++ b/skinconfig.c @@ -56,6 +56,8 @@ typedef enum _eTokenId tokPrivateRecordingStart, tokIsRecording, tokRecordings, + tokListRecordings, + tokNumRecordings, tokPrivateRecordingEnd, // present event @@ -209,6 +211,8 @@ static const std::string Tokens[tokCountToken] = "privateRecordingStart", "IsRecording", "Recordings", + "ListRecordings", + "NumRecordings", "privateRecordingEnd", "privatePresentStart", @@ -472,8 +476,20 @@ GLCD::cType cGraphLCDSkinConfig::GetToken(const GLCD::tSkinToken & Token) case tokRecordings: { if (Token.Attrib.Type == GLCD::aNumber) - return mState->Recordings(Token.Attrib.Number); - return mState->Recordings(-1); + return mState->Recordings(Token.Attrib.Number, 0); + return mState->Recordings(-1, 0); + } + case tokListRecordings: + { + if (Token.Attrib.Type == GLCD::aNumber) + return mState->Recordings(-1, Token.Attrib.Number); + return false; + } + case tokNumRecordings: + { + if (Token.Attrib.Type == GLCD::aNumber) + return mState->NumRecordings(Token.Attrib.Number); + return mState->NumRecordings(-1); } default: break; @@ -900,20 +900,31 @@ bool cGraphLCDState::IsRecording(int CardNumber) return ret; } -std::string cGraphLCDState::Recordings(int CardNumber) +std::string cGraphLCDState::Recordings(int CardNumber, int selector) { std::string ret = ""; std::vector <tRecording>::iterator it; + int count = 0; mutex.Lock(); + // dsyslog("%s/%s: called CardNumber=%d selector=%d", PLUGIN_NAME_I18N, __FUNCTION__, CardNumber, selector); it = mRecordings.begin(); while (it != mRecordings.end()) { if (CardNumber == -1 || it->deviceNumber == CardNumber) { + count++; + if (selector > 0) { + if (count == selector) { + // dsyslog("%s/%s: selector hit CardNumber=%d selector=%d count=%d", PLUGIN_NAME_I18N, __FUNCTION__, CardNumber, selector, count); + ret += it->name; + break; + } + } else { if (ret.length() > 0) ret += "\n"; ret += it->name; + } } it++; } @@ -922,6 +933,28 @@ std::string cGraphLCDState::Recordings(int CardNumber) return ret; } +int cGraphLCDState::NumRecordings(int CardNumber) +{ + std::string ret = ""; + std::vector <tRecording>::iterator it; + int count = 0; + + mutex.Lock(); + // dsyslog("%s/%s: called CardNumber=%d", PLUGIN_NAME_I18N, __FUNCTION__, CardNumber); + it = mRecordings.begin(); + while (it != mRecordings.end()) + { + if (CardNumber == -1 || it->deviceNumber == CardNumber) + { + count++; + } + it++; + } + mutex.Unlock(); + + return count; +} + tOsdState cGraphLCDState::GetOsdState() { tOsdState ret; @@ -159,7 +159,8 @@ public: tEvent GetFollowingEvent(); tReplayState GetReplayState(); bool IsRecording(int CardNumber); - std::string Recordings(int CardNumber); + std::string Recordings(int CardNumber, int selector); + int NumRecordings(int CardNumber); tOsdState GetOsdState(); void ResetOsdStateScroll(); tVolumeState GetVolumeState(); |