|
a/src/main.cxx |
|
b/src/main.cxx |
|
... |
|
... |
147 |
"", // url
|
147 |
"", // url
|
148 |
"" // imageUri
|
148 |
"" // imageUri
|
149 |
}
|
149 |
}
|
150 |
};
|
150 |
};
|
151 |
|
151 |
|
152 |
// The following protocolinfo data is read from a configuration file
|
|
|
153 |
// (in httpfs.cxx with the rest of the xml data), global and logically
|
|
|
154 |
// const:
|
|
|
155 |
string g_protocolInfo;
|
|
|
156 |
unordered_set<string> g_supportedFormats;
|
|
|
157 |
|
|
|
158 |
// Static for cleanup in sig handler.
|
152 |
// Static for cleanup in sig handler.
|
159 |
static UpnpDevice *dev;
|
153 |
static UpnpDevice *dev;
|
160 |
|
154 |
|
161 |
string g_datadir(DATADIR "/");
|
155 |
string g_datadir(DATADIR "/");
|
162 |
|
156 |
|
163 |
// Global
|
157 |
// Global
|
164 |
string g_configfilename;
|
158 |
string g_configfilename;
|
165 |
std::mutex g_configlock;
|
159 |
std::mutex g_configlock;
|
166 |
ConfSimple *g_config;
|
160 |
ConfSimple *g_config;
|
|
|
161 |
bool g_enableL16 = false;
|
167 |
|
162 |
|
168 |
static void onsig(int)
|
163 |
static void onsig(int)
|
169 |
{
|
164 |
{
|
170 |
LOGDEB("Got sig" << endl);
|
165 |
LOGDEB("Got sig" << endl);
|
171 |
dev->shouldExit();
|
166 |
dev->shouldExit();
|
|
... |
|
... |
566 |
}
|
561 |
}
|
567 |
|
562 |
|
568 |
|
563 |
|
569 |
// Initialize MPD client object. Retry until it works or power fail.
|
564 |
// Initialize MPD client object. Retry until it works or power fail.
|
570 |
MPDCli *mpdclip = 0;
|
565 |
MPDCli *mpdclip = 0;
|
571 |
bool enableL16 = false;
|
|
|
572 |
if (!msonly) {
|
566 |
if (!msonly) {
|
573 |
int mpdretrysecs = 2;
|
567 |
int mpdretrysecs = 2;
|
574 |
for (;;) {
|
568 |
for (;;) {
|
575 |
mpdclip = new MPDCli(mpdhost, mpdport, mpdpassword);
|
569 |
mpdclip = new MPDCli(mpdhost, mpdport, mpdpassword);
|
576 |
if (mpdclip == 0) {
|
570 |
if (mpdclip == 0) {
|
|
... |
|
... |
587 |
break;
|
581 |
break;
|
588 |
}
|
582 |
}
|
589 |
}
|
583 |
}
|
590 |
const MpdStatus& mpdstat = mpdclip->getStatus();
|
584 |
const MpdStatus& mpdstat = mpdclip->getStatus();
|
591 |
// Only the "special" upmpdcli 0.19.16 version has patch != 0
|
585 |
// Only the "special" upmpdcli 0.19.16 version has patch != 0
|
592 |
enableL16 = mpdstat.versmajor >= 1 || mpdstat.versminor >= 20 ||
|
586 |
g_enableL16 = mpdstat.versmajor >= 1 || mpdstat.versminor >= 20 ||
|
593 |
mpdstat.verspatch >= 16;
|
587 |
mpdstat.verspatch >= 16;
|
594 |
}
|
588 |
}
|
595 |
|
589 |
|
596 |
|
590 |
|
597 |
// Initialize libupnpp, and check health
|
591 |
// Initialize libupnpp, and check health
|
|
... |
|
... |
641 |
|
635 |
|
642 |
// Initialize the data we serve through HTTP (device and service
|
636 |
// Initialize the data we serve through HTTP (device and service
|
643 |
// descriptions, icons, presentation page, etc.)
|
637 |
// descriptions, icons, presentation page, etc.)
|
644 |
unordered_map<string, VDirContent> files;
|
638 |
unordered_map<string, VDirContent> files;
|
645 |
if (!initHttpFs(files, g_datadir, UUID, friendlyname, enableAV, enableOH,
|
639 |
if (!initHttpFs(files, g_datadir, UUID, friendlyname, enableAV, enableOH,
|
646 |
!senderpath.empty(), enableL16, inprocessms,
|
640 |
!senderpath.empty(), inprocessms,
|
647 |
msonly, iconpath, presentationhtml)) {
|
641 |
msonly, iconpath, presentationhtml)) {
|
648 |
exit(1);
|
642 |
exit(1);
|
649 |
}
|
643 |
}
|
650 |
|
644 |
|
651 |
if (ownqueue)
|
645 |
if (ownqueue)
|