Skip to content

Commit

Permalink
channellogos
Browse files Browse the repository at this point in the history
  • Loading branch information
Markus Ehrnsperger committed Dec 2, 2023
1 parent 9046473 commit 1569600
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 5 deletions.
5 changes: 3 additions & 2 deletions README
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,11 @@ You can also specifiy this parameter via commandline:
Additional SSL options are available now. See "How to make LIVE listen
for ssl connections" section below on hints how to setup SSL.

To display images, you can use:
To display images or channel logos, you can use:

-e <...> --epgimages=/path/to/epgimages use EPG images created by plugins like tvm2vdr
-t <...> --tvscraperimages=/path/to/tvscraperimages use images created by tvscraper DEPRECATED!
--chanlogos=/path/to/channellogos use channel logos (PNG only, case sensitive)
Example:
--tvscraperimages=/var/cache/vdr/plugins/tvscraper DEPRECATED!
Note: tvscraperimages is not required any more, live uses the internal service interface "GetEnvironment" for plugins to get this information from tvscraper/scraper2vdr
Expand Down Expand Up @@ -182,7 +183,7 @@ qualified dns name, you should use the ip LIVE is listening on.

Note: This is just a quick'n dirty way to create a SSL self-signed
certicate. Recent browsers (like Firefox 3) will complain about it
because the certificate wasnt signed by a known Certificate Authority
because the certificate wasn´t signed by a known Certificate Authority
(CA).


Expand Down
3 changes: 3 additions & 0 deletions live/css/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,9 @@ img.actor {
img.artwork {
width: 480px
}
img.channel_logo {
max-height:32px; max-width:150px; vertical-align:middle;
}
/* ##############################
# Infowin styles for epg infos
##############################
Expand Down
12 changes: 11 additions & 1 deletion pages/whats_on.ecpp
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,16 @@ if (type == "now") {
tChannelID chanId;
tEventID eventId;
EpgEvents::DecodeDomId(epgEvent->Id(), chanId, eventId);

// Searching for channel logos
std::string chanlogoimg("");
if (!LiveSetup().GetChanLogoDir().empty() ) {
std::string chanlogopath = LiveSetup().GetChanLogoDir() + epgEvent->Caption() + ".png";
struct stat chanfilebuf;
if (stat (chanlogopath.c_str(), &chanfilebuf) == 0) {
chanlogoimg = "<img src=\"chanlogos/" + epgEvent->Caption() + ".png\" loading=\"lazy\" class=\"channel_logo\">";
}
}
</%cpp>
<tr>
<& pageelems.epg_tool_box detail=(0) epgid=(epgEvent->Id()) title=(epgEvent->Title()) startTime=(epgEvent->GetStartTime()) endTime=(epgEvent->GetEndTime()) lastCurrentChanel=(lastCurrentChanel ? 1 : 0) &>
Expand All @@ -261,7 +271,7 @@ if (type == "now") {
% }
</div>
</td>
<td class="topaligned rightcol <? lastCurrentChanel ? "bottomrow"?>"><div class="station withmargin"><a href="schedule.html?channel=<$ std::to_string(chNumber) $>" <& tooltip.hint text=(tr("View the schedule of this channel")) &>><$ std::to_string(chNumber) $><$ tr(" - ") $><$ (epgEvent->Caption()) $></a></div>
<td class="topaligned rightcol <? lastCurrentChanel ? "bottomrow"?>"><div class="station withmargin"><a href="schedule.html?channel=<$ std::to_string(chNumber) $>" <& tooltip.hint text=(tr("View the schedule of this channel")) &>><$ std::to_string(chNumber) $><$ tr(" - ") $><$$ chanlogoimg != "" ? chanlogoimg : (epgEvent->Caption()) $></a></div>
</td>
</tr>
% }
Expand Down
7 changes: 6 additions & 1 deletion setup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ bool Setup::ParseCommandLine( int argc, char* argv[] )
{ "sslport", required_argument, NULL, 's' },
{ "cert", required_argument, NULL, 'c' },
{ "key", required_argument, NULL, 'k' },
{ "chanlogos", required_argument, NULL, '1' },
{ 0 }
};

Expand All @@ -92,6 +93,9 @@ bool Setup::ParseCommandLine( int argc, char* argv[] )
case 's': m_serverSslPort = atoi( optarg ); break;
case 'c': m_serverSslCert = optarg; break;
case 'k': m_serverSslKey = optarg; break;
case '1': m_chanlogodir = optarg;
if(!m_chanlogodir.empty() && m_chanlogodir[m_chanlogodir.length()-1] != '/') m_chanlogodir += "/";
break;
default: return false;
}
}
Expand Down Expand Up @@ -133,7 +137,8 @@ char const* Setup::CommandLineHelp() const
<< " -k KEY, --key=KEY full path to a custom ssl certificate key file\n"
<< " -l level, --log=level log level for tntnet (values: WARN, ERROR, INFO, DEBUG, TRACE)\n"
<< " -e <dir>, --epgimages=<dir> directory for epgimages\n"
<< " -t <dir>, --tvscraperimages=<dir> directory for tvscraper images\n";
<< " -t <dir>, --tvscraperimages=<dir> directory for tvscraper images\n"
<< " --chanlogos=<dir> directory for channel logos (PNG)\n";
m_helpString = builder.str();
}
return m_helpString.c_str();
Expand Down
2 changes: 2 additions & 0 deletions setup.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ class Setup
cPlugin *GetPluginTvscraper() { return m_p_tvscraper; } // tvscraper
cPlugin *GetPluginScraper() { return m_p_scraper; } // tvscraper. Or, if not available, scraper2vdr
void SetTvscraperImageDir(const std::string &dir);
const std::string &GetChanLogoDir() const { return m_chanlogodir; }
bool GetShowChannelsWithoutEPG() const { return m_showChannelsWithoutEPG != 0; }
int GetMaxTooltipChars() const { return m_maxTooltipChars; }

Expand Down Expand Up @@ -142,6 +143,7 @@ class Setup
std::string m_tvscraperimagedir;
cPlugin *m_p_tvscraper;
cPlugin *m_p_scraper;
std::string m_chanlogodir;

// setup options
int m_lastChannel;
Expand Down
13 changes: 12 additions & 1 deletion tntconfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,18 @@ namespace vdrlive {
"content",
GetResourcePath(),
"/img/$1.svg",
"image/svg+xml");
"image/svg+xml");

// the following rule enables channel logo support
// inserted by 'flell' -- verified with above, but not counterchecked yet!
if (!LiveSetup().GetChanLogoDir().empty() ) {
MapUrl(app,
"^/chanlogos/(.+)\\.png",
"content",
LiveSetup().GetChanLogoDir(),
"/$1.png",
"image/png");
}

// the following rules provide a search scheme for images. The first
// rule where a image is found, terminates the search.
Expand Down

0 comments on commit 1569600

Please sign in to comment.