Fixed backwards compatibility of streams API.
This commit is contained in:
parent
ce4c6b71d0
commit
aa23121330
1 changed files with 10 additions and 4 deletions
|
@ -9,8 +9,8 @@ namespace Controller {
|
||||||
|
|
||||||
std::map<std::string, int> lastBuffer; ///< Last moment of contact with all buffers.
|
std::map<std::string, int> lastBuffer; ///< Last moment of contact with all buffers.
|
||||||
|
|
||||||
bool streamsEqual(JSON::Value & one, JSON::Value & two){
|
bool streamsEqual(JSON::Value & one, JSON::Value & two){
|
||||||
if (one["source"] != two["source"]){
|
if (!one.isMember("source") || !two.isMember("source") || one["source"] != two["source"]){
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -19,7 +19,13 @@ namespace Controller {
|
||||||
void startStream(std::string name, JSON::Value & data){
|
void startStream(std::string name, JSON::Value & data){
|
||||||
data["online"] = (std::string)"Checking...";
|
data["online"] = (std::string)"Checking...";
|
||||||
data.removeMember("error");
|
data.removeMember("error");
|
||||||
std::string URL = data["source"];
|
std::string URL;
|
||||||
|
if (data.isMember("channel") && data["channel"].isMember("URL")){
|
||||||
|
URL = data["channel"]["URL"].asString();
|
||||||
|
}
|
||||||
|
if (data.isMember("source")){
|
||||||
|
URL = data["source"].asString();
|
||||||
|
}
|
||||||
std::string cmd1, cmd2, cmd3;
|
std::string cmd1, cmd2, cmd3;
|
||||||
if (URL == ""){
|
if (URL == ""){
|
||||||
Log("STRM", "Error for stream " + name + "! Source parameter missing.");
|
Log("STRM", "Error for stream " + name + "! Source parameter missing.");
|
||||||
|
@ -71,7 +77,7 @@ namespace Controller {
|
||||||
startStream(jit->first, jit->second);
|
startStream(jit->first, jit->second);
|
||||||
}
|
}
|
||||||
if (currTime - lastBuffer[jit->first] > 5){
|
if (currTime - lastBuffer[jit->first] > 5){
|
||||||
if (jit->second["source"].asString().substr(0, 1) == "/" && jit->second.isMember("error") && jit->second["error"].asString() == "Available"){
|
if (jit->second.isMember("source") && jit->second["source"].asString().substr(0, 1) == "/" && jit->second.isMember("error") && jit->second["error"].asString() == "Available"){
|
||||||
jit->second["online"] = 2;
|
jit->second["online"] = 2;
|
||||||
}else{
|
}else{
|
||||||
if (jit->second.isMember("error") && jit->second["error"].asString() == "Available"){
|
if (jit->second.isMember("error") && jit->second["error"].asString() == "Available"){
|
||||||
|
|
Loading…
Add table
Reference in a new issue