Added a command-line switch for manually defining a SAT>IP server.

This commit is contained in:
Rolf Ahrenberg 2014-11-03 23:57:08 +02:00
parent 30e8040f99
commit bde88d78b1
9 changed files with 66 additions and 21 deletions

View File

@ -65,7 +65,7 @@ VDR Plugin 'satip' Revision History
- Added a validity check for the session member. - Added a validity check for the session member.
- Added a session id quirk for Triax TSS 400. - Added a session id quirk for Triax TSS 400.
2014-11-01: Version 0.3.4 2014-11-11: Version 0.3.4
- Fixed the cable only device detection. - Fixed the cable only device detection.
- Added support for blacklisted sources. - Added support for blacklisted sources.
@ -73,3 +73,5 @@ VDR Plugin 'satip' Revision History
- Added a preliminary support for Fritz!WLAN Repeater DVB-C - Added a preliminary support for Fritz!WLAN Repeater DVB-C
(Thanks to Christian Wick). (Thanks to Christian Wick).
- Added a new device status menu. - Added a new device status menu.
- Added a command-line switch for manually defining a
SAT>IP server.

4
README
View File

@ -44,6 +44,10 @@ The plugin accepts a "--devices" (-d) command-line parameter defaulting
to one. This parameter defines how many simultaneous transponders can to one. This parameter defines how many simultaneous transponders can
be received, if there are available SAT>IP tuners. be received, if there are available SAT>IP tuners.
The plugin accepts also a "--server" (-s) command-line parameter, that
can be used to manually configure one SAT>IP server, if autodetection
via UPnP somehow can't be used.
SAT>IP satellite positions (aka. signal sources) shall be defined via SAT>IP satellite positions (aka. signal sources) shall be defined via
sources.conf. If the source description begins with a number, it's used sources.conf. If the source description begins with a number, it's used
as SAT>IP signal source selection parameter. Otherwise, the default as SAT>IP signal source selection parameter. Otherwise, the default

View File

@ -32,11 +32,15 @@ cSatipDiscover *cSatipDiscover::GetInstance(void)
return instanceS; return instanceS;
} }
bool cSatipDiscover::Initialize(void) bool cSatipDiscover::Initialize(const char *serverAddrP, const char *serverDescriptionP, const char *serverModelP)
{ {
debug("cSatipDiscover::%s()", __FUNCTION__); debug("cSatipDiscover::%s(%s, %s, %s)", __FUNCTION__, serverAddrP ? serverAddrP : "auto", serverDescriptionP ? serverDescriptionP : "auto", serverModelP ? serverModelP : "auto");
if (instanceS) if (instanceS) {
instanceS->Activate(); if (serverAddrP && serverDescriptionP && serverModelP)
instanceS->AddServer(serverAddrP, serverDescriptionP, serverModelP);
else
instanceS->Activate();
}
return true; return true;
} }
@ -98,8 +102,6 @@ cSatipDiscover::cSatipDiscover()
serversM(new cSatipServers()) serversM(new cSatipServers())
{ {
debug("cSatipDiscover::%s()", __FUNCTION__); debug("cSatipDiscover::%s()", __FUNCTION__);
// Start the thread
Start();
} }
cSatipDiscover::~cSatipDiscover() cSatipDiscover::~cSatipDiscover()

View File

@ -52,7 +52,7 @@ protected:
public: public:
static cSatipDiscover *GetInstance(void); static cSatipDiscover *GetInstance(void);
static bool Initialize(void); static bool Initialize(const char *serverAddrP, const char *serverDescriptionP, const char *serverModelP);
static void Destroy(void); static void Destroy(void);
virtual ~cSatipDiscover(); virtual ~cSatipDiscover();
void TriggerScan(void) { probeIntervalM.Set(0); } void TriggerScan(void) { probeIntervalM.Set(0); }

View File

@ -7,8 +7,8 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: vdr-satip 0.3.4\n" "Project-Id-Version: vdr-satip 0.3.4\n"
"Report-Msgid-Bugs-To: <see README>\n" "Report-Msgid-Bugs-To: <see README>\n"
"POT-Creation-Date: 2014-11-01 11:01+0200\n" "POT-Creation-Date: 2014-11-11 11:11+0200\n"
"PO-Revision-Date: 2014-11-01 11:01+0200\n" "PO-Revision-Date: 2014-11-11 11:11+0200\n"
"Last-Translator: Gabriel Bonich <gbonich@gmail.com>\n" "Last-Translator: Gabriel Bonich <gbonich@gmail.com>\n"
"Language-Team: Catalan <vdr@linuxtv.org>\n" "Language-Team: Catalan <vdr@linuxtv.org>\n"
"Language: ca\n" "Language: ca\n"

View File

@ -7,8 +7,8 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: vdr-satip 0.3.4\n" "Project-Id-Version: vdr-satip 0.3.4\n"
"Report-Msgid-Bugs-To: <see README>\n" "Report-Msgid-Bugs-To: <see README>\n"
"POT-Creation-Date: 2014-11-01 11:01+0200\n" "POT-Creation-Date: 2014-11-11 11:11+0200\n"
"PO-Revision-Date: 2014-11-01 11:01+0200\n" "PO-Revision-Date: 2014-11-11 11:11+0200\n"
"Last-Translator: Frank Neumann <fnu@yavdr.org>\n" "Last-Translator: Frank Neumann <fnu@yavdr.org>\n"
"Language-Team: German <vdr@linuxtv.org>\n" "Language-Team: German <vdr@linuxtv.org>\n"
"Language: de\n" "Language: de\n"

View File

@ -7,8 +7,8 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: vdr-satip 0.3.4\n" "Project-Id-Version: vdr-satip 0.3.4\n"
"Report-Msgid-Bugs-To: <see README>\n" "Report-Msgid-Bugs-To: <see README>\n"
"POT-Creation-Date: 2014-11-01 11:01+0200\n" "POT-Creation-Date: 2014-11-11 11:11+0200\n"
"PO-Revision-Date: 2014-11-01 11:01+0200\n" "PO-Revision-Date: 2014-11-11 11:11+0200\n"
"Last-Translator: Gabriel Bonich <gbonich@gmail.com>\n" "Last-Translator: Gabriel Bonich <gbonich@gmail.com>\n"
"Language-Team: Spanish <vdr@linuxtv.org>\n" "Language-Team: Spanish <vdr@linuxtv.org>\n"
"Language: es\n" "Language: es\n"

View File

@ -7,8 +7,8 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: vdr-satip 0.3.4\n" "Project-Id-Version: vdr-satip 0.3.4\n"
"Report-Msgid-Bugs-To: <see README>\n" "Report-Msgid-Bugs-To: <see README>\n"
"POT-Creation-Date: 2014-11-01 11:01+0200\n" "POT-Creation-Date: 2014-11-11 11:11+0200\n"
"PO-Revision-Date: 2014-11-01 11:01+0200\n" "PO-Revision-Date: 2014-11-11 11:11+0200\n"
"Last-Translator: Rolf Ahrenberg\n" "Last-Translator: Rolf Ahrenberg\n"
"Language-Team: Finnish <vdr@linuxtv.org>\n" "Language-Team: Finnish <vdr@linuxtv.org>\n"
"Language: fi\n" "Language: fi\n"

47
satip.c
View File

@ -31,7 +31,10 @@ static const char DESCRIPTION[] = trNOOP("SAT>IP Devices");
class cPluginSatip : public cPlugin { class cPluginSatip : public cPlugin {
private: private:
unsigned int deviceCountM; unsigned int deviceCountM;
cSatipDiscover *discoverM; cString serverAddrM;
cString serverDescriptionM;
cString serverModelM;
void ParseServer(const char *paramP);
int ParseSources(const char *valueP, int *sourcesP); int ParseSources(const char *valueP, int *sourcesP);
int ParseFilters(const char *valueP, int *filtersP); int ParseFilters(const char *valueP, int *filtersP);
public: public:
@ -59,7 +62,9 @@ public:
cPluginSatip::cPluginSatip(void) cPluginSatip::cPluginSatip(void)
: deviceCountM(1), : deviceCountM(1),
discoverM(NULL) serverAddrM(),
serverDescriptionM(),
serverModelM()
{ {
//debug("cPluginSatip::%s()", __FUNCTION__); //debug("cPluginSatip::%s()", __FUNCTION__);
// Initialize any member variables here. // Initialize any member variables here.
@ -77,7 +82,8 @@ const char *cPluginSatip::CommandLineHelp(void)
{ {
debug("cPluginSatip::%s()", __FUNCTION__); debug("cPluginSatip::%s()", __FUNCTION__);
// Return a string that describes all known command line options. // Return a string that describes all known command line options.
return " -d <num>, --devices=<number> number of devices to be created\n"; return " -d <num>, --devices=<number> number of devices to be created\n"
" -s <ipaddr>;<model>;<desc>, --server=<ipaddr>;<model>;<desc> use a hard-coded SAT>IP server\n";
} }
bool cPluginSatip::ProcessArgs(int argc, char *argv[]) bool cPluginSatip::ProcessArgs(int argc, char *argv[])
@ -86,15 +92,19 @@ bool cPluginSatip::ProcessArgs(int argc, char *argv[])
// Implement command line argument processing here if applicable. // Implement command line argument processing here if applicable.
static const struct option long_options[] = { static const struct option long_options[] = {
{ "devices", required_argument, NULL, 'd' }, { "devices", required_argument, NULL, 'd' },
{ "server", required_argument, NULL, 's' },
{ NULL, no_argument, NULL, 0 } { NULL, no_argument, NULL, 0 }
}; };
int c; int c;
while ((c = getopt_long(argc, argv, "d:", long_options, NULL)) != -1) { while ((c = getopt_long(argc, argv, "d:s:", long_options, NULL)) != -1) {
switch (c) { switch (c) {
case 'd': case 'd':
deviceCountM = atoi(optarg); deviceCountM = atoi(optarg);
break; break;
case 's':
ParseServer(optarg);
break;
default: default:
return false; return false;
} }
@ -109,7 +119,7 @@ bool cPluginSatip::Initialize(void)
if (curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) if (curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK)
error("Unable to initialize CURL"); error("Unable to initialize CURL");
SatipConfig.SetConfigDirectory(cPlugin::ResourceDirectory(PLUGIN_NAME_I18N)); SatipConfig.SetConfigDirectory(cPlugin::ResourceDirectory(PLUGIN_NAME_I18N));
cSatipDiscover::GetInstance()->Initialize(); cSatipDiscover::GetInstance()->Initialize(*serverAddrM, *serverDescriptionM, *serverModelM);
return cSatipDevice::Initialize(deviceCountM); return cSatipDevice::Initialize(deviceCountM);
} }
@ -178,6 +188,33 @@ cMenuSetupPage *cPluginSatip::SetupMenu(void)
return new cSatipPluginSetup(); return new cSatipPluginSetup();
} }
void cPluginSatip::ParseServer(const char *paramP)
{
debug("cPluginSatip::%s(%s)", __FUNCTION__, paramP);
int n = 0;
char *s, *p = (char *)paramP;
char *r = strtok_r(p, ";", &s);
while (r) {
r = skipspace(r);
//debug("cPluginSatip::%s(): serverparam[%d]=%s", __FUNCTION__, n, r);
switch (n++) {
case 0:
serverAddrM = r;
break;
case 1:
serverModelM = r;
break;
case 2:
serverDescriptionM = r;
break;
default:
break;
}
r = strtok_r(NULL, ";", &s);
}
//debug("cPluginSatip::%s(): ipaddr=%s model=%s desc=%s", __FUNCTION__, *serverAddrM, *serverModelM, *serverDescriptionM);
}
int cPluginSatip::ParseSources(const char *valueP, int *sourcesP) int cPluginSatip::ParseSources(const char *valueP, int *sourcesP)
{ {
debug("cPluginSatip::%s(%s)", __FUNCTION__, valueP); debug("cPluginSatip::%s(%s)", __FUNCTION__, valueP);