Skip to content

Commit

Permalink
languages
Browse files Browse the repository at this point in the history
  • Loading branch information
Markus Ehrnsperger committed Oct 9, 2022
1 parent e189038 commit 517ff78
Show file tree
Hide file tree
Showing 17 changed files with 11,132 additions and 369 deletions.
2 changes: 1 addition & 1 deletion README
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ Requirements:

VDR >= 2.0.0

gcc >= 4.8.1
gcc >= 4.8.1, must support -std=c++14
PCRE2 >= 10.38 - https://github.com/PhilipHazel/pcre2/releases
Tntnet >= 1.5.3 - http://www.tntnet.org/download.hms
Cxxtools >= 1.4.3 - http://www.tntnet.org/download.hms
Expand Down
1,515 changes: 1,515 additions & 0 deletions live/img/1280x720.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1,515 changes: 1,515 additions & 0 deletions live/img/1920x1080.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1,515 changes: 1,515 additions & 0 deletions live/img/3840x2160.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1,515 changes: 1,515 additions & 0 deletions live/img/4K.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1,578 changes: 1,578 additions & 0 deletions live/img/720x576.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1,515 changes: 1,515 additions & 0 deletions live/img/7680x4320.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1,584 changes: 1,584 additions & 0 deletions live/img/8K.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added live/img/ud.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
38 changes: 27 additions & 11 deletions osd_status.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,24 +120,38 @@ std::string const OsdStatusMonitor::GetButtonsHtml() {
}

std::string const OsdStatusMonitor::GetItemsHtml(void){
std::string buffer= "";
for (cLiveOsdItem *item = items.First(); item; item = items.Next(item)) {
buffer += "<div class=\"osdItem";
if (item->isSelected())
buffer += " selected";
buffer += "\">";
buffer += EncodeHtml(item->Text());
buffer += "</div>";
}
return !buffer.empty() ? "<div class=\"osdItems\">" + buffer + "</div>" : "";
std::string buffer= "";
for (cLiveOsdItem *item = items.First(); item; item = items.Next(item)) {
buffer += "<div class=\"osdItem";
if (item->isSelected()) buffer += " selected";
buffer += "\">";
/*
if (tabs[0] > 0) {
buffer += EncodeHtml(item->Text(), true);
const char *tab = strchr(item->Text().c_str(), '\t');
if (tab && *(tab + 1) ) {
int charsT1 = tab - item->Text().c_str();
buffer.append(std::max(1, (int)tabs[0] - charsT1), ' ');
buffer += EncodeHtml(tab + 1);
}
} else {
*/
buffer += EncodeHtml(item->Text());
// }
buffer += "</div>";
}
if (buffer.empty() ) return "";
// if (tabs[0] > 0) return std::string("<div class=\"osdItems\"><table>") + buffer + "</table></div>";
return std::string("<div class=\"osdItems\">") + buffer + "</div>";
}

std::string const OsdStatusMonitor::GetHtml(){
std::stringstream ss;
ss << lastUpdate;
return "<div class=\"osd\" data-time=\"" + ss.str() + "\">" + GetTitleHtml() + GetItemsHtml() + GetTextHtml() + GetMessageHtml() + GetButtonsHtml() + "</div>";
}

std::string const OsdStatusMonitor::EncodeHtml(const std::string& html) {
std::string const OsdStatusMonitor::EncodeHtml(const std::string& html, bool stopAtTab) {
std::stringstream ss;
std::string::const_iterator i;
for (i = html.begin(); i != html.end(); ++i) {
Expand All @@ -149,6 +163,8 @@ std::string const OsdStatusMonitor::EncodeHtml(const std::string& html) {
ss << "&amp;";
else if (*i == '"')
ss << "&quot;";
else if (*i == '\t' && stopAtTab)
break;
else
ss << static_cast<char>(*i); // Copy untranslated
}
Expand Down
2 changes: 1 addition & 1 deletion osd_status.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ class OsdStatusMonitor: public cStatus

virtual ~OsdStatusMonitor();

std::string const EncodeHtml(const std::string& html);
std::string const EncodeHtml(const std::string& html, bool stopAtTab = false);
};

OsdStatusMonitor& LiveOsdStatusMonitor();
Expand Down
7 changes: 5 additions & 2 deletions pages/pageelems.ecpp
Original file line number Diff line number Diff line change
Expand Up @@ -858,7 +858,7 @@ for (const cTvMedia &media: *media_v) {
<%cpp>
}
</%cpp>
(<a href="http://winni.vdr-developer.org/epgsearch/index.html" target="_blank"><$ tr("Homepage") $></a>)<br/>
(<a href="https://github.com/vdr-projects/vdr-plugin-epgsearch" target="_blank"><$ tr("Homepage") $></a>)<br/>
</div>
<div class="about_left">Streamdev server:</div>
<div class="about_right">
Expand All @@ -877,8 +877,11 @@ for (const cTvMedia &media: *media_v) {
<%cpp>
}
</%cpp>
(<a href="https://projects.vdr-developer.org/projects/plg-streamdev" target="_blank"><$ tr("Homepage") $></a>)<br/>
(<a href="https://github.com/vdr-projects/vdr-plugin-streamdev" target="_blank"><$ tr("Homepage") $></a>)<br/>
</div>
<div class="about_head"><div><div><$ tr("Information providers") $></div></div></div>
<div class="about_line">Movie information provided by <a target="_blank" href="https://www.themoviedb.org/">TMDB</a></div>
<div class="about_line">Information provided by TheTVDB.com. Please consider <a target="_blank" href="https://u10505776.ct.sendgrid.net/ls/click?upn=xMYYCP13hVd-2BZPpbVcMPHeLXfv-2BPRdIsKm2qSeirIHi7kH9am8IxD-2BavFbeqGqIXIcjH_INgc0CXRkIvGU-2BJ1W6HLAynNbR0UBoMb2tkpDdezO3QRj-2FQPQAMrtJKVcB0N7eSvbYpjQTDNOQBf2pb94uDgGr0-2BXyXFk7Oyfva30BASYCRLvtRQyi5eOCAbH8fon7UETlPydobeLA3Recu9OsXol8c7Ng4pDAsH6KsFF8CH7HQoVxivnpKrQW2v4ek7U-2BYlWmH31o9Koke3vq-2FDsQ0P-2BiKLECU3LgttsntUcN8fnUs-3D">supporting them</a></div>
<div class="about_head"><div><div><$ tr("Bugs and suggestions") $></div></div></div>
<div class="about_line"><$ tr("If you encounter any bugs or would like to suggest new features, please use our bugtracker") $>:<br/>
<a target="_blank" href="https://github.com/MarkusEh/vdr-plugin-live/issues">https://github.com/MarkusEh/vdr-plugin-live/issues</a></div>
Expand Down
233 changes: 130 additions & 103 deletions pages/recordings.ecpp
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ function IMDB(im_db, name) {
'\" target=\"_blank\"><img src=\"<$LiveSetup().GetThemedLinkPrefixImg()$>imdb.png\" title=\"<$tr("Find more at the Internet Movie Database.")$>\"/></a>')
}
}
// [0] : Level
// [0] : IMDB ID
// [1] : ID (prefix "recording_" removed !!!)
// [2] : ArchiveDescr()
// [3] : image.path (nach "/tvscraper/")
Expand All @@ -154,13 +154,12 @@ function IMDB(im_db, name) {
// [9] : recording_spec: Day, time & duration
// [10] : Number of recording errors


function Recordings(data) {
function Recordings(level, argList, displayFolder, data) {
for (obj of data) {
document.write(
'<li class="recording"><div class="recording_item"><div class="recording_imgs">')
if (obj[0] > 0) document.write(
'<img src="img/transparent.png" width="' + String(16 * obj[0]) + 'px" height="16px" />')
if (level > 0) document.write(
'<img src="img/transparent.png" width="' + String(16 * level) + 'px" height="16px" />')
if (obj[2] != "") {
document.write('<img src=\"<$LiveSetup().GetThemedLinkPrefixImg()$>on_dvd.png\" alt=\"on_dvd\" title=\"')
document.write(obj[2])
Expand Down Expand Up @@ -230,20 +229,24 @@ function Recordings(data) {
document.write(obj[1])
document.write('\">')
document.write(obj[15])
document.write(obj[16])
if (displayFolder == 1 && obj[16] != "") {
document.write(' (')
document.write(obj[16])
document.write(')')
}
document.write('<br /><span>')
document.write(obj[14])
if (obj[14] == "") document.write('&nbsp;')
document.write('</span></a></div></div><div class=\"recording_actions\">')
if (obj[2] == "") {
RecordingAction(obj[1], "vdr_request/play_recording?param=", "play.png", "<$tr("play this recording")$>", obj[17])
RecordingAction(obj[1], "playlist.m3u?recid=", "playlist.png", "<$tr("Stream this recording into media player.")$>", obj[17])
IMDB(obj[18], obj[15])
RecordingAction(obj[1], "edit_recording.html?recid=", "edit.png", "<$tr("Edit recording")$>", obj[17])
RecordingAction(obj[1], "recordings.html?todel=", "del.png", "<$tr("Delete this recording from hard disc!")$>", obj[17])
RecordingAction(obj[1], "vdr_request/play_recording?param=", "play.png", "<$tr("play this recording")$>", argList)
RecordingAction(obj[1], "playlist.m3u?recid=", "playlist.png", "<$tr("Stream this recording into media player.")$>", argList)
IMDB(obj[0], obj[15])
RecordingAction(obj[1], "edit_recording.html?recid=", "edit.png", "<$tr("Edit recording")$>", argList)
RecordingAction(obj[1], "recordings.html?todel=", "del.png", "<$tr("Delete this recording from hard disc!")$>", argList)
} else {
document.write('<img src=\"img/transparent.png\" width=\"16px\" height=\"16px\" />')
IMDB(obj[18], obj[15])
IMDB(obj[0], obj[15])
}
document.write('</div>')
if (obj[2] != "") {
Expand Down Expand Up @@ -363,6 +366,7 @@ if (!deleteResult.empty()) {
uintptr_t iRecItem = 0;
</%args>
<%cpp>
// "
recoring_item.reserve(6000);
// Max Buffer used: 5.636 bytes
RecordingsTreePtr recordingsTree(LiveRecordingsManager()->GetRecordingsTree());
Expand All @@ -377,112 +381,135 @@ std::list<RecordingsItemPtr>::iterator recIter;
bool sorted = false;
int level = 0;
if( currentFlat != "true" ) {
sorted = recItemThisDir->addSubdirs(recItems);
if (!sorted) {
if (currentSort == "namedesc")
recItems.sort(RecordingsItemPtrCompare::ByDescendingNameDescSort);
else if (currentSort == "nameasc")
recItems.sort(RecordingsItemPtrCompare::ByAscendingNameDescSort);
}
for (recIter = recItems.begin(); recIter != recItems.end(); ++recIter) {
RecordingsItemPtr recItem = *recIter;
counter++;

/* search trough directory for new recordings */
bool newR = false;
if ( LiveSetup().GetMarkNewRec() ) newR = recItem->checkNew();
level = recItem->Level();
// create list of subdirs, in "recItems"
sorted = recItemThisDir->addSubdirs(recItems);
if (!sorted) {
if (currentSort == "namedesc")
recItems.sort(RecordingsItemPtrCompare::ByDescendingNameDescSort);
else if (currentSort == "nameasc")
recItems.sort(RecordingsItemPtrCompare::ByAscendingNameDescSort);
}
for (recIter = recItems.begin(); recIter != recItems.end(); ++recIter) {
// this is the loop over the subdirs
RecordingsItemPtr recItem = *recIter;
counter++;

/* search trough directory for new recordings */
bool newR = false;
if ( LiveSetup().GetMarkNewRec() ) newR = recItem->checkNew();
level = recItem->Level();
</%cpp>
<li class="recording">
<div class="recording_item" onclick="Toggle(this)">
<li class="recording">
<div class="recording_item" onclick="Toggle(this)">
<div class="recording_imgs">
<{ if(level > 1) { }><img src="img/transparent.png" width="<$16*(level-1) $>px" height="16px" /> <{ } }>
<img class="recording_expander" src="<$ LiveSetup().GetThemedLinkPrefixImg()$>plus.png" /><img class="recording_folder" src="<$ LiveSetup().GetThemedLinkPrefixImg()$>folder_closed.png" /></div>
<{ if (!recItem->scraperImage().path.empty() ) { }>
<div class="thumb">
<img src="/tvscraper/<$ recItem->scraperImage().path $>"
<$$ recItem->scraperImage().width > recItem->scraperImage().height?"class=\"thumb\"":"class=\"thumbpt\"" $>
/>
</div>
<{ } }>
<{ if(level > 1) { }><img src="img/transparent.png" width="<$16*(level-1) $>px" height="16px" /> <{ } }>
<img class="recording_expander" src="<$ LiveSetup().GetThemedLinkPrefixImg()$>plus.png" /><img class="recording_folder" src="<$ LiveSetup().GetThemedLinkPrefixImg()$>folder_closed.png" /></div>
<{ if (!recItem->scraperImage().path.empty() ) { }>
<div class="thumb">
<img src="/tvscraper/<$ recItem->scraperImage().path $>"
<$$ recItem->scraperImage().width > recItem->scraperImage().height?"class=\"thumb\"":"class=\"thumbpt\"" $>
/>
</div>
<{ } }>
<div class="recording_spec">
<div class="recording_name<$ (newR ? "_new" : "") $>"><$ recItem->Name() $></div>
</div>
<div class="recording_actions">&nbsp;</div>
</div>
</div>

<%cpp>
std::string combinedId = recItem->Name() + "_";
combinedId += counter + "_" + recItem->Level();
std::string idHash(MD5Hash(combinedId));
iRecItem = (uintptr_t)&recItem;
</%cpp>
<ul id="fldr_<$ idHash $>" class="recordingslist" style="display: none;">
<& recordings.recordings_item filter=(filter) counter=(counter) iRecItem=(iRecItem) &>
</ul>
</li>
<%cpp>
}
recItems.clear();
sorted = recItemThisDir->addRecordings(recItems);
level = recItemThisDir->Level() + 1;
<%cpp>
std::string combinedId = recItem->Name() + "_";
combinedId += counter + "_" + recItem->Level();
std::string idHash(MD5Hash(combinedId));
iRecItem = (uintptr_t)&recItem;
</%cpp>
<ul id="fldr_<$ idHash $>" class="recordingslist" style="display: none;">
<& recordings.recordings_item filter=(filter) counter=(counter) iRecItem=(iRecItem) &>
</ul>
</li>
<%cpp>
} // end of loop over subdirs
// now the items
recItems.clear();
sorted = recItemThisDir->addRecordings(recItems);
level = recItemThisDir->Level() + 1;
} else {
if (currentSort == "duplicates") {
addAllDuplicateRecordings(recItems, recordingsTree);
} else {
recordingsTree->addAllRecordings(recItems);
}
// here we prepare the items in case of a flat list, no folders
if (currentSort != "duplicates") recordingsTree->addAllRecordings(recItems);
}
if (!sorted) {
if (currentSort == "dateasc")
recItems.sort(RecordingsItemPtrCompare::ByAscendingDate);
else if (currentSort == "datedesc")
recItems.sort(RecordingsItemPtrCompare::ByDescendingDate);
else if (currentSort == "namedesc")
recItems.sort(RecordingsItemPtrCompare::ByDescendingNameDescSort);
else if (currentSort == "nameasc")
recItems.sort(RecordingsItemPtrCompare::ByAscendingNameDescSort);
else if (currentSort == "errorsasc" || currentSort == "errorsdesc")
recItems.sort(RecordingsItemPtrCompare::ByDescendingRecordingErrors);
}

argList.clear();
argList.append("&sort=");
argList.append(currentSort);
argList.append("&filter=");
argList.append(currentFilter);
bool first = true;
</%cpp>
<script>Recordings([
<%cpp>
for (recIter = recItems.begin(); recIter != recItems.end(); ++recIter) {
RecordingsItemPtr recItem = *recIter;
recoring_item.clear();
// recItem->AppendasHtml(recoring_item, currentFlat == "true", argList, level);
recItem->AppendasJSArray(recoring_item, currentFlat == "true", argList, level);
max_length_recoring_item = std::max(max_length_recoring_item, recoring_item.length() );
#ifdef HAVE_PCRE2
StringMatch sm(filter);
if (filter.empty() or
sm.Matches(recItem->Name()) or
sm.Matches(recItem->ShortText()?recItem->ShortText() : "" ) or
sm.Matches(recItem->Description()?recItem->Description() : ""))
#endif
{
if (!first) {
</%cpp>
,
<%cpp>
} else first = false;
</%cpp>
<$$ recoring_item $>
<# Buffer used: <$ recoring_item.length() $> bytes
Max Buffer used: <$ max_length_recoring_item $> bytes #>
<%cpp>
}
if (currentSort != "duplicates") {
if (!sorted) {
if (currentSort == "dateasc")
recItems.sort(RecordingsItemPtrCompare::ByAscendingDate);
else if (currentSort == "datedesc")
recItems.sort(RecordingsItemPtrCompare::ByDescendingDate);
else if (currentSort == "namedesc")
recItems.sort(RecordingsItemPtrCompare::ByDescendingNameDescSort);
else if (currentSort == "nameasc")
recItems.sort(RecordingsItemPtrCompare::ByAscendingNameDescSort);
else if (currentSort == "errorsasc" || currentSort == "errorsdesc")
recItems.sort(RecordingsItemPtrCompare::ByDescendingRecordingErrors);
}

bool first = true;
bool displayFolder = currentFlat == "true";
</%cpp>
<script>Recordings(<$level$>, "<$argList$>", <$displayFolder?1:0$>, [
<%cpp>
recoring_item.clear();
RecordingsItemRec::AppendAsJSArray(recoring_item, recItems.begin(), recItems.end(), first, filter, displayFolder);
// max_length_recoring_item = std::max(max_length_recoring_item, recoring_item.length() );
</%cpp>
<$$ recoring_item $>
])</script>
<%cpp> } else {
// duplicates
for (int i = 0; i < 3; i++) {
recItems.clear();
bool first = true;
std::string nodeName;
if (i == 0) {
addDuplicateRecordingsSd(recItems, recordingsTree);
nodeName = tr("Duplicates identified by tvscraper");
} else if (i == 1) {
addDuplicateRecordingsLang(recItems, recordingsTree);
nodeName = tr("Duplicates, with different languages");
} else if (i == 2) {
addDuplicateRecordingsNoSd(recItems, recordingsTree);
nodeName = tr("Duplicates not identified by tvscraper");
}
std::string idHash(MD5Hash(nodeName + "_1"));
if (!recItems.empty() ) {
</%cpp>
<li class="recording">
<div class="recording_item" onclick="Toggle(this)">
<div class="recording_imgs">
<img class="recording_expander" src="<$ LiveSetup().GetThemedLinkPrefixImg()$>plus.png" /><img class="recording_folder" src="<$ LiveSetup().GetThemedLinkPrefixImg()$>folder_closed.png" /></div>
<div class="recording_spec">
<div class="recording_name"><$ nodeName $></div>
</div>
<div class="recording_actions">&nbsp;</div>
</div>
<ul id="fldr_<$ idHash $>" class="recordingslist" style="display: none;">
<script>Recordings(1, "<$argList$>", 1, [
<%cpp>
recoring_item.clear();
RecordingsItemRec::AppendAsJSArray(recoring_item, recItems.begin(), recItems.end(), first, filter, true);
</%cpp>
<$$ recoring_item $>
])</script>
</ul>
</li>
<%cpp>
}
}
}
</%cpp>
])</script>
</%cpp>
</%def>

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

0 comments on commit 517ff78

Please sign in to comment.