mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2025-03-01 10:33:28 +00:00
Feat: SSDP discovery for hyperion-remote (#602)
* Auto stash before merge of "log" and "hyperion-project/master" * resolve merge tool mess
This commit is contained in:
@@ -25,6 +25,7 @@ target_link_libraries(${PROJECT_NAME}
|
||||
effectengine
|
||||
commandline
|
||||
hyperion-utils
|
||||
ssdp
|
||||
Qt5::Gui
|
||||
Qt5::Core
|
||||
Qt5::Network)
|
||||
|
@@ -12,6 +12,9 @@
|
||||
// hyperion-remote include
|
||||
#include "JsonConnection.h"
|
||||
|
||||
// ssdp discover
|
||||
#include <ssdp/SSDPDiscover.h>
|
||||
|
||||
#include "HyperionConfig.h"
|
||||
#include <commandline/Parser.h>
|
||||
|
||||
@@ -76,7 +79,7 @@ int main(int argc, char * argv[])
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// art variable definition append art to Parser short-, long option description, optional default value //
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
Option & argAddress = parser.add<Option> ('a', "address" , "Set the address of the hyperion server [default: %1]", "localhost:19444");
|
||||
Option & argAddress = parser.add<Option> ('a', "address" , "Set the address of the hyperion server [default: %1]", "127.0.0.1:19444");
|
||||
Option & argToken = parser.add<Option> ('t', "token " , "If authorization tokens are required, this token is used");
|
||||
Option & argInstance = parser.add<Option> ('I', "instance" , "Select a specific target instance by name for your command. By befault it uses always the first instance");
|
||||
IntOption & argPriority = parser.add<IntOption> ('p', "priority" , "Used to the provided priority channel (suggested 2-99) [default: %1]", "50");
|
||||
@@ -173,8 +176,20 @@ int main(int argc, char * argv[])
|
||||
return 1;
|
||||
}
|
||||
|
||||
// server searching by ssdp
|
||||
QString address = argAddress.value(parser);
|
||||
if(argAddress.value(parser) == "127.0.0.1:19444")
|
||||
{
|
||||
SSDPDiscover discover;
|
||||
address = discover.getFirstService(STY_JSONSERVER);
|
||||
if(address.isEmpty())
|
||||
{
|
||||
address = argAddress.value(parser);
|
||||
}
|
||||
}
|
||||
|
||||
// create the connection to the hyperion server
|
||||
JsonConnection connection(argAddress.value(parser), parser.isSet(argPrint));
|
||||
JsonConnection connection(address, parser.isSet(argPrint));
|
||||
|
||||
// authorization token specified. Use it first
|
||||
if (parser.isSet(argToken))
|
||||
|
Reference in New Issue
Block a user