Skip to content

Commit

Permalink
autoTimerReason2
Browse files Browse the repository at this point in the history
  • Loading branch information
Markus Ehrnsperger committed Oct 23, 2023
1 parent 30c086c commit 60002a9
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 31 deletions.
22 changes: 22 additions & 0 deletions pages/edit_recording.ecpp
Original file line number Diff line number Diff line change
Expand Up @@ -184,14 +184,36 @@ if (recording && recording->Info()->Description()) {
<td class="rightcol"><$ recording->Info()->Description() $></td>
</tr>
<%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>
<td class="label leftcol"><div class="withmargin"><$ tr("Searchtimer") $>:</div></td>
<td class="rightcol"><$ aux_data $></td>
</tr>
<%cpp>
} else {
</%cpp>
<tr>
<td class="label leftcol"><div class="withmargin"><$ tr("Auxiliary info") $>:</div></td>
<td class="rightcol"><$ recording->Info()->Aux() $></td>
</tr>
<%cpp>
}
}
</%cpp>
<tr>
Expand Down
65 changes: 35 additions & 30 deletions services.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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;
};
Expand All @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion timers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 "";
Expand Down

0 comments on commit 60002a9

Please sign in to comment.