|
a/src/mediaserver/cdplugins/plgwithslave.cxx |
|
b/src/mediaserver/cdplugins/plgwithslave.cxx |
|
... |
|
... |
228 |
/* env */ {pythonpath, configname, hostport, pp})) {
|
228 |
/* env */ {pythonpath, configname, hostport, pp})) {
|
229 |
LOGERR("PlgWithSlave::maybeStartCmd: startCmd failed\n");
|
229 |
LOGERR("PlgWithSlave::maybeStartCmd: startCmd failed\n");
|
230 |
return false;
|
230 |
return false;
|
231 |
}
|
231 |
}
|
232 |
return true;
|
232 |
return true;
|
|
|
233 |
}
|
|
|
234 |
|
|
|
235 |
bool PlgWithSlave::startInit()
|
|
|
236 |
{
|
|
|
237 |
return m && m->maybeStartCmd();
|
233 |
}
|
238 |
}
|
234 |
|
239 |
|
235 |
// Translate the slave-generated HTTP URL (based on the trackid), to
|
240 |
// Translate the slave-generated HTTP URL (based on the trackid), to
|
236 |
// an actual temporary service (e.g. tidal one), which will be an HTTP
|
241 |
// an actual temporary service (e.g. tidal one), which will be an HTTP
|
237 |
// URL pointing to either an AAC or a FLAC stream.
|
242 |
// URL pointing to either an AAC or a FLAC stream.
|
|
... |
|
... |
518 |
if (!m->cmd.callproc("browse", {{"objid", objid}, {"flag", sbflg}}, res)) {
|
523 |
if (!m->cmd.callproc("browse", {{"objid", objid}, {"flag", sbflg}}, res)) {
|
519 |
LOGERR("PlgWithSlave::browse: slave failure\n");
|
524 |
LOGERR("PlgWithSlave::browse: slave failure\n");
|
520 |
return errorEntries(objid, entries);
|
525 |
return errorEntries(objid, entries);
|
521 |
}
|
526 |
}
|
522 |
|
527 |
|
523 |
auto it = res.find("entries");
|
528 |
auto ite = res.find("entries");
|
524 |
if (it == res.end()) {
|
529 |
if (ite == res.end()) {
|
525 |
LOGERR("PlgWithSlave::browse: no entries returned\n");
|
530 |
LOGERR("PlgWithSlave::browse: no entries returned\n");
|
526 |
return errorEntries(objid, entries);
|
531 |
return errorEntries(objid, entries);
|
527 |
}
|
532 |
}
|
|
|
533 |
bool nocache = false;
|
|
|
534 |
auto itc = res.find("nocache");
|
|
|
535 |
if (itc != res.end()) {
|
|
|
536 |
nocache = stringToBool(itc->second);
|
|
|
537 |
}
|
528 |
|
538 |
|
529 |
if (flg == CDPlugin::BFChildren) {
|
539 |
if (flg == CDPlugin::BFChildren) {
|
530 |
ContentCacheEntry e;
|
540 |
ContentCacheEntry e;
|
531 |
resultToEntries(it->second, 0, 0, e.m_results);
|
541 |
resultToEntries(ite->second, 0, 0, e.m_results);
|
|
|
542 |
if (!nocache) {
|
532 |
o_bcache.set(cachekey, e);
|
543 |
o_bcache.set(cachekey, e);
|
|
|
544 |
}
|
533 |
return e.toResult("", stidx, cnt, entries);
|
545 |
return e.toResult("", stidx, cnt, entries);
|
534 |
} else {
|
546 |
} else {
|
535 |
return resultToEntries(it->second, stidx, cnt, entries);
|
547 |
return resultToEntries(ite->second, stidx, cnt, entries);
|
536 |
}
|
548 |
}
|
537 |
}
|
549 |
}
|
538 |
|
550 |
|
539 |
// Note that the offset and count don't get to the plugin for
|
551 |
// Note that the offset and count don't get to the plugin for
|
540 |
// now. Plugins just return a (plugin-dependant) fixed number of
|
552 |
// now. Plugins just return a (plugin-dependant) fixed number of
|
|
... |
|
... |
637 |
{"value", value} }, res)) {
|
649 |
{"value", value} }, res)) {
|
638 |
LOGERR("PlgWithSlave::search: slave failure\n");
|
650 |
LOGERR("PlgWithSlave::search: slave failure\n");
|
639 |
return errorEntries(ctid, entries);
|
651 |
return errorEntries(ctid, entries);
|
640 |
}
|
652 |
}
|
641 |
|
653 |
|
642 |
auto it = res.find("entries");
|
654 |
auto ite = res.find("entries");
|
643 |
if (it == res.end()) {
|
655 |
if (ite == res.end()) {
|
644 |
LOGERR("PlgWithSlave::search: no entries returned\n");
|
656 |
LOGERR("PlgWithSlave::search: no entries returned\n");
|
645 |
return errorEntries(ctid, entries);
|
657 |
return errorEntries(ctid, entries);
|
646 |
}
|
658 |
}
|
|
|
659 |
bool nocache = false;
|
|
|
660 |
auto itc = res.find("nocache");
|
|
|
661 |
if (itc != res.end()) {
|
|
|
662 |
nocache = stringToBool(itc->second);
|
|
|
663 |
}
|
647 |
// Convert the whole set and store in cache
|
664 |
// Convert the whole set and store in cache
|
648 |
ContentCacheEntry e;
|
665 |
ContentCacheEntry e;
|
649 |
resultToEntries(it->second, 0, 0, e.m_results);
|
666 |
resultToEntries(ite->second, 0, 0, e.m_results);
|
|
|
667 |
if (!nocache) {
|
650 |
o_scache.set(cachekey, e);
|
668 |
o_scache.set(cachekey, e);
|
|
|
669 |
}
|
651 |
return e.toResult(classfilter, stidx, cnt, entries);
|
670 |
return e.toResult(classfilter, stidx, cnt, entries);
|
652 |
}
|
671 |
}
|