Fixed support for inputs with URL parameters

This commit is contained in:
Thulinma 2019-11-12 11:01:20 +01:00
parent 45b245ad4e
commit 9a1b4fb872

View file

@ -288,6 +288,8 @@ bool Util::startInput(std::string streamname, std::string filename, bool forkFir
} }
JSON::Value Util::getInputBySource(const std::string &filename, bool isProvider){ JSON::Value Util::getInputBySource(const std::string &filename, bool isProvider){
std::string tmpFn = filename;
if (tmpFn.find('?') != std::string::npos){tmpFn.erase(tmpFn.find('?'), std::string::npos);}
JSON::Value ret; JSON::Value ret;
// Attempt to load up configuration and find this stream // Attempt to load up configuration and find this stream
@ -318,8 +320,8 @@ JSON::Value Util::getInputBySource(const std::string &filename, bool isProvider)
MEDIUM_MSG("Checking input %s: %s (%s)", inputs.getIndiceName(i).c_str(), MEDIUM_MSG("Checking input %s: %s (%s)", inputs.getIndiceName(i).c_str(),
tmp_input.getMember("name").asString().c_str(), source.c_str()); tmp_input.getMember("name").asString().c_str(), source.c_str());
if (filename.substr(0, front.size()) == front && if (tmpFn.substr(0, front.size()) == front &&
filename.substr(filename.size() - back.size()) == back){ tmpFn.substr(tmpFn.size() - back.size()) == back){
if (tmp_input.getMember("non-provider") && !isProvider){ if (tmp_input.getMember("non-provider") && !isProvider){
noProviderNoPick = true; noProviderNoPick = true;
continue; continue;
@ -336,8 +338,7 @@ JSON::Value Util::getInputBySource(const std::string &filename, bool isProvider)
MEDIUM_MSG("Checking input %s: %s (%s)", inputs.getIndiceName(i).c_str(), MEDIUM_MSG("Checking input %s: %s (%s)", inputs.getIndiceName(i).c_str(),
tmp_input.getMember("name").asString().c_str(), source.c_str()); tmp_input.getMember("name").asString().c_str(), source.c_str());
if (filename.substr(0, front.size()) == front && if (tmpFn.substr(0, front.size()) == front && tmpFn.substr(tmpFn.size() - back.size()) == back){
filename.substr(filename.size() - back.size()) == back){
if (tmp_input.getMember("non-provider") && !isProvider){ if (tmp_input.getMember("non-provider") && !isProvider){
noProviderNoPick = true; noProviderNoPick = true;
continue; continue;
@ -351,9 +352,9 @@ JSON::Value Util::getInputBySource(const std::string &filename, bool isProvider)
} }
if (!selected){ if (!selected){
if (noProviderNoPick){ if (noProviderNoPick){
INFO_MSG("Not a media provider for input: %s", filename.c_str()); INFO_MSG("Not a media provider for input: %s", tmpFn.c_str());
}else{ }else{
FAIL_MSG("No compatible input found for: %s", filename.c_str()); FAIL_MSG("No compatible input found for: %s", tmpFn.c_str());
} }
}else{ }else{
ret = input.asJSON(); ret = input.asJSON();