Skip to content

Commit

Permalink
dump_duplicates
Browse files Browse the repository at this point in the history
  • Loading branch information
Markus Ehrnsperger committed Nov 23, 2023
1 parent 62a875e commit 509d852
Show file tree
Hide file tree
Showing 20 changed files with 7,252 additions and 90 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ VERSIONSUFFIX = gen_version_suffix.h
PLUGINOBJS := $(PLUGIN).o thread.o tntconfig.o setup.o i18n.o timers.o \
tools.o recman.o tasks.o status.o epg_events.o epgsearch.o \
grab.o md5.o filecache.o livefeatures.o preload.o timerconflict.o \
users.o osd_status.o ffmpeg.o StringMatch.o largeString.o
users.o osd_status.o ffmpeg.o StringMatch.o largeString.o xxhash.o
PLUGINSRCS := $(patsubst %.o,%.cpp,$(PLUGINOBJS))

WEB_LIB_PAGES := libpages.a
Expand Down
4 changes: 2 additions & 2 deletions epgsearch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -617,7 +617,7 @@ void SearchResults::GetByQuery(std::string const& query)
std::string SearchResults::AddQuery(std::string const& query)
{
querySet.insert(query);
return MD5Hash(query);
return xxHash128(query);
}

std::string SearchResults::PopQuery(std::string const& md5)
Expand All @@ -628,7 +628,7 @@ std::string SearchResults::PopQuery(std::string const& md5)
std::set<std::string>::iterator it;
for (it = querySet.begin(); it != querySet.end(); it++)
{
if (md5 == MD5Hash(*it))
if (md5 == xxHash128(*it))
{
query = *it;
querySet.erase(it);
Expand Down
4 changes: 4 additions & 0 deletions live/css/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -1430,6 +1430,10 @@ img.thumb {
.display-xs { display: none; }
@media (max-width: 600px) {
/* very small display */
img.logo { width: 70px; margin-top: 25px; margin-right: 5px; }
div.__progress { width: 75px; }
div.__progress_invisible { width: 75px; }
div#infobox { min-width: 280px; }
.xs-nomargin { margin: 0px !important; }
.hidden-xs { display: none; }
.td-hidden-xs { width: 0px !important; padding: 0px !important;}
Expand Down
23 changes: 0 additions & 23 deletions pages/ibox.ecpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,9 @@ TimerConflictNotifier timerNotifier();

if (NowReplaying) {
RecordingsManagerPtr recManager = LiveRecordingsManager();
#if VDRVERSNUM >= 20301
// is is OK to lock here, because CreateEpgInfo will *not* lock other lists
LOCK_RECORDINGS_READ;
cRecording *recording = (cRecording *)Recordings->GetByName(NowReplaying);
#else
cRecording *recording = Recordings.GetByName(NowReplaying);
#endif
if (recording) {
epgEvent = EpgEvents::CreateEpgInfo(recManager->Md5Hash(recording),
recording,
Expand All @@ -59,40 +55,21 @@ TimerConflictNotifier timerNotifier();
}
else {
std::string CHANNEL_STR("channel");
#if VDRVERSNUM >= 20301
LOCK_CHANNELS_READ;
#else
ReadLock channelsLock( Channels );
#endif

if (cDevice::CurrentChannel()) {
const int SKIP_GAP = 1;
#if VDRVERSNUM >= 20301
cChannel* Channel = (cChannel *)Channels->GetByNumber(cDevice::CurrentChannel());

cChannel* tmp = (cChannel *)Channels->GetByNumber(Channels->GetPrevNormal(cDevice::CurrentChannel()), -SKIP_GAP);
#else
cChannel* Channel = Channels.GetByNumber(cDevice::CurrentChannel());

cChannel* tmp = Channels.GetByNumber(Channels.GetPrevNormal(cDevice::CurrentChannel()), -SKIP_GAP);
#endif
if (tmp && cDevice::PrimaryDevice() && cDevice::PrimaryDevice()->HasDecoder() )
prev_chan = tmp->GetChannelID();
#if VDRVERSNUM >= 20301
tmp = (cChannel *)Channels->GetByNumber(Channels->GetNextNormal(cDevice::CurrentChannel()), SKIP_GAP);
#else
tmp = Channels.GetByNumber(Channels.GetNextNormal(cDevice::CurrentChannel()), SKIP_GAP);
#endif
if (tmp && cDevice::PrimaryDevice() && cDevice::PrimaryDevice()->HasDecoder() )
next_chan = tmp->GetChannelID();

const std::string chanName(Channel->Name());
#if VDRVERSNUM >= 20301
LOCK_SCHEDULES_READ;
#else
cSchedulesLock schedulesLock;
const cSchedules* Schedules = cSchedules::Schedules(schedulesLock);
#endif
const cSchedule *Schedule = Schedules->GetSchedule(Channel);

if (Schedule) {
Expand Down
2 changes: 1 addition & 1 deletion pages/login.ecpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ if (logged_in || !LiveSetup().UseAuth()) return reply.redirect(LiveSetup().GetSt
<div style="width: 350px; margin: 0 auto; text-align: center; padding: 20px">
<div class="boxheader"><div><div><$ tr("VDR Live Login") $></div></div></div>
<div style="border: 1px solid black; padding: 15px">
<img src="<$ LiveSetup().GetThemedLink("img", "logo_login.png") $>" alt="VDR Live"></img>
<img src="<$ LiveSetup().GetThemedLink("img", "logo_login.png") $>" alt="VDR Live" />
<form name="auth">
<input type="hidden" name="action" value="login" />
<table class="login">
Expand Down
26 changes: 13 additions & 13 deletions pages/menu.ecpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,36 +33,36 @@ if (!component.empty()) {

</%cpp>
<div class="menu">
<a href="whats_on.html?type=now" <& menu.setactive current=("whats_on") &>><$ tr("What's on?") $></a>
| <a href="schedule.html" <& menu.setactive current=("schedule") &>><$ trVDR("Schedule") $></a>
| <a href="multischedule.html" <& menu.setactive current=("multischedule") &>><$ tr("MultiSchedule") $></a>
| <a href="timers.html" <& menu.setactive current=("timers") &>><$ trVDR("Timers") $></a>
<a href="whats_on.html?type=now" <& menu.setactive current=("whats_on") &>><$ tr("What's on?") $></a>
| <a href="schedule.html" <& menu.setactive current=("schedule") &>><$ trVDR("Schedule") $></a>
| <a href="multischedule.html" <& menu.setactive current=("multischedule") &>><$ tr("MultiSchedule") $></a>
| <a href="timers.html" <& menu.setactive current=("timers") &>><$ trVDR("Timers") $></a>
<%cpp>
if ( LiveFeatures<features::epgsearch>().Recent() ) {
</%cpp>
| <a href="searchepg.html" <& menu.setactive current=("searchepg") &>><$ tr("Search") $></a>
| <a href="searchtimers.html" <& menu.setactive current=("searchtimers") &>><$ tr("Searchtimers") $></a>
| <a href="searchepg.html" <& menu.setactive current=("searchepg") &>><$ tr("Search") $></a>
| <a href="searchtimers.html" <& menu.setactive current=("searchtimers") &>><$ tr("Searchtimers") $></a>
<%cpp>
}
</%cpp>
| <a href="recordings.html?flat=false&filter=<$filter$>" <& menu.setactive current=("recordings") &>><$ tr("Recordings") $></a>
| <a href="recordings.html?flat=true&filter=<$filter$>" <& menu.setactive current=("recordings_flat") &>><$ tr("Recordings (flat)") $></a>
| <a href="remote.html" <& menu.setactive current=("remote") &>><$ tr("Remote Control") $></a>
| <a href="recordings.html?flat=false&filter=<$filter$>" <& menu.setactive current=("recordings") &>><$ tr("Recordings") $></a>
| <a href="recordings.html?flat=true&filter=<$filter$>" <& menu.setactive current=("recordings_flat") &>><$ tr("Recordings (flat)") $></a>
| <a href="remote.html" <& menu.setactive current=("remote") &>><$ tr("Remote Control") $></a>
<%cpp>
if (LiveSetup().GetUseStreamdev()) {
</%cpp>
| <a href="stream.html" <& menu.setactive current=("stream") &>><$ tr("Web-Streaming") $></a>
| <a href="stream.html" <& menu.setactive current=("stream") &>><$ tr("Web-Streaming") $></a>
<%cpp>
}
</%cpp>
| <a href="setup.html" <& menu.setactive current=("setup") &>><$ trVDR("Setup") $></a>
| <a href="setup.html" <& menu.setactive current=("setup") &>><$ trVDR("Setup") $></a>
<# --- Used by D.H. to test infobox (not part of the released version)
| <a href="ibox_status.html" <& menu.setactive current=("status") &>><$ tr("Status Test") $></a>
| <a href="ibox_status.html" <& menu.setactive current=("status") &>><$ tr("Status Test") $></a>
--- #>
<%cpp>
if (LiveSetup().UseAuth()) {
</%cpp>
| <a id="login" href="login.html?action=logout"><$ tr("Logout") $></a>
| <a id="login" href="login.html?action=logout"><$ tr("Logout") $></a>
<%cpp>
}
</%cpp>
Expand Down
2 changes: 1 addition & 1 deletion pages/multischedule.ecpp
Original file line number Diff line number Diff line change
Expand Up @@ -560,7 +560,7 @@ std::vector<time_t> times_start;
<%cpp>
if (LiveFeatures<features::epgsearch>().Recent() ) {
</%cpp>
<a href="searchresults.html?searchplain=<$ StringUrlEncode(en.title) $>"><img src="<$ LiveSetup().GetThemedLink("img", "search.png") $>" alt="" <& tooltip.hint text=(tr("Search for repeats.")) &>></img></a>
<a href="searchresults.html?searchplain=<$ StringUrlEncode(en.title) $>"><img src="<$ LiveSetup().GetThemedLink("img", "search.png") $>" alt="" <& tooltip.hint text=(tr("Search for repeats.")) &> /></a>
<%cpp>
} else {
</%cpp><img src="img/transparent.png" width="16" height="16"><%cpp>
Expand Down
26 changes: 12 additions & 14 deletions pages/pageelems.ecpp
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ function existingRecordingString(col_span, bottomrow, id, archiveDescr, imdb_id,
if (LiveSetup().GetShowLogo()) {
</%cpp>
<a href="<$ LiveSetup().GetStartScreenLink()$>">
<img src="<$ LiveSetup().GetThemedLink("img", "logo.png") $>" alt="VDR Live!" class="logo"></img></a>
<img src="<$ LiveSetup().GetThemedLink("img", "logo.png") $>" alt="VDR Live!" class="logo" /></a>
<%cpp>
}
</%cpp>
Expand Down Expand Up @@ -319,7 +319,7 @@ function existingRecordingString(col_span, bottomrow, id, archiveDescr, imdb_id,
if ((duration >= 0) && ((progress < 0) || (duration == 0)))
cls +="_invisible";
</%cpp>
<div class="<$ cls $>"><div class="__elapsed" <%cpp> if (!id.empty()) { </%cpp>id="<$ id $>"<%cpp> } </%cpp>style="width: <$ progress $>px"></div></div>
<div class="<$ cls $>"><div class="__elapsed" <%cpp> if (!id.empty()) { </%cpp>id="<$ id $>" <%cpp> } </%cpp>style="width: <$ progress $>%"></div></div>
</%def>

<# ---------------------------------------------------------------------- #>
Expand All @@ -333,7 +333,7 @@ function existingRecordingString(col_span, bottomrow, id, archiveDescr, imdb_id,
std::string alt;
std::string id;
</%args>
<%cpp> { </%cpp><a <%cpp> if (!id.empty()) { </%cpp>id="<$ id $>" <%cpp> } </%cpp><& hide_element hide=(id.empty()? 0 : 1) &> href="vdr_request/<$ action $>?param=<$ param $>" <%cpp>if (!tip.empty()) { </%cpp><& tooltip.hint text=(tip) &> <%cpp> } </%cpp>><img src="<$ LiveSetup().GetThemedLink("img", image) $>" alt="<$ alt $>"></img></a> <%cpp> } </%cpp>
<%cpp> { </%cpp><a <%cpp> if (!id.empty()) { </%cpp>id="<$ id $>" <%cpp> } </%cpp><& hide_element hide=(id.empty()? 0 : 1) &> href="vdr_request/<$ action $>?param=<$ param $>" <%cpp>if (!tip.empty()) { </%cpp><& tooltip.hint text=(tip) &> <%cpp> } </%cpp>><img src="<$ LiveSetup().GetThemedLink("img", image) $>" alt="<$ alt $>" /></a> <%cpp> } </%cpp>
</%def>

<# ---------------------------------------------------------------------- #>
Expand All @@ -351,7 +351,7 @@ if (s_IMDB_ID.empty() ) { </%cpp>
<%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>
target="_blank"><img src="<$ LiveSetup().GetThemedLink("img", "imdb.png") $>" alt="" <& tooltip.hint text=(tr("Find more at the Internet Movie Database.")) &> /></a> <%cpp> } </%cpp>
</%def>

<# ---------------------------------------------------------------------- #>
Expand All @@ -363,7 +363,7 @@ if (s_IMDB_ID.empty() ) { </%cpp>
<%cpp>
if (LiveSetup().GetUseStreamdev() && LiveFeatures<features::streamdev_server>().Loaded()) {
</%cpp>
<a href="stream.html?channelid_str=<$ channelId $>"><img src="<$ LiveSetup().GetThemedLink("img", "stream_button.png") $>" alt="" <& tooltip.hint text=(tr("Stream this channel into browser.")) &>></img></a>
<a href="stream.html?channelid_str=<$ channelId $>"><img src="<$ LiveSetup().GetThemedLink("img", "stream_button.png") $>" alt="" <& tooltip.hint text=(tr("Stream this channel into browser.")) &> /></a>
<%cpp>
}
</%cpp>
Expand All @@ -379,11 +379,11 @@ if (LiveSetup().GetUseStreamdev() && LiveFeatures<features::streamdev_server>().
if (LiveSetup().GetUseStreamdev() && LiveFeatures<features::streamdev_server>().Loaded()) {
#if TNTVERSION >= 30000
</%cpp>
<a href="playlist.m3u?channel_str=<$ channelId $>"><img src="<$ LiveSetup().GetThemedLink("img", "playlist.png") $>" alt="" <& tooltip.hint text=(tr("Stream this channel into media player.")) &>></img></a>
<a href="playlist.m3u?channel_str=<$ channelId $>"><img src="<$ LiveSetup().GetThemedLink("img", "playlist.png") $>" alt="" <& tooltip.hint text=(tr("Stream this channel into media player.")) &> /></a>
<%cpp>
#else
</%cpp>
<a href="playlist.m3u?channel=<$ channelId $>"><img src="<$ LiveSetup().GetThemedLink("img", "playlist.png") $>" alt="" <& tooltip.hint text=(tr("Stream this channel into media player.")) &>></img></a>
<a href="playlist.m3u?channel=<$ channelId $>"><img src="<$ LiveSetup().GetThemedLink("img", "playlist.png") $>" alt="" <& tooltip.hint text=(tr("Stream this channel into media player.")) &> /></a>
<%cpp>
#endif
}
Expand All @@ -400,7 +400,7 @@ if (LiveSetup().GetUseStreamdev() && LiveFeatures<features::streamdev_server>().
<%cpp>
#if TNT_WATCHDOG_SILENCE
{
</%cpp><a href="playlist.m3u?recid=<$ recid $>"><img src="<$ LiveSetup().GetThemedLink("img", "playlist.png") $>" alt="" <& tooltip.hint text=(tr("Stream this recording into media player.")) &>></img> <$ linkText $></a>
</%cpp><a href="playlist.m3u?recid=<$ recid $>"><img src="<$ LiveSetup().GetThemedLink("img", "playlist.png") $>" alt="" <& tooltip.hint text=(tr("Stream this recording into media player.")) &> /> <$ linkText $></a>
<%cpp>
}
#endif
Expand Down Expand Up @@ -557,7 +557,7 @@ if (LiveSetup().GetUseStreamdev() && LiveFeatures<features::streamdev_server>().
<%cpp>
} if (LiveFeatures<features::epgsearch>().Recent() && eventId != 0) {
</%cpp>
<a href="searchresults.html?searchplain=<$ StringEscapeAndBreak(title) $>"><img src="<$ LiveSetup().GetThemedLink("img", "search.png") $>" alt="" <& tooltip.hint text=(tr("Search for repeats.")) &>></img></a>
<a href="searchresults.html?searchplain=<$ StringEscapeAndBreak(title) $>"><img src="<$ LiveSetup().GetThemedLink("img", "search.png") $>" alt="" <& tooltip.hint text=(tr("Search for repeats.")) &> /></a>
<%cpp>
}
if ((duration == 0) || (elapsed >= 0)) {
Expand Down Expand Up @@ -608,7 +608,7 @@ if (LiveSetup().GetUseStreamdev() && LiveFeatures<features::streamdev_server>().
<%cpp> } if (LiveFeatures<features::epgsearch>().Recent()) { </%cpp>
<td class="action <? lastCurrentChanel ? "bottomrow"?>">
<%cpp> if (eventId) { </%cpp>
<a href="searchresults.html?searchplain=<$ StringUrlEncode(title) $>"><img src="<$ LiveSetup().GetThemedLink("img", "search.png") $>" alt="" <& tooltip.hint text=(tr("Search for repeats.")) &>></img></a></td>
<a href="searchresults.html?searchplain=<$ StringUrlEncode(title) $>"><img src="<$ LiveSetup().GetThemedLink("img", "search.png") $>" alt="" <& tooltip.hint text=(tr("Search for repeats.")) &> /></a></td>
<%cpp> } } </%cpp>
<td class="action <? lastCurrentChanel ? "bottomrow"?>"><%cpp>if ((duration == 0) || (elapsed > 0)) { </%cpp><& pageelems.hls_channel channelId=(channelId) &><%cpp> } </%cpp></td>
<%cpp> if (LiveSetup().GetShowPlayMediaplayer() ) { </%cpp>
Expand Down Expand Up @@ -1032,8 +1032,7 @@ if (scraperMovieOrTv.found) {
% }
<td>
<a href="/tvscraper/<$ character->getImage().path $>" target="_blank">
<img src="/tvscraper/<$ character->getImage().path $>" alt="<$character->getPersonName()$>: <$character->getCharacterName()$>" class="actor">
</img>
<img src="/tvscraper/<$ character->getImage().path $>" alt="<$character->getPersonName()$>: <$character->getCharacterName()$>" class="actor" />
</a>
</td>
<%cpp>
Expand Down Expand Up @@ -1096,8 +1095,7 @@ const std::vector<cTvMedia> *media_v = static_cast<std::vector<cTvMedia> *>((voi
for (const cTvMedia &media: *media_v) {
</%cpp>
<a href="/tvscraper/<$ media.path $>" target="_blank">
<img src="/tvscraper/<$ media.path $>" class="artwork">
</img>
<img src="/tvscraper/<$ media.path $>" class="artwork" />
</a>
<%cpp>
}
Expand Down
24 changes: 22 additions & 2 deletions pages/recordings.ecpp
Original file line number Diff line number Diff line change
Expand Up @@ -460,13 +460,14 @@ if (currentFlat != "true") {
// do we have to get/write the recording details?
// we have to, if currentFlat == true || level == 0 || this folder is open (cookie)
bool write_recs = level == 0 || currentFlat == "true";
if (!write_recs) {
if (!write_recs && recItemsC) {
// check: is this folder open (cookie)?
auto equal_fldf = [parentIdHash](cSv f) { return f.compare(5, std::string_view::npos, parentIdHash) == 0; };
cSplit splitOpenTreeNodes(openTreeNodes, ',');
write_recs = std::find_if(splitOpenTreeNodes.begin(), splitOpenTreeNodes.end(), equal_fldf) != splitOpenTreeNodes.end();
}
if (write_recs) {
if (write_recs && recItemsC) {
// in case of duplicates, and not flat, the recItemsC is not available
char buffer_i[21];
buffer_i[20] = 0;
</%cpp>
Expand Down Expand Up @@ -519,6 +520,25 @@ if (currentSort != "duplicates" || currentFlat == "true") {
}
if (!recItems.empty() ) {
std::string idHash(xxHash32(nodeName));
// do we have to get/write the recording details?
// check: is this folder open (cookie)?
auto equal_fldf = [idHash](cSv f) { return f.compare(5, std::string_view::npos, idHash) == 0; };
cSplit splitOpenTreeNodes(openTreeNodes, ',');
if (std::find_if(splitOpenTreeNodes.begin(), splitOpenTreeNodes.end(), equal_fldf) != splitOpenTreeNodes.end()) {
char buffer_i[21];
buffer_i[20] = 0;
</%cpp>
<script>
<%cpp>
for (const RecordingsItemPtr &rPtr: recItems) {
recoring_item->clear();
rPtr->AppendAsJSArray(*recoring_item, true);
</%cpp>
recs[<$concat::addCharsIbe(buffer_i+20, rPtr->IdI())$>]=[<$$ recoring_item->c_str() $>]
% }
</script>
<%cpp>
}
bool first = true;
recoring_item->clear();
RecordingsItemRec::AppendAsJSArray(*recoring_item, recItems.begin(), recItems.end(), first, currentFilter, false);
Expand Down
Loading

0 comments on commit 509d852

Please sign in to comment.