Skip to content

Commit

Permalink
node images
Browse files Browse the repository at this point in the history
  • Loading branch information
Markus Ehrnsperger committed Jul 16, 2022
1 parent 5b6819a commit 4492f5a
Show file tree
Hide file tree
Showing 18 changed files with 554 additions and 212 deletions.
32 changes: 27 additions & 5 deletions css/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -1011,7 +1011,7 @@ div.recording_item {
}

.recording_item div.recording_day {
width: 13em;
width: 12em;
}

.recording_item div.recording_date {
Expand All @@ -1029,6 +1029,7 @@ div.recording_item {
.recording_item div.recording_name {
font-weight: bold;
cursor: pointer;
max-width: 30em;
}

.recording_item div.recording_name span {
Expand All @@ -1040,6 +1041,7 @@ div.recording_item {
font-weight: bold;
color: orangered;
cursor: pointer;
max-width: 30em;
}

.recording_item div.recording_name_new a {
Expand All @@ -1058,10 +1060,6 @@ div.recording_item {
width: 35px;
}

.recording_item div.recording_aspect_ratio {
width: 35px;
}

.recording_item div.recording_arch {
float: right;
padding-top: 0.5ex;
Expand Down Expand Up @@ -1357,3 +1355,27 @@ div.epg_content div.about_head div div {
border-top: 1px solid #C0C1DA;
border-bottom: 1px solid #C0C1DA;
}

div.thumb {
width: 80px;
max-height: 40px;
margin-right: 0.5em;
margin-top: 5px;
margin-bottom: 5px;
text-align: center;
overflow: hidden;
float: left;
}
a.thumb {
float: left;
}

img.thumbpt {
width: 80px;
margin-top: -20px;

}
img.thumb {
width: 80px;
margin: 0 -100%;
}
52 changes: 14 additions & 38 deletions epg_events.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -396,45 +396,21 @@ namespace vdrlive
return found;
}

std::string TvscraperValidataPath(const std::string &path) {
if(path.compare(0, LiveSetup().GetTvscraperImageDir().length(), LiveSetup().GetTvscraperImageDir()) == 0)
return path.substr(LiveSetup().GetTvscraperImageDir().length());
return "";
}
std::string PosterTvscraper(const cEvent *event, const cRecording *recording)
{
if (LiveSetup().GetTvscraperImageDir().empty() ) return "";
static cPlugin *pScraper = cPluginManager::GetPlugin("scraper2vdr");
if (!pScraper ) // if it doesn't exit, try tvscraper
pScraper = cPluginManager::GetPlugin("tvscraper");

if (pScraper) {
ScraperGetPoster call;
call.event = event;
call.recording = recording;
if (pScraper->Service("GetPoster", &call)) {
if(call.poster.path.compare(0, LiveSetup().GetTvscraperImageDir().length(), LiveSetup().GetTvscraperImageDir()) == 0)
return call.poster.path.substr(LiveSetup().GetTvscraperImageDir().length());
}
}
return "";
}

bool tvscraper_avialabe() {
static cPlugin *pScraper = cPluginManager::GetPlugin("tvscraper");
if (!pScraper) return false;
return pScraper->Service("GetScraperMovieOrTv", NULL);
}
bool tvscraper(cScraperMovieOrTv &scraperMovieOrTv, const cEvent *event, const cRecording *recording)
bool PosterTvscraper(cTvMedia &media, const cEvent *event, const cRecording *recording)
{
scraperMovieOrTv.found = false;
static cPlugin *pScraper = cPluginManager::GetPlugin("tvscraper");
if (!pScraper) return false;
scraperMovieOrTv.event = event;
scraperMovieOrTv.recording = recording;
scraperMovieOrTv.httpImagePaths = false;
scraperMovieOrTv.media = true;
return pScraper->Service("GetScraperMovieOrTv", &scraperMovieOrTv);
media.path = "";
media.width = media.height = 0;
if (LiveSetup().GetTvscraperImageDir().empty() ) return false;
ScraperGetPoster call;
call.event = event;
call.recording = recording;
if (ScraperCallService("GetPoster", &call)) {
media.path = ScraperImagePath2Live(call.poster.path);
media.width = call.poster.width;
media.height = call.poster.height;
return true;
}
return false;
}

std::list<std::string> EpgImages(std::string const &epgid)
Expand Down
5 changes: 1 addition & 4 deletions epg_events.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,7 @@ namespace vdrlive
* Return a list of EpgImage paths for a given epgid.
*/

std::string TvscraperValidataPath(const std::string &path);
std::string PosterTvscraper(const cEvent *event, const cRecording *recording);
bool tvscraper_avialabe();
bool tvscraper(cScraperMovieOrTv &scraperMovieOrTv, const cEvent *event, const cRecording *recording);
bool PosterTvscraper(cTvMedia &media, const cEvent *event, const cRecording *recording);
std::list<std::string> EpgImages(std::string const &epgid);

/**
Expand Down
5 changes: 5 additions & 0 deletions live.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@ bool Plugin::ProcessArgs(int argc, char *argv[])
return LiveSetup().ParseCommandLine( argc, argv );
}

bool Plugin::Initialize(void)
{
return LiveSetup().Initialize();
}

bool Plugin::Start(void)
{
m_configDirectory = canonicalize_file_name(cPlugin::ConfigDirectory( PLUGIN_NAME_I18N ));
Expand Down
1 change: 1 addition & 0 deletions live.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ class Plugin : public cPlugin {
virtual const char *CommandLineHelp(void);
virtual bool ProcessArgs(int argc, char *argv[]);
virtual bool Start(void);
virtual bool Initialize(void);
virtual void Stop(void);
virtual void MainThreadHook(void);
virtual cString Active(void);
Expand Down
11 changes: 8 additions & 3 deletions pages/epginfo.ecpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,9 @@ using namespace vdrlive;
throw HtmlError(tr("Couldn't find recording or no recordings available"));
}
epgEvent = EpgEvents::CreateEpgInfo(epgid, recording);
epgImage = EpgEvents::PosterTvscraper(NULL, recording);
cTvMedia image;
EpgEvents::PosterTvscraper(image, NULL, recording);
epgImage = image.path;
irecording = (uintptr_t)recording;
}
// check for event:
Expand All @@ -105,7 +107,9 @@ using namespace vdrlive;
epgEvent = EpgEvents::CreateEpgInfo(epgid, schedules);
#endif
const cEvent* event = epgEvent->Event();
epgImage = EpgEvents::PosterTvscraper(event, NULL);
cTvMedia image;
EpgEvents::PosterTvscraper(image, event, NULL);
epgImage = image.path;
i_event = (uintptr_t)event;
}
// check for aboutbox:
Expand Down Expand Up @@ -178,6 +182,7 @@ using namespace vdrlive;
std::string id;
std::string title;
int detail;
std::string s_IMDB_ID;
</%args>
<& pageelems.epg_tool_box detail=(detail) epgid=(id) title=(title) startTime=(epgEvent->GetStartTime()) endTime=(epgEvent->GetEndTime()) &>
<& pageelems.epg_tool_box detail=(detail) epgid=(id) title=(title) startTime=(epgEvent->GetStartTime()) endTime=(epgEvent->GetEndTime()) s_IMDB_ID=(s_IMDB_ID) &>
</%def>
46 changes: 27 additions & 19 deletions pages/pageelems.ecpp
Original file line number Diff line number Diff line change
Expand Up @@ -189,8 +189,15 @@ function displayArtwork(boxId) {
<%def imdb_info_href>
<%args>
std::string title;
std::string s_IMDB_ID;
</%args>
<%cpp> if (LiveSetup().GetShowIMDb()) { </%cpp><a href="http://www.imdb.com/find?s=all&q=<$ StringUrlEncode(title) $>" target="_blank"><img src="<$ LiveSetup().GetThemedLink("img", "imdb.png") $>" alt="" <& tooltip.hint text=(tr("Find more at the Internet Movie Database.")) &>></img></a> <%cpp> } </%cpp>
<%cpp> if (LiveSetup().GetShowIMDb()) {
if (s_IMDB_ID.empty() ) { </%cpp>
<a href="http://www.imdb.com/find?s=all&q=<$ StringUrlEncode(title) $>"
<%cpp> } else { </%cpp>
<a href="http://www.imdb.com/title/<$ s_IMDB_ID $>"
<%cpp> } </%cpp>
target="_blank"><img src="<$ LiveSetup().GetThemedLink("img", "imdb.png") $>" alt="" <& tooltip.hint text=(tr("Find more at the Internet Movie Database.")) &>></img></a> <%cpp> } </%cpp>
</%def>

<# ---------------------------------------------------------------------- #>
Expand Down Expand Up @@ -379,6 +386,7 @@ if (LiveSetup().GetUseStreamdev() && LiveFeatures<features::streamdev_server>().
time_t startTime;
time_t endTime;
int lastCurrentChanel = int();
std::string s_IMDB_ID;
</%args>
<%cpp>
int duration = EpgEvents::Duration(startTime, endTime);
Expand All @@ -405,7 +413,7 @@ if (LiveSetup().GetUseStreamdev() && LiveFeatures<features::streamdev_server>().
}
if (eventId != 0) {
</%cpp>
<& pageelems.imdb_info_href title=(title) &>
<& pageelems.imdb_info_href title=(title) s_IMDB_ID=(s_IMDB_ID) &>
<%cpp>
}
}
Expand Down Expand Up @@ -454,12 +462,15 @@ if (LiveSetup().GetUseStreamdev() && LiveFeatures<features::streamdev_server>().

<div>
<%cpp>
const cRecording *recording = static_cast<cRecording *>((void *)irecording);
const cEvent *event = static_cast<cEvent *>((void *)ievent);
cScraperMovieOrTv scraperMovieOrTv;
EpgEvents::tvscraper(scraperMovieOrTv, event, recording);
const bool episodeFound = scraperMovieOrTv.found &&(!scraperMovieOrTv.movie) && scraperMovieOrTv.episodeFound;
if (EpgEvents::tvscraper_avialabe() ) {
scraperMovieOrTv.found = false;
scraperMovieOrTv.event = static_cast<cEvent *>((void *)ievent);
scraperMovieOrTv.recording = static_cast<cRecording *>((void *)irecording);
scraperMovieOrTv.httpImagePaths = false;
scraperMovieOrTv.media = true;
ScraperCallService("GetScraperMovieOrTv", &scraperMovieOrTv);
const bool episodeFound = scraperMovieOrTv.found && (!scraperMovieOrTv.movie) && scraperMovieOrTv.episodeFound;
if (scraperMovieOrTv.found) {
</%cpp>
<div class = "caption menu">
<a id="<$ boxId $>_epg_m" class = "active" onclick="displayEPG('<$ boxId $>')" ><$ trVDR("EPG") $></a>
Expand All @@ -479,7 +490,7 @@ if (EpgEvents::tvscraper_avialabe() ) {
</div>
<div class="epg_content">
<div class="epg_tools">
<& (tools_comp) id=(boxId) archived=(archived) detail=(1) title=(title) &>
<& (tools_comp) id=(boxId) archived=(archived) detail=(1) title=(title) s_IMDB_ID=(scraperMovieOrTv.IMDB_ID) &>
</div>
<div class="epg_info">
<div class="info nowrap"><%cpp> if (!archived.empty()) { </%cpp><span class="bold"><$ (archived + " ") $></span><%cpp> } </%cpp><$ (time) $></div>
Expand Down Expand Up @@ -511,12 +522,11 @@ if (EpgEvents::tvscraper_avialabe() ) {
<%cpp>
if (episodeFound && !scraperMovieOrTv.episode.episodeImage.path.empty() ) {
</%cpp>
<a href="/tvscraper/<$ EpgEvents::TvscraperValidataPath(scraperMovieOrTv.episode.episodeImage.path) $>" target="_blank">
<img src="/tvscraper/<$ EpgEvents::TvscraperValidataPath(scraperMovieOrTv.episode.episodeImage.path) $>" class="epg_image"/>
<a href="/tvscraper/<$ ScraperImagePath2Live(scraperMovieOrTv.episode.episodeImage.path) $>" target="_blank">
<img src="/tvscraper/<$ ScraperImagePath2Live(scraperMovieOrTv.episode.episodeImage.path) $>" class="epg_image"/>
</a>
<%cpp>
}
// const bool episodeFound = scraperMovieOrTv.found &&(!scraperMovieOrTv.movie) && scraperMovieOrTv.episodeFound;
} else {

std::list<std::string> images1 = EpgEvents::RecImages(boxId, filename);
Expand All @@ -536,7 +546,6 @@ if (EpgEvents::tvscraper_avialabe() ) {
<div id = '<$ boxId $>_scraper' hidden>
<%cpp>
if (scraperMovieOrTv.found) {
const bool episodeFound = (!scraperMovieOrTv.movie) && scraperMovieOrTv.episodeFound;
</%cpp>
<#
<div class="short">Content: <$ (scraperMovieOrTv.movie?"Movie":"TV show" ) $></div>
Expand Down Expand Up @@ -687,7 +696,6 @@ if (scraperMovieOrTv.found) {
<div id = '<$ boxId $>_actors' hidden>
<%cpp>
if (scraperMovieOrTv.found) {
const bool episodeFound = (!scraperMovieOrTv.movie) && scraperMovieOrTv.episodeFound;
</%cpp>
<table>
<%cpp>
Expand All @@ -703,8 +711,8 @@ if (scraperMovieOrTv.found) {
}
</%cpp>
<td>
<a href="/tvscraper/<$ EpgEvents::TvscraperValidataPath(actor.actorThumb.path) $>" target="_blank">
<img src="/tvscraper/<$ EpgEvents::TvscraperValidataPath(actor.actorThumb.path) $>" alt="<$actor.name$>: <$actor.role$>" width = "118px">
<a href="/tvscraper/<$ ScraperImagePath2Live(actor.actorThumb.path) $>" target="_blank">
<img src="/tvscraper/<$ ScraperImagePath2Live(actor.actorThumb.path) $>" alt="<$actor.name$>: <$actor.role$>" width = "118px">
</img>
</a>
</td>
Expand Down Expand Up @@ -733,8 +741,8 @@ if (scraperMovieOrTv.found) {
}
</%cpp>
<td>
<a href="/tvscraper/<$ EpgEvents::TvscraperValidataPath(actor.actorThumb.path) $>" target="_blank">
<img src="/tvscraper/<$ EpgEvents::TvscraperValidataPath(actor.actorThumb.path) $>" alt="<$actor.name$>: <$actor.role$>" width = "118px">
<a href="/tvscraper/<$ ScraperImagePath2Live(actor.actorThumb.path) $>" target="_blank">
<img src="/tvscraper/<$ ScraperImagePath2Live(actor.actorThumb.path) $>" alt="<$actor.name$>: <$actor.role$>" width = "118px">
</img>
</a>
</td>
Expand Down Expand Up @@ -795,8 +803,8 @@ if (scraperMovieOrTv.found) {
const std::vector<cTvMedia> *media_v = static_cast<std::vector<cTvMedia> *>((void *)media_p);
for (const cTvMedia &media: *media_v) {
</%cpp>
<a href="/tvscraper/<$ EpgEvents::TvscraperValidataPath(media.path) $>" target="_blank">
<img src="/tvscraper/<$ EpgEvents::TvscraperValidataPath(media.path) $>" width = "480px">
<a href="/tvscraper/<$ ScraperImagePath2Live(media.path) $>" target="_blank">
<img src="/tvscraper/<$ ScraperImagePath2Live(media.path) $>" width = "480px">
</img>
</a>
<%cpp>
Expand Down
6 changes: 4 additions & 2 deletions pages/recordings.ecpp
Original file line number Diff line number Diff line change
Expand Up @@ -377,10 +377,11 @@ for (recIter = recItems.begin(); recIter != recItems.end(); ++recIter) {
<%args>
std::string id;
std::string title;
std::string s_IMDB_ID;
</%args>
<& pageelems.ajax_action_href action="play_recording" param=(id) tip=(tr("play this recording.")) image="play.png" alt="" &>
<& pageelems.m3u_playlist_recording recid=(id) &>
<& pageelems.imdb_info_href title=(title) &>
<& pageelems.imdb_info_href title=(title) s_IMDB_ID=(s_IMDB_ID) &>
<& recordings.edit_rec id=(id) &>
<& recordings.del_rec id=(id) &>
</%def>
Expand All @@ -391,9 +392,10 @@ for (recIter = recItems.begin(); recIter != recItems.end(); ++recIter) {
<%args>
std::string archived;
std::string title;
std::string s_IMDB_ID;
</%args>
<img src="<$ LiveSetup().GetThemedLink("img", "on_dvd.png") $>" alt="on_dvd" <& tooltip.hint text=(archived) &> />
<& pageelems.imdb_info_href title=(title) &>
<& pageelems.imdb_info_href title=(title) s_IMDB_ID=(s_IMDB_ID)&>
</%def>

<# ---------------------------------------------------------------------- #>
Expand Down
Loading

0 comments on commit 4492f5a

Please sign in to comment.