const static ULONG VDR_LOADTVMEDIARECTHUMB =42;
const static ULONG VDR_GETEVENTSCRAPEREVENTTYPE = 43;
const static ULONG VDR_LOADTVMEDIAEVENTTHUMB =44;
+const static ULONG VDR_LOADCHANNELLOGO = 45;
const static ULONG VDR_SHUTDOWN = 666;
pthread_mutex_t threadClientMutex;
int VompClient::nr_clients = 0;
cPlugin *VompClient::scraper = NULL;
+time_t VompClient::lastScrapQuery = 0;
-VompClient::VompClient(Config* cfgBase, char* tconfigDir, int tsocket)
+VompClient::VompClient(Config* cfgBase, char* tconfigDir, char* tlogoDir,
+ char *tresourceDir, int tsocket)
: rrproc(*this), tcp(tsocket), i18n(tconfigDir)
{
#ifndef VOMPSTANDALONE
lp = NULL;
recplayer = NULL;
recordingManager = NULL;
- if (!scraper) scraper = cPluginManager::GetPlugin("scraper2vdr");
pict = new PictureReader(this);
+ if (!scraper) scrapQuery();
+ logoDir = tlogoDir;
+ resourceDir = tresourceDir;
#endif
log = Log::getInstance();
loggedIn = false;
}
}
+cPlugin *VompClient::scrapQuery()
+{
+ if (scraper) return scraper;
+ if ((time(NULL)-lastScrapQuery) > 5*60) {
+ lastScrapQuery = time(NULL);
+ if (!scraper) scraper = cPluginManager::GetPlugin("scraper2vdr");
+ }
+ return scraper;
+}
+
void VompClient::setCharset(int charset)
{
charcoding=charset;
{
if (!channel->GroupSep())
{
- log->log("Client", Log::DEBUG, "Looking for channel %lu::: number: %i name: '%s'", channelNumber, channel->Number(), channel->Name());
+// log->log("Client", Log::DEBUG, "Looking for channel %lu::: number: %i name: '%s'", channelNumber, channel->Number(), channel->Name());
if (channel->Number() == (int)channelNumber)
{
#else
int apid1 = channel->Apid(0);
#endif
- log->log("Client", Log::DEBUG, "Found channel number %lu, vpid = %i, apid1 = %i", channelNumber, vpid, apid1);
+// log->log("Client", Log::DEBUG, "Found channel number %lu, vpid = %i, apid1 = %i", channelNumber, vpid, apid1);
return channel;
}
}
friend class PictureReader;
public:
- VompClient(Config* baseConfig, char* configDir, int tsocket);
+ VompClient(Config* baseConfig, char* configDir, char* logoDir,
+ char* resourceDir, int tsocket);
~VompClient();
int run();
cRecordings* recordingManager;
RecPlayer* recplayer;
static cPlugin * scraper;
+ static time_t lastScrapQuery;
+ static cPlugin* scrapQuery();
PictureReader * pict;
+ char *logoDir;
+ char *resourceDir;
#endif
MediaPlayer *media;
case VDR_LOADTVMEDIAEVENTTHUMB:
result = processLoadTvMediaEventThumb();
break;
-
+ case VDR_LOADCHANNELLOGO:
+ result = processLoadChannelLogo();
+ break;
#endif
case VDR_GETMEDIALIST:
result = processGetMediaList();
ScraperGetEventType call;
call.type = tNone;
- if (recording && x.scraper)
+ if (recording && x.scrapQuery())
{
call.recording = recording;
x.scraper->Service("GetEventType",&call);
}
}
- if (event && x.scraper)
+ if (event && x.scrapQuery())
{
call.event = event;
x.scraper->Service("GetEventType",&call);
cMovie movie;
movie.movieId = ntohl(*(ULONG*)req->data);
- if (!x.scraper) {
+ if (!x.scrapQuery()) {
log->log("RRProc", Log::DEBUG, "No Scraper, get SeriesInfo");
return 0; //stupid, I have no scraper why are you still asking
}
cSeries series;
series.seriesId = ntohl(*(ULONG*)req->data);
series.episodeId = ntohl(*(ULONG*)(req->data+4));
- if (!x.scraper) {
+ if (!x.scrapQuery()) {
log->log("RRProc", Log::DEBUG, "No Scraper, get SeriesInfo");
return 0; //stupid, I have no scraper why are you still asking
}
return 1;
}
+int VompClientRRProc::processLoadChannelLogo()
+{
+ TVMediaRequest tvreq;
+ tvreq.streamID = req->requestID;
+ tvreq.type = 5; // channel logo
+ UINT channelid = ntohl(*(ULONG*)req->data);
+ tvreq.primary_id = channelid;
+ tvreq.secondary_id = 0;
+ cChannel* channel = x.channelFromNumber(channelid);
+
+ if (channel) tvreq.primary_name = std::string((const char*)channel->Name());
+ tvreq.type_pict = 1;
+ tvreq.container = 0;
+ tvreq.container_member = 0;
+ log->log("RRProc", Log::DEBUG, "TVMedia request %d %d %s",req->requestID,channelid, channel->Name());
+ x.pict->addTVMediaRequest(tvreq);
+
+
+ resp->finalise();
+
+ x.tcp.sendPacket(resp->getPtr(), resp->getLen());
+
+ return 1;
+}
+
int processLoadTvMediaRecThumb();
int processGetEventScraperEventType();
int processLoadTvMediaEventThumb();
+ int processLoadChannelLogo();
#endif
int processLogin();
// Clean up after yourself!
mvpserver.stop();
if (configDir) delete[] configDir;
+
}
const char *cPluginVompserver::CommandLineHelp(void)
{
if (c == 'c')
{
- const char* vdrdeveldevelret = cPlugin::ConfigDirectory(optarg);
- if (!vdrdeveldevelret)
+ const char* vdrret = cPlugin::ConfigDirectory(optarg);
+ if (!vdrret)
{
dsyslog("VOMP: Could not get config dir from VDR");
return false;
}
- configDir = new char[strlen(vdrdeveldevelret)+1];
- strcpy(configDir, vdrdeveldevelret);
+ configDir = new char[strlen(vdrret)+1];
+ strcpy(configDir, vdrret);
}
else
{
if (!configDir)
{
- const char* vdrdeveldevelret = cPlugin::ConfigDirectory("vompserver");
- if (!vdrdeveldevelret)
+ const char* vdrret = cPlugin::ConfigDirectory("vompserver");
+ if (!vdrret)
{
dsyslog("VOMP: Could not get config dir from VDR");
return false;
}
- configDir = new char[strlen(vdrdeveldevelret)+1];
- strcpy(configDir, vdrdeveldevelret);
+ configDir = new char[strlen(vdrret)+1];
+ strcpy(configDir, vdrret);
}
int success = mvpserver.run(configDir);