Skip to content

Commit

Permalink
Actors link wiki
Browse files Browse the repository at this point in the history
  • Loading branch information
Markus Ehrnsperger committed Nov 19, 2023
1 parent 95b7d92 commit 96d0ffc
Show file tree
Hide file tree
Showing 31 changed files with 1,586 additions and 631 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ ifeq ($(HAVE_PCRE2),1)
endif

# -Wno-deprecated-declarations .. get rid of warning: ‘template<class> class std::auto_ptr’ is deprecated
CXXFLAGS += -std=c++14 -Wfatal-errors -Wundef -Wno-deprecated-declarations
CXXFLAGS += -std=c++17 -Wfatal-errors -Wundef -Wno-deprecated-declarations

### export all vars for sub-makes, using absolute paths
LIBDIR := $(abspath $(LIBDIR))
Expand Down
6 changes: 3 additions & 3 deletions README
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ Requirements:

VDR >= 2.4.0

gcc >= 4.8.1, must support -std=c++14
gcc >= v8, must support -std=c++17
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
Tntnet >= 2.2.1 - http://www.tntnet.org/download.hms // https://web.archive.org/web/20160314183814/http://www.tntnet.org/download.html
Cxxtools >= 2.2.1 - http://www.tntnet.org/download.hms // https://web.archive.org/web/20160314183814/http://www.tntnet.org/download.html

Tntnet provides basic webserver functions for live and needs cxxtools.
Boost provides some data structures we need. While currently relying on the
Expand Down
12 changes: 6 additions & 6 deletions StringMatch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@
#include <pcre2.h>


StringMatch::StringMatch(std::string Pattern) : re(nullptr), match_data(nullptr) {
StringMatch::StringMatch(cSv Pattern) : re(nullptr), match_data(nullptr) {
PCRE2_SIZE erroroffset;
int errorcode;

if (not Pattern.empty()) {
re = pcre2_compile(
(PCRE2_SPTR) Pattern.c_str(),
PCRE2_ZERO_TERMINATED,
(PCRE2_SPTR) Pattern.data(),
(PCRE2_SIZE) Pattern.length(),
0
| PCRE2_CASELESS // Do caseless matching
| PCRE2_DUPNAMES // Allow duplicate names for subpatterns
Expand All @@ -39,14 +39,14 @@ StringMatch::~StringMatch() {
pcre2_code_free((pcre2_code*)re);
}

bool StringMatch::Matches(std::string s) {
bool StringMatch::Matches(cSv s) {
if ((re == nullptr) or (match_data == nullptr))
return false;

int rc = pcre2_match(
(pcre2_code*)re, // the compiled pattern
(PCRE2_SPTR) s.c_str(), // the subject string
s.size(), // the length of the subject
(PCRE2_SPTR) s.data(), // the subject string
(PCRE2_SIZE) s.length(), // the length of the subject
0, // start at offset 0 in the subject
0, // default options
(pcre2_match_data*)match_data, // block for storing the result
Expand Down
6 changes: 4 additions & 2 deletions StringMatch.h
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
#pragma once
#ifdef HAVE_PCRE2
#include <string>
#include <vdr/channels.h>
#include "stringhelpers.h"

class StringMatch {
private:
void* re;
void* match_data;
public:
StringMatch(std::string Pattern);
StringMatch(cSv Pattern);
~StringMatch();
bool Matches(std::string s);
bool Matches(cSv s);
};
#endif
2 changes: 1 addition & 1 deletion epg_events.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -534,7 +534,7 @@ bool appendEpgItem(cLargeString &epg_item, RecordingsItemPtr &recItem, const cEv

epg_item.append("[\"");
// [0] : EPG ID (without event_)
epg_item.append(EpgEvents::EncodeDomId(Channel->GetChannelID(), Event->EventID()).c_str() + 6);
epg_item.appendS(EpgEvents::EncodeDomId(Channel->GetChannelID(), Event->EventID()).c_str() + 6);
epg_item.append("\",\"");
// [1] : Timer ID
const cTimer* timer = LiveTimerManager().GetTimer(Event->EventID(), Channel->GetChannelID() );
Expand Down
4 changes: 2 additions & 2 deletions epgsearch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,7 @@ void SearchTimers::TriggerUpdate()
bool SearchTimer::BlacklistSelected(int id) const
{
for(unsigned int i=0; i<m_blacklistIDs.size(); i++)
if (StringToInt(m_blacklistIDs[i]) == id) return true;
if (parse_int<int>(m_blacklistIDs[i]) == id) return true;
return false;
}

Expand Down Expand Up @@ -474,7 +474,7 @@ void ExtEPGInfo::ParseValues( std::string const& data )
bool ExtEPGInfo::Selected(unsigned int index, std::string const& values)
{
if (index >= m_values.size()) return false;
std::string extepgvalue = StringTrim(m_values[index]);
std::string extepgvalue(StringTrim(m_values[index]));

std::vector<std::string> parts;
parts = StringSplit( values, ',' );
Expand Down
13 changes: 9 additions & 4 deletions largeString.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@

#include <string.h>
#include <string>
#include <vector>
#include <stdio.h>
#include <stdlib.h>
#include "stringhelpers.h"

class cLargeString {
private:
Expand All @@ -29,8 +31,8 @@ class cLargeString {
public:
cLargeString(const cLargeString& o) = delete;
cLargeString &operator= (const cLargeString &) = delete;
// cLargeString(cLargeString&& o) = default; // default is wrong, explicit definition required
// cLargeString &operator= (cLargeString &&) = default; // default is wrong, explicit definition required
// cLargeString(cLargeString&& o) = default; // default is wrong, explicit definition required
// cLargeString &operator= (cLargeString &&) = default; // default is wrong, explicit definition required
template<std::size_t N>
cLargeString(const char (&name)[N], size_t initialSize = 0, size_t increaseSize = 0, bool debugBufferSize = false) {
m_nameData = name;
Expand Down Expand Up @@ -61,9 +63,10 @@ class cLargeString {
cLargeString &append(char c);
cLargeString &append(const char *s, size_t len);
cLargeString &append(const std::string &s) { return append(s.c_str(), s.length()); }
cLargeString &append(std::string_view s) { return append(s.data(), s.length()); }
cLargeString &append(int i);
cLargeString &appendS(const char *s);
template<typename... Args> cLargeString &appendFormated(char const* format, Args&&... args) {
template<typename... Args> cLargeString &appendFormated(const char *format, Args&&... args) {
size_t avail = m_buffer_end - m_string_end;
size_t numNeeded = snprintf(m_string_end, avail, format, std::forward<Args>(args)...);
if (numNeeded >= avail) {
Expand All @@ -79,8 +82,10 @@ class cLargeString {
void clear();
inline size_t length() const { return m_string_end - m_s; }
inline bool empty() const { return m_string_end == m_s; }
cLargeString &erase(size_t index = 0) { setMaxSize(); m_string_end = std::min(m_string_end, m_s + index); return *this;}
std::string substr(size_t pos, size_t count = std::string::npos) const; // as std::string.substr(), but replace 0 with %
// cLargeString &erase(size_t index = 0) { setMaxSize(); m_string_end = std::min(m_string_end, m_s + index); return *this;}
char operator[](size_t i) const { return *(m_s + i); }
operator cSv() const { return cSv(m_s, m_string_end - m_s); }
const char *nameData() const { return m_nameData; }
int nameLen() const { return m_nameLen; }
};
Expand Down
2 changes: 1 addition & 1 deletion live.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ class cLiveImageProviderImp: public cLiveImageProvider {
m_errorMessages = false;
return fullPath?imagePath:LiveSetup().GetTvscraperImageDir() + imagePath;
}
return LiveSetup().GetServerUrlImages() + (fullPath?ScraperImagePath2Live(imagePath):imagePath);
return concatenate(LiveSetup().GetServerUrlImages(), (fullPath?ScraperImagePath2Live(imagePath):imagePath));
}
virtual ~cLiveImageProviderImp() {}
private:
Expand Down
89 changes: 83 additions & 6 deletions live/js/live/createHtml.js
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ function clearCheckboxes(form) {
}
}
}
function execute(url) {
async function execute(url) {
/*
* Input:
* Url: url to the page triggering the execution of the function
Expand All @@ -191,17 +191,26 @@ function execute(url) {
* - bool success
* - string error (only if success == false). Human readable text
*/
const response = await fetch(encodeURI(url + '&async=1'), {
method: "GET",
headers: {
"Content-Type": "application/x-www-form-urlencoded",
},
});
const req_responseXML = new window.DOMParser().parseFromString(await response.text(), "text/xml");
/*
var req = new XMLHttpRequest();
req.open('POST', encodeURI(url + '&async=1'), false);
req.overrideMimeType("text/xml");
req.send();
*/
var ret_object = new Object();
ret_object.success = false;
if (!req.responseXML) {
if (!req_responseXML) {
ret_object.error = "invalid xml, no responseXML";
return ret_object;
}
var response_array = req.responseXML.getElementsByTagName("response");
var response_array = req_responseXML.getElementsByTagName("response");
if (response_array.length != 1) {
ret_object.error = "invalid xml, no response tag or several response tags";
return ret_object;
Expand All @@ -220,7 +229,7 @@ function execute(url) {
return ret_object;
}

var error_array = req.responseXML.getElementsByTagName("error");
var error_array = req_responseXML.getElementsByTagName("error");
if (error_array.length != 1) {
ret_object.error = "invalid xml, no error tag or several error tags";
return ret_object;
Expand All @@ -233,9 +242,9 @@ function execute(url) {
ret_object.error = error_child_nodes[0].nodeValue;
return ret_object;
}
function delete_rec_back(recid, history_num_back)
async function delete_rec_back(recid, history_num_back)
{
var ret_object = execute('delete_recording.html?param=' + recid);
var ret_object = await execute('delete_recording.html?param=' + recid);
if (!ret_object.success) alert (ret_object.error);
history.go(-history_num_back);
}
Expand All @@ -246,3 +255,71 @@ function back_depending_referrer(back_epginfo, back_others) {
history.go(-back_others);
}
}
function RecordingsSt(s, level, displayFolder, data) {
var recs_param = '';
for (obj_i of data) {
if (typeof recs[obj_i] === 'undefined') {
if (recs_param.length == 0) {
recs_param += 'r=';
} else {
recs_param += '&r=';
}
recs_param += obj_i;
}
}
if (recs_param.length == 0) {
RecordingsSt_int(s, level, displayFolder, data);
} else {
const request = new XMLHttpRequest();
request.open("POST", "get_recordings.html", false);
request.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
request.send(recs_param);
eval(request.response);
RecordingsSt_int(s, level, displayFolder, data);
}
}
async function RecordingsSt_a(s, level, displayFolder, data) {
var recs_param = '';
for (obj_i of data) {
if (typeof recs[obj_i] === 'undefined') {
recs_param += '&r=';
recs_param += obj_i;
}
}
if (recs_param.length == 0) {
RecordingsSt_int(s, level, displayFolder, data);
} else {
var recs_param_a = 'vdr_start=';
recs_param_a += vdr_start;
recs_param_a += '&recordings_tree_creation=';
recs_param_a += recordings_tree_creation;
recs_param_a += recs_param;
const response = await fetch("get_recordings.html", {
method: "POST",
headers: {
"Content-Type": "application/x-www-form-urlencoded",
},
body: recs_param_a,
});
const new_recs = await response.text();
eval(new_recs);
if (vdr_restart) {
location.reload();
} else {
RecordingsSt_int(s, level, displayFolder, data);
}
}
}
async function rec_string_d_a(rec_ids) {
const st = Object.create(null)
st.a = ""
await RecordingsSt_a(st, rec_ids[0], rec_ids[1], rec_ids[2])
return st.a
}

function rec_string_d(rec_ids) {
const st = Object.create(null)
st.a = ""
RecordingsSt_int(st, rec_ids[0], rec_ids[1], rec_ids[2])
return st.a
}
4 changes: 2 additions & 2 deletions live/js/live/infowin.js
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,8 @@ var InfoWin = new Class({
var confirm_del = this.winBody.getElementById('confirm_' + id);
if (confirm_del && id.startsWith("del_") ) {
confirm_del.onclick = null;
confirm_del.addEvent('click', function(event){
var err = execute('delete_recording.html?param=' + id.substring(4) );
confirm_del.addEvent('click', async function(event) {
var err = await execute('delete_recording.html?param=' + id.substring(4) );
if (!err.success) alert (err.error);
if (history_num_back > 0) { history.go(-history_num_back); }
else { location.reload(); }
Expand Down
12 changes: 6 additions & 6 deletions live/js/live/treeview.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,15 @@ class Treeview {
this.folder_closed = folder_closed;
}

Toggle(node, node_id) {
async Toggle(node, node_id) {
// Unfold the branch if it isn't visible
const sibling = findSibling(node, "UL");
if (sibling == null) return;

if (sibling.style.display == 'none') {
setImages(node, this.minus, this.folder_open);
if (rec_ids[node_id] != null && rec_ids[node_id].length > 0) {
sibling.insertAdjacentHTML("beforeend", rec_string_d(rec_ids[node_id]));
sibling.insertAdjacentHTML("beforeend", await rec_string_d_a(rec_ids[node_id]));
rec_ids[node_id] = [];
if (typeof liveEnhanced !== 'undefined') liveEnhanced.domReadySetup();
imgLoad();
Expand Down Expand Up @@ -102,7 +102,7 @@ openNodes = openNodes.join(",");
createCookie( cookieNameRec, openNodes, 14 );
}

function openNodesOnPageLoad()
async function openNodesOnPageLoad()
{
var openNodes = readCookie( cookieNameRec );
var domChanges = 0;
Expand All @@ -115,7 +115,7 @@ for (var z=0; z<openNodes.length; z++){
if (ul){
ul.style.display = 'block';
if (rec_ids[openNodes[z]] != null && rec_ids[openNodes[z]].length > 0) {
ul.insertAdjacentHTML("beforeend", rec_string_d(rec_ids[openNodes[z]]));
ul.insertAdjacentHTML("beforeend", await rec_string_d_a(rec_ids[openNodes[z]]));
rec_ids[openNodes[z]] = [];
domChanges = 1;
}
Expand All @@ -140,7 +140,7 @@ function filterRecordings(filter, currentSort, currentFlat)
{
window.location.href = "recordings.html?sort=" + currentSort + "&flat=" + currentFlat + "&filter=" + encodeURIComponent(filter.value);
}
function ExpandAll()
async function ExpandAll()
{
var openNodes = "";
var domChanges = 0;
Expand All @@ -150,7 +150,7 @@ function ExpandAll()
recordingNodes[idx].style.display = 'block';
openNodes += recordingNodes[idx].id + ",";
if (rec_ids[recordingNodes[idx].id] != null && rec_ids[recordingNodes[idx].id].length > 0) {
recordingNodes[idx].insertAdjacentHTML("beforeend", rec_string_d(rec_ids[recordingNodes[idx].id]));
recordingNodes[idx].insertAdjacentHTML("beforeend", await rec_string_d_a(rec_ids[recordingNodes[idx].id]));
rec_ids[recordingNodes[idx].id] = [];
domChanges = 1;
}
Expand Down
9 changes: 5 additions & 4 deletions pages/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,16 @@ DEFINES += -DDISABLE_TEMPLATES_COLLIDING_WITH_STL
INCLUDES += -I$(VDRDIR)/include -I..

### The object files (add further files here):
OBJS := menu.o recordings.o schedule.o multischedule.o screenshot.o \
OBJS := get_recordings.o delete_recording.o recordings.o pageelems.o \
epginfo.o schedule.o multischedule.o screenshot.o \
timers.o whats_on.o switch_channel.o keypress.o remote.o \
channels_widget.o edit_timer.o error.o pageelems.o tooltip.o \
channels_widget.o edit_timer.o error.o tooltip.o \
searchtimers.o edit_searchtimer.o searchresults.o \
searchepg.o login.o ibox.o xmlresponse.o play_recording.o \
pause_recording.o stop_recording.o ffw_recording.o \
rwd_recording.o setup.o content.o epginfo.o timerconflicts.o \
rwd_recording.o setup.o content.o timerconflicts.o \
recstream.o users.o edit_user.o edit_recording.o osd.o \
playlist.o stream.o stream_data.o delete_recording.o
playlist.o stream.o stream_data.o menu.o
SRCS := $(patsubst %.o,%.cpp,$(OBJS))
ESRCS := $(patsubst %.o,%.ecpp,$(OBJS))
ESRCS_DEPS := $(patsubst %.o,.%.edep,$(OBJS))
Expand Down
6 changes: 3 additions & 3 deletions pages/edit_recording.ecpp
Original file line number Diff line number Diff line change
Expand Up @@ -195,11 +195,11 @@ if (recording && recording->Info()->Aux()) {
getAutoTimerReason.recording_in = recording;
getAutoTimerReason.requestRecording = false;
if (getAutoTimerReason.call(LiveSetup().GetPluginScraper()) && getAutoTimerReason.createdByTvscraper) {
AppendHtmlEscapedAndCorrectNonUTF8(aux_data, getAutoTimerReason.reason.c_str() );
AppendHtmlEscapedAndCorrectNonUTF8(aux_data, getAutoTimerReason.reason);
} else {
std::string epgsearchinfo = GetXMLValue(recording->Info()->Aux(), "epgsearch");
cSv epgsearchinfo = partInXmlTag(recording->Info()->Aux(), "epgsearch");
if (!epgsearchinfo.empty()) {
AppendHtmlEscapedAndCorrectNonUTF8(aux_data, GetXMLValue(epgsearchinfo, "searchtimer").c_str() );
AppendHtmlEscapedAndCorrectNonUTF8(aux_data, partInXmlTag(epgsearchinfo, "searchtimer") );
}
}
if (!aux_data.empty()) {
Expand Down
Loading

0 comments on commit 96d0ffc

Please sign in to comment.