From 60002a942db0443c19c632746002ea02225d4329 Mon Sep 17 00:00:00 2001
From: Markus Ehrnsperger <>
Date: Mon, 23 Oct 2023 22:53:44 +0200
Subject: [PATCH] autoTimerReason2
---
pages/edit_recording.ecpp | 22 +++++++++++++
services.h | 65 +++++++++++++++++++++------------------
timers.cpp | 2 +-
3 files changed, 58 insertions(+), 31 deletions(-)
diff --git a/pages/edit_recording.ecpp b/pages/edit_recording.ecpp
index 7b376b31..5b227b02 100644
--- a/pages/edit_recording.ecpp
+++ b/pages/edit_recording.ecpp
@@ -184,14 +184,36 @@ if (recording && recording->Info()->Description()) {
<$ recording->Info()->Description() $> |
<%cpp>
+
}
if (recording && recording->Info()->Aux()) {
+ std::string aux_data;
+ cGetAutoTimerReason getAutoTimerReason;
+ getAutoTimerReason.aux = recording->Info()->Aux();
+ getAutoTimerReason.requestRecording = false;
+ if (getAutoTimerReason.call(LiveSetup().GetPluginScraper()) && getAutoTimerReason.createdByTvscraper) {
+ AppendHtmlEscapedAndCorrectNonUTF8(aux_data, getAutoTimerReason.reason.c_str() );
+ } else {
+ std::string epgsearchinfo = GetXMLValue(recording->Info()->Aux(), "epgsearch");
+ if (!epgsearchinfo.empty()) {
+ AppendHtmlEscapedAndCorrectNonUTF8(aux_data, GetXMLValue(epgsearchinfo, "searchtimer").c_str() );
+ }
+ }
+ if (!aux_data.empty()) {
+%cpp>
+
+ <$ tr("Searchtimer") $>: |
+ <$ aux_data $> |
+
+<%cpp>
+ } else {
%cpp>
<$ tr("Auxiliary info") $>: |
<$ recording->Info()->Aux() $> |
<%cpp>
+ }
}
%cpp>
diff --git a/services.h b/services.h
index 9e4214fb..16f5dd4a 100644
--- a/services.h
+++ b/services.h
@@ -78,12 +78,38 @@ class ScraperGetEventType {
const cEvent *event; // check type for this event
const cRecording *recording; // or for this recording
//out
- tvType type; //typeSeries or typeMovie
+ tvType type; //tSeries or tMovie or tNone
int movieId;
int seriesId;
int episodeId;
};
+// Data structure for enviromment ("GetEnvironment" call)
+
+class cEnvironment
+{
+ public:
+//in: nothing, no input required
+//out
+ std::string basePath; // All images are in this path or subdirectories. This was given to the plugin with --dir, or is the default cache directory for the plugin.
+ std::string seriesPath;
+ std::string moviesPath;
+};
+
+// Data structure for service "GetScraperImageDir"
+// deprecated, please use "GetEnvironment". Note: GetEnvironment is also available in scraper2vdr
+class cGetScraperImageDir {
+ public:
+//in: nothing, no input required
+//out
+ std::string scraperImageDir; // this was given to the plugin with --dir, or is the default cache directory for the plugin. It will always end with a '/'
+ cPlugin *call(cPlugin *pScraper = NULL) {
+ if (!pScraper) return cPluginManager::CallFirstService("GetScraperImageDir", this);
+ else return pScraper->Service("GetScraperImageDir", this)?pScraper:NULL;
+ }
+};
+
+
// Data structures for full series and episode information
// service "GetMovie"
class cMovie {
@@ -174,7 +200,7 @@ class ScraperGetPosterBannerV2 {
const cEvent *event; // check type for this event
const cRecording *recording; // check type for this recording
//out
- tvType type; //typeSeries or typeMovie
+ tvType type; // tSeries or tMovie or tNone
cTvMedia poster;
cTvMedia banner;
};
@@ -199,48 +225,27 @@ class ScraperGetPosterThumb {
cTvMedia poster;
};
-// Data structure for enviromment ("GetEnvironment" call)
-class cEnvironment
-{
- public:
-//in: nothing, no input required
-//out
- std::string basePath; // All images are in this path or subdirectories. This was given to the plugin with --dir, or is the default cache directory for the plugin.
- std::string seriesPath;
- std::string moviesPath;
-};
-
-// NEW interface, used by live =========================================================
+// NEW interface, used by live and others ======================================
// Data structure for service "GetAutoTimerReason"
class cGetAutoTimerReason {
public:
//in:
- const cTimer *timer = nullptr;
- bool requestRecording = false;
+ const char *aux = nullptr; // the aux field of a timer or a recording
+ // for a recording information about the timer creating this recoring is provided
+ bool requestRecording = false; // set this to true if you need the cRecording object
//out
bool createdByTvscraper; // if this is false, please ignore all other return values
std::string reason; // translated, e.g. "Verbessern von Action~Salt"
- std::string recordingName; // with folder, e.g. Action~Salt
- const cRecording *recording; // only if requestRecording == true. Can always be nullptr, e.g. if the recording was deleted after the timer was created
+ // If requestRecording == true, the name of the recording at the end will be omitted. e.g. "Verbessern von"
+ std::string recordingName; // with folder, e.g. "Action~Salt". Determined during creation of timer -> available even if recording == nullptr
+ const cRecording *recording; // only if requestRecording == true. Can be nullptr, e.g. if the recording was deleted after the timer was created.
cPlugin *call(cPlugin *pScraper = NULL) {
if (!pScraper) return cPluginManager::CallFirstService("GetAutoTimerReason", this);
else return pScraper->Service("GetAutoTimerReason", this)?pScraper:NULL;
}
};
-// Data structure for service "GetScraperImageDir"
-class cGetScraperImageDir {
-public:
-//in: nothing, no input required
-//out
- std::string scraperImageDir; // this was given to the plugin with --dir, or is the default cache directory for the plugin. It will always end with a '/'
- cPlugin *call(cPlugin *pScraper = NULL) {
- if (!pScraper) return cPluginManager::CallFirstService("GetScraperImageDir", this);
- else return pScraper->Service("GetScraperImageDir", this)?pScraper:NULL;
- }
-};
-
// Data structure for service "GetScraperUpdateTimes"
class cGetScraperUpdateTimes {
public:
diff --git a/timers.cpp b/timers.cpp
index f86e329c..c6ecfe20 100644
--- a/timers.cpp
+++ b/timers.cpp
@@ -134,7 +134,7 @@ namespace vdrlive {
std::string SortedTimers::TvScraperTimerInfo(cTimer const& timer, std::string &recID, std::string &recName) {
if (!timer.Aux()) return "";
cGetAutoTimerReason getAutoTimerReason;
- getAutoTimerReason.timer = &timer;
+ getAutoTimerReason.aux = timer.Aux();
getAutoTimerReason.requestRecording = true;
if (getAutoTimerReason.call(LiveSetup().GetPluginScraper()) ) {
if (!getAutoTimerReason.createdByTvscraper) return "";