mirror of
https://projects.vdr-developer.org/git/vdr-plugin-scraper2vdr.git
synced 2023-10-19 17:58:31 +02:00
added more debugging possibilities
This commit is contained in:
parent
b22842dc8e
commit
c538d359ec
2
config.c
2
config.c
@ -12,6 +12,7 @@ cScraper2VdrConfig::cScraper2VdrConfig() {
|
|||||||
mysqlDBUser = "epg2vdr";
|
mysqlDBUser = "epg2vdr";
|
||||||
mysqlDBPass = "epg";
|
mysqlDBPass = "epg";
|
||||||
recScrapInfoName = "scrapinfo";
|
recScrapInfoName = "scrapinfo";
|
||||||
|
debug = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
cScraper2VdrConfig::~cScraper2VdrConfig() {
|
cScraper2VdrConfig::~cScraper2VdrConfig() {
|
||||||
@ -50,6 +51,7 @@ bool cScraper2VdrConfig::SetupParse(const char *Name, const char *Value) {
|
|||||||
else if (strcmp(Name, "mysqlDBName") == 0) mysqlDBName = Value;
|
else if (strcmp(Name, "mysqlDBName") == 0) mysqlDBName = Value;
|
||||||
else if (strcmp(Name, "mysqlDBUser") == 0) mysqlDBUser = Value;
|
else if (strcmp(Name, "mysqlDBUser") == 0) mysqlDBUser = Value;
|
||||||
else if (strcmp(Name, "mysqlDBPass") == 0) mysqlDBPass = Value;
|
else if (strcmp(Name, "mysqlDBPass") == 0) mysqlDBPass = Value;
|
||||||
|
else if (strcmp(Name, "debug") == 0) debug = atoi(Value);
|
||||||
else
|
else
|
||||||
return false;
|
return false;
|
||||||
return true;
|
return true;
|
||||||
|
1
config.h
1
config.h
@ -27,5 +27,6 @@ class cScraper2VdrConfig {
|
|||||||
string mysqlDBUser;
|
string mysqlDBUser;
|
||||||
string mysqlDBPass;
|
string mysqlDBPass;
|
||||||
string recScrapInfoName;
|
string recScrapInfoName;
|
||||||
|
int debug;
|
||||||
};
|
};
|
||||||
#endif //__SCRAPER2VDR_CONFIG_H
|
#endif //__SCRAPER2VDR_CONFIG_H
|
||||||
|
@ -6,7 +6,7 @@ msgid ""
|
|||||||
msgstr ""
|
msgstr ""
|
||||||
"Project-Id-Version: vdr-scraper2vdr 0.0.1\n"
|
"Project-Id-Version: vdr-scraper2vdr 0.0.1\n"
|
||||||
"Report-Msgid-Bugs-To: <see README>\n"
|
"Report-Msgid-Bugs-To: <see README>\n"
|
||||||
"POT-Creation-Date: 2014-03-30 14:37+0200\n"
|
"POT-Creation-Date: 2014-04-27 12:22+0200\n"
|
||||||
"PO-Revision-Date: 2014-03-30 18:30+0100\n"
|
"PO-Revision-Date: 2014-03-30 18:30+0100\n"
|
||||||
"Last-Translator: 3PO\n"
|
"Last-Translator: 3PO\n"
|
||||||
"Language-Team: German <vdr@linuxtv.org>\n"
|
"Language-Team: German <vdr@linuxtv.org>\n"
|
||||||
@ -48,6 +48,9 @@ msgstr "Bereinige Aufnahmen in Datenbank"
|
|||||||
msgid "Show Main Menu Entry"
|
msgid "Show Main Menu Entry"
|
||||||
msgstr "Hauptmenüeintrag anzeigen"
|
msgstr "Hauptmenüeintrag anzeigen"
|
||||||
|
|
||||||
|
msgid "Debug Mode"
|
||||||
|
msgstr "Debug Modus"
|
||||||
|
|
||||||
msgid "MySQL Host"
|
msgid "MySQL Host"
|
||||||
msgstr "MySQL Host"
|
msgstr "MySQL Host"
|
||||||
|
|
||||||
@ -62,4 +65,3 @@ msgstr "MySQL Benutzer"
|
|||||||
|
|
||||||
msgid "MySQL Password"
|
msgid "MySQL Password"
|
||||||
msgstr "MySQL Passwort"
|
msgstr "MySQL Passwort"
|
||||||
|
|
||||||
|
@ -219,6 +219,12 @@ const char **cPluginScraper2vdr::SVDRPHelpPages(void) {
|
|||||||
" Trigger scan for scrapinfo files in video directory.",
|
" Trigger scan for scrapinfo files in video directory.",
|
||||||
"CRDB\n"
|
"CRDB\n"
|
||||||
" Trigger cleanup of recordings database.",
|
" Trigger cleanup of recordings database.",
|
||||||
|
"DSER\n"
|
||||||
|
" Dump series kept in memory.",
|
||||||
|
"DMOV\n"
|
||||||
|
" Dump movies kept in memory.",
|
||||||
|
"DREC\n"
|
||||||
|
" Dump recordings kept in memory.",
|
||||||
0
|
0
|
||||||
};
|
};
|
||||||
return HelpPages;
|
return HelpPages;
|
||||||
@ -240,6 +246,15 @@ cString cPluginScraper2vdr::SVDRPCommand(const char *Command, const char *Option
|
|||||||
} else if (strcasecmp(Command, "CRDB") == 0) {
|
} else if (strcasecmp(Command, "CRDB") == 0) {
|
||||||
update->TriggerCleanRecordingsDB();
|
update->TriggerCleanRecordingsDB();
|
||||||
return "SCRAPER2VDR cleanup of recording DB triggered.";
|
return "SCRAPER2VDR cleanup of recording DB triggered.";
|
||||||
|
} else if (strcasecmp(Command, "DSER") == 0) {
|
||||||
|
scrapManager->DumpSeries();
|
||||||
|
return "SCRAPER2VDR dumping available series";
|
||||||
|
} else if (strcasecmp(Command, "DMOV") == 0) {
|
||||||
|
scrapManager->DumpMovies();
|
||||||
|
return "SCRAPER2VDR dumping available movies";
|
||||||
|
} else if (strcasecmp(Command, "DREC") == 0) {
|
||||||
|
scrapManager->DumpRecordings();
|
||||||
|
return "SCRAPER2VDR dumping available recordings";
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
126
scrapmanager.c
126
scrapmanager.c
@ -1,10 +1,13 @@
|
|||||||
#define __STL_CONFIG_H
|
#define __STL_v_H
|
||||||
#include <vdr/recording.h>
|
#include <vdr/recording.h>
|
||||||
#include "tools.h"
|
#include "tools.h"
|
||||||
|
#include "config.h"
|
||||||
#include "scrapmanager.h"
|
#include "scrapmanager.h"
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
|
extern cScraper2VdrConfig config;
|
||||||
|
|
||||||
bool operator<(const sEventsKey& l, const sEventsKey& r) {
|
bool operator<(const sEventsKey& l, const sEventsKey& r) {
|
||||||
if (l.eventId != r.eventId)
|
if (l.eventId != r.eventId)
|
||||||
return (l.eventId < r.eventId);
|
return (l.eventId < r.eventId);
|
||||||
@ -279,63 +282,138 @@ bool cScrapManager::MovieInUse(int movieId) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void cScrapManager::DumpSeries(int num) {
|
void cScrapManager::DumpSeries(void) {
|
||||||
int i=0;
|
int numSeries = 0;
|
||||||
tell(0, "Dumping first %d series", num);
|
map<sEventsKey, sEventsValue>::iterator it;
|
||||||
for (map<int, cTVDBSeries*>::iterator it = series.begin(); it != series.end(); it++) {
|
for (it = events.begin(); it != events.end(); it++) {
|
||||||
cTVDBSeries *s = it->second;
|
sEventsKey key = it->first;
|
||||||
s->Dump();
|
sEventsValue ev = it->second;
|
||||||
if (i == num)
|
if (ev.seriesId > 0) {
|
||||||
break;
|
const cEvent *event = NULL;
|
||||||
i++;
|
const cChannel *c = NULL;
|
||||||
|
cSchedulesLock lock;
|
||||||
|
cSchedules *s = (cSchedules *)cSchedules::Schedules(lock);
|
||||||
|
if (s) {
|
||||||
|
tChannelID cID = tChannelID::FromString(key.channelId.c_str());
|
||||||
|
c = Channels.GetByChannelID(cID);
|
||||||
|
const cSchedule *schedule = s->GetSchedule(cID);
|
||||||
|
if (schedule) {
|
||||||
|
event = schedule->GetEvent(key.eventId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (event) {
|
||||||
|
tell(0, "series (tvdbID %d, episodeId %d), Event (EventID %d): %s, %s: %s (%s)", ev.seriesId,
|
||||||
|
ev.episodeId,
|
||||||
|
key.eventId,
|
||||||
|
*event->GetDateString(),
|
||||||
|
*event->GetTimeString(),
|
||||||
|
event->Title(),
|
||||||
|
c?(c->Name()):"unknown channel");
|
||||||
|
} else {
|
||||||
|
tell(0, "series (tvdbID %d, episodeId %d), Event (EventID %d): No VDR Event found", ev.seriesId, ev.episodeId, key.eventId);
|
||||||
|
}
|
||||||
|
numSeries++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
tell(0, "Keeping %d series in memory", numSeries);
|
||||||
|
}
|
||||||
|
|
||||||
void cScrapManager::DumpMovies(int num) {
|
void cScrapManager::DumpMovies(void) {
|
||||||
int i=0;
|
int numMovies = 0;
|
||||||
tell(0, "Dumping first %d movies", num);
|
map<sEventsKey, sEventsValue>::iterator it;
|
||||||
for (map<int, cMovieDbMovie*>::iterator it = movies.begin(); it != movies.end(); it++) {
|
for (it = events.begin(); it != events.end(); it++) {
|
||||||
cMovieDbMovie *m = it->second;
|
sEventsKey key = it->first;
|
||||||
m->Dump();
|
sEventsValue ev = it->second;
|
||||||
if (i == num)
|
if (ev.movieId > 0) {
|
||||||
break;
|
const cEvent *event = NULL;
|
||||||
i++;
|
const cChannel *c = NULL;
|
||||||
|
cSchedulesLock lock;
|
||||||
|
cSchedules *s = (cSchedules *)cSchedules::Schedules(lock);
|
||||||
|
if (s) {
|
||||||
|
tChannelID cID = tChannelID::FromString(key.channelId.c_str());
|
||||||
|
c = Channels.GetByChannelID(cID);
|
||||||
|
const cSchedule *schedule = s->GetSchedule(cID);
|
||||||
|
if (schedule) {
|
||||||
|
event = schedule->GetEvent(key.eventId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (event) {
|
||||||
|
tell(0, "movie (moviedbId %d), Event (EventID %d): %s, %s: %s (%s)", ev.movieId,
|
||||||
|
key.eventId,
|
||||||
|
*event->GetDateString(),
|
||||||
|
*event->GetTimeString(),
|
||||||
|
event->Title(),
|
||||||
|
c?(c->Name()):"unknown channel");
|
||||||
|
} else {
|
||||||
|
tell(0, "movie (moviedbId %d), Event (EventID %d): No VDR Event found", ev.movieId, key.eventId);
|
||||||
|
}
|
||||||
|
numMovies++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
tell(0, "Keeping %d movies in memory", numMovies);
|
||||||
|
}
|
||||||
|
|
||||||
void cScrapManager::DumpRecordings(int num) {
|
void cScrapManager::DumpRecordings(void) {
|
||||||
tell(0, "Dumping first %d recordings", num);
|
tell(0, "%d recordings in memory:", recordings.size());
|
||||||
for (map<sRecordingsKey, sEventsValue>::iterator it = recordings.begin(); it != recordings.end(); it++) {
|
for (map<sRecordingsKey, sEventsValue>::iterator it = recordings.begin(); it != recordings.end(); it++) {
|
||||||
sRecordingsKey key = it->first;
|
sRecordingsKey key = it->first;
|
||||||
sEventsValue val = it->second;
|
sEventsValue val = it->second;
|
||||||
tell(0, "recStart %d, recPath %s, seriesId %d, episodeId %d, movieId %d", key.recStart, key.recPath.c_str(), val.seriesId, val.episodeId, val.movieId);
|
if (val.seriesId > 0) {
|
||||||
|
tell(0, "series (tvdbID %d, episodeId %d): %s", val.seriesId, val.episodeId, key.recPath.c_str());
|
||||||
|
} else if (val.movieId) {
|
||||||
|
tell(0, "movie (moviedbID %d): %s", val.movieId, key.recPath.c_str());
|
||||||
|
} else {
|
||||||
|
tell(0, "unknown recording: %s", key.recPath.c_str());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool cScrapManager::GetEventType(ScraperGetEventType *call) {
|
bool cScrapManager::GetEventType(ScraperGetEventType *call) {
|
||||||
|
if (config.debug) {
|
||||||
|
tell(0, "scraper2vdr plugin service call GetEventType called");
|
||||||
|
}
|
||||||
sEventsValue v;
|
sEventsValue v;
|
||||||
if (call->event) {
|
if (call->event) {
|
||||||
sEventsKey k;
|
sEventsKey k;
|
||||||
k.eventId = call->event->EventID();
|
k.eventId = call->event->EventID();
|
||||||
k.channelId = *(call->event->ChannelID().ToString());
|
k.channelId = *(call->event->ChannelID().ToString());
|
||||||
map<sEventsKey, sEventsValue>::iterator hit = events.find(k);
|
map<sEventsKey, sEventsValue>::iterator hit = events.find(k);
|
||||||
if (hit == events.end())
|
if (hit == events.end()) {
|
||||||
|
if (config.debug) {
|
||||||
|
tell(0, "no event found for eventID %d, channelID %s", k.eventId, k.channelId.c_str());
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
if (config.debug)
|
||||||
|
tell(0, "event found for eventID %d, channelID %s", k.eventId, k.channelId.c_str());
|
||||||
v = hit->second;
|
v = hit->second;
|
||||||
} else if (call->recording) {
|
} else if (call->recording) {
|
||||||
sRecordingsKey k;
|
sRecordingsKey k;
|
||||||
k.recStart = call->recording->Start();
|
k.recStart = call->recording->Start();
|
||||||
k.recPath = getRecPath(call->recording);
|
k.recPath = getRecPath(call->recording);
|
||||||
map<sRecordingsKey, sEventsValue>::iterator hit = recordings.find(k);
|
map<sRecordingsKey, sEventsValue>::iterator hit = recordings.find(k);
|
||||||
if (hit == recordings.end())
|
if (hit == recordings.end()) {
|
||||||
|
if (config.debug) {
|
||||||
|
tell(0, "no recording found for recStart %d, recPath %s", k.recStart, k.recPath.c_str());
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
v = hit->second;
|
v = hit->second;
|
||||||
|
if (config.debug) {
|
||||||
|
tell(0, "recording found for recStart %d, recPath %s", k.recStart, k.recPath.c_str());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (v.seriesId > 0) {
|
if (v.seriesId > 0) {
|
||||||
call->type = tSeries;
|
call->type = tSeries;
|
||||||
|
if (config.debug)
|
||||||
|
tell(0, "series detected, seriesId %d, episodeId %d", v.seriesId, v.episodeId);
|
||||||
} else if (v.movieId > 0) {
|
} else if (v.movieId > 0) {
|
||||||
call->type = tMovie;
|
call->type = tMovie;
|
||||||
|
if (config.debug)
|
||||||
|
tell(0, "movie detected, movieId %d", v.movieId);
|
||||||
} else {
|
} else {
|
||||||
|
if (config.debug)
|
||||||
|
tell(0, "unvalid entry");
|
||||||
call->type = tNone;
|
call->type = tNone;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -67,9 +67,9 @@ class cScrapManager {
|
|||||||
bool SeriesInUse(int seriesId);
|
bool SeriesInUse(int seriesId);
|
||||||
bool MovieInUse(int movieId);
|
bool MovieInUse(int movieId);
|
||||||
//Debug
|
//Debug
|
||||||
void DumpSeries(int num);
|
void DumpSeries(void);
|
||||||
void DumpMovies(int num);
|
void DumpMovies(void);
|
||||||
void DumpRecordings(int num);
|
void DumpRecordings(void);
|
||||||
//Service Calls
|
//Service Calls
|
||||||
bool GetEventType(ScraperGetEventType *call);
|
bool GetEventType(ScraperGetEventType *call);
|
||||||
bool GetSeries(cSeries *series);
|
bool GetSeries(cSeries *series);
|
||||||
|
2
setup.c
2
setup.c
@ -21,6 +21,7 @@ void cScraper2VdrSetup::Setup(void) {
|
|||||||
Clear();
|
Clear();
|
||||||
|
|
||||||
Add(new cMenuEditBoolItem(tr("Show Main Menu Entry"), &tmpConfig.mainMenuEntry));
|
Add(new cMenuEditBoolItem(tr("Show Main Menu Entry"), &tmpConfig.mainMenuEntry));
|
||||||
|
Add(new cMenuEditBoolItem(tr("Debug Mode"), &tmpConfig.debug));
|
||||||
Add(new cMenuEditStrItem(tr("MySQL Host"), host, sizeof(host), tr(FileNameChars)));
|
Add(new cMenuEditStrItem(tr("MySQL Host"), host, sizeof(host), tr(FileNameChars)));
|
||||||
Add(new cMenuEditIntItem(tr("MySQL Port"), &tmpConfig.mysqlPort, 1, 99999));
|
Add(new cMenuEditIntItem(tr("MySQL Port"), &tmpConfig.mysqlPort, 1, 99999));
|
||||||
Add(new cMenuEditStrItem(tr("MySQL Database Name"), dbname, sizeof(dbname), tr(FileNameChars)));
|
Add(new cMenuEditStrItem(tr("MySQL Database Name"), dbname, sizeof(dbname), tr(FileNameChars)));
|
||||||
@ -75,4 +76,5 @@ void cScraper2VdrSetup::Store(void) {
|
|||||||
SetupStore("mysqlDBName", tmpConfig.mysqlDBName.c_str());
|
SetupStore("mysqlDBName", tmpConfig.mysqlDBName.c_str());
|
||||||
SetupStore("mysqlDBUser", tmpConfig.mysqlDBUser.c_str());
|
SetupStore("mysqlDBUser", tmpConfig.mysqlDBUser.c_str());
|
||||||
SetupStore("mysqlDBPass", tmpConfig.mysqlDBPass.c_str());
|
SetupStore("mysqlDBPass", tmpConfig.mysqlDBPass.c_str());
|
||||||
|
SetupStore("debug", tmpConfig.debug);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user