Skip to content

Commit

Permalink
concat
Browse files Browse the repository at this point in the history
  • Loading branch information
Markus Ehrnsperger committed Nov 28, 2023
1 parent d99bebd commit 6b9dda8
Show file tree
Hide file tree
Showing 4 changed files with 191 additions and 68 deletions.
4 changes: 1 addition & 3 deletions pages/get_recordings.ecpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,13 @@ recordings_tree_re_created = <$ recordings_tree_re_created?"true":"false"$>;
*/

cLargeString recoring_item("recoring_item_get_recordings.ecpp", 5000);
char buffer_i[21];
buffer_i[20] = 0;
for (int recording: r) {
bool found = false;
for (const RecordingsItemPtr &rPtr: *recordingsTree->allRecordings()) if (recording == rPtr->IdI() ) {
recoring_item.clear();
rPtr->AppendAsJSArray(recoring_item, true);
</%cpp>
recs[<$concat::addCharsIbe(buffer_i+20, rPtr->IdI())$>]=[<$$ recoring_item.c_str() $>]
recs[<$cSv(cToSvInt(rPtr->IdI()))$>]=[<$$ recoring_item.c_str() $>]
<%cpp>
found = true;
break;
Expand Down
23 changes: 6 additions & 17 deletions pages/recordings.ecpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,6 @@ const char *lf = "<br/>";


RecordingsTreePtr recordingsTree(LiveRecordingsManager()->GetRecordingsTree());
char buffer_i[21];
buffer_i[20] = 0;

// get data for all open nodes
std::vector<int> available_recs;
Expand All @@ -137,16 +135,16 @@ cLargeString recoring_item("recoring_item", 25000);
<& pageelems.ajax_js &>
<script>
const recs = [];
const vdr_start = <$ concat::addCharsIbe(buffer_i+20, LiveSetup().GetVdrStart() ) $>;
const recordings_tree_creation = <$ concat::addCharsIbe(buffer_i+20, recordingsTree->getCreationTimestamp() ) $>;
const vdr_start = <$ cSv(cToSvInt(LiveSetup().GetVdrStart() )) $>;
const recordings_tree_creation = <$ cSv(cToSvInt(recordingsTree->getCreationTimestamp() )) $>;
const param_name_recs = '&r<$ TNT_ARRAY $>=';
<%cpp>
/*
for (const RecordingsItemPtr &rPtr: *recordingsTree->allRecordings()) {
recoring_item.clear();
rPtr->AppendAsJSArray(recoring_item, currentFlat == "true" || currentSort == "duplicates");
</%cpp>
recs[<$concat::addCharsIbe(buffer_i+20, rPtr->IdI())$>]=[<$$ recoring_item.c_str() $>]
recs[<$cSv(cToSvInt(rPtr->IdI()))$>]=[<$$ recoring_item.c_str() $>]
<%cpp>
}
*/
Expand Down Expand Up @@ -468,16 +466,14 @@ if (!write_recs && recItemsC) {
}
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>
<script>
<%cpp>
for (const RecordingsItemPtr &rPtr: *recItemsC) {
recoring_item->clear();
rPtr->AppendAsJSArray(*recoring_item, true);
</%cpp>
recs[<$concat::addCharsIbe(buffer_i+20, rPtr->IdI())$>]=[<$$ recoring_item->c_str() $>]
recs[<$cSv(cToSvInt(rPtr->IdI()))$>]=[<$$ recoring_item->c_str() $>]
% }
</script>
<%cpp>
Expand Down Expand Up @@ -525,16 +521,14 @@ if (currentSort != "duplicates" || currentFlat == "true") {
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() $>]
recs[<$cSv(cToSvInt(rPtr->IdI()))$>]=[<$$ recoring_item->c_str() $>]
% }
</script>
<%cpp>
Expand Down Expand Up @@ -721,21 +715,16 @@ if (recording && recording->Info() ) {
cGetScraperVideo getScraperVideo(NULL, recording);
bool scraperDataAvailable = getScraperVideo.call(LiveSetup().GetPluginScraper());
if (scraperDataAvailable) {
int duration_deviation = getScraperVideo.m_scraperVideo->getDurationDeviation();
int video_SD_HD = getScraperVideo.m_scraperVideo->getHD();
char sdhd = video_SD_HD == 0 ? 's': video_SD_HD == 1 ? 'h': 'u';
char b_recordingErrors[21];
char b_duration_deviation[21];
b_recordingErrors[20] = 0;
b_duration_deviation[20] = 0;
std::string duration;
if (recording->FileName() )
AppendDuration(duration, tr("%d:%02d"), recording->LengthInSeconds() );
</%cpp>
<img data-src="img/transparent.png" height="10px" />
<span id="icons-<$id$>"></span>
<script class="injectIcons">
injectErrorHdSdIcon(\"icons-<$id$>\", <$concat::addCharsIbe(b_recordingErrors+20, recordingErrors)$>, <$concat::addCharsIbe(b_duration_deviation+20, duration_deviation)$>, \"<$sdhd$>\", \"<$recording->Info()->ChannelName()?recording->Info()->ChannelName():""$>\", \"<$duration$>\", <$ GetNumberOfTsFiles(recording) $>)
injectErrorHdSdIcon(\"icons-<$id$>\", <$cSv(cToSvInt(recordingErrors))$>, <$cSv(cToSvInt(getScraperVideo.m_scraperVideo->getDurationDeviation()))$>, \"<$sdhd$>\", \"<$cSv(recording->Info()->ChannelName())$>\", \"<$duration$>\", <$ GetNumberOfTsFiles(recording) $>)
</script>
<%cpp>
}
Expand Down
2 changes: 1 addition & 1 deletion recman.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -732,7 +732,7 @@ bool searchNameDesc(RecordingsItemPtr &RecItem, const std::vector<RecordingsItem
struct stat buffer;
int num_ts_files;
for (num_ts_files = 1; num_ts_files < 100000; ++num_ts_files) {
concat::addCharsUg0be(file + folder_length + 6, num_ts_files);
ns_concat::addCharsUg0be(file + folder_length + 6, num_ts_files);
if (stat (file, &buffer) != 0) break;
}
return num_ts_files - 1;
Expand Down
Loading

0 comments on commit 6b9dda8

Please sign in to comment.