hyperiond: add ability to export default config and effects (#244)

* - embed default config
- add possibility to export effects and embeded default config to filesystem

* do some code style
This commit is contained in:
redPanther 2016-09-17 00:40:29 +02:00 committed by GitHub
parent eeb9b0f7da
commit 858125510e
18 changed files with 301 additions and 217 deletions

View File

@ -1,6 +1,5 @@
$(document).ready( function() { $(document).ready( function() {
$("#main-nav").hide(); $("#main-nav").hide();
$("#page-content").hide();
$("#loading_overlay").addClass("overlay"); $("#loading_overlay").addClass("overlay");
loadContentTo("#container_connection_lost","connection_lost"); loadContentTo("#container_connection_lost","connection_lost");
initWebSocket(); initWebSocket();
@ -62,7 +61,6 @@ $(document).ready( function() {
}); });
$("#loading_overlay").removeClass("overlay"); $("#loading_overlay").removeClass("overlay");
$("#main-nav").show('slide', {direction: 'left'}, 1000); $("#main-nav").show('slide', {direction: 'left'}, 1000);
$("#page-content").show('slide', {direction: 'down'}, 2000);
}); // end cmd-serverinfo }); // end cmd-serverinfo

View File

@ -16,8 +16,6 @@ echo create $outfile
tar --create --verbose --gzip --absolute-names --show-transformed-names \ tar --create --verbose --gzip --absolute-names --show-transformed-names \
--file "$outfile" \ --file "$outfile" \
--transform "s:$builddir/bin/:hyperion/bin/:" \ --transform "s:$builddir/bin/:hyperion/bin/:" \
--transform "s:$repodir/effects/:hyperion/effects/:" \
--transform "s:$repodir/config/:hyperion/config/:" \
--transform "s:$repodir/bin/hyperion.init.sh:hyperion/init.d/hyperion.init.sh:" \ --transform "s:$repodir/bin/hyperion.init.sh:hyperion/init.d/hyperion.init.sh:" \
--transform "s://:/:g" \ --transform "s://:/:g" \
"$builddir/bin/hyperiond" \ "$builddir/bin/hyperiond" \
@ -25,6 +23,4 @@ tar --create --verbose --gzip --absolute-names --show-transformed-names \
"$builddir/bin/hyperion-v4l2" \ "$builddir/bin/hyperion-v4l2" \
"$builddir/bin/gpio2spi" \ "$builddir/bin/gpio2spi" \
"$builddir/bin/dispmanx2png" \ "$builddir/bin/dispmanx2png" \
"$repodir/effects/"* \
"$repodir/bin/hyperion.init.sh" \ "$repodir/bin/hyperion.init.sh" \
"$repodir/config/hyperion.config.json"

View File

@ -20,8 +20,12 @@ install_file()
echo "--- hyperion ambient light postinstall ---" echo "--- hyperion ambient light postinstall ---"
echo "- install configuration template" echo "- install configuration template"
mkdir -p /etc/hyperion mkdir -p /etc/hyperion
install_file /usr/share/hyperion/config/hyperion.config.json.default /etc/hyperion/hyperion.config.json
if [ ! -e "/etc/hyperion/hyperion.config.json" ]
then
echo "install default config to /etc/hyperion"
/usr/bin/hyperiond --export-config /etc/hyperion/hyperion.config.json
fi
HYPERION_RUNNING=false HYPERION_RUNNING=false
pgrep hyperiond > /dev/null 2>&1 && HYPERION_RUNNING=true pgrep hyperiond > /dev/null 2>&1 && HYPERION_RUNNING=true

View File

@ -42,6 +42,7 @@ public:
QString value(Parser &parser); QString value(Parser &parser);
std::string getStdString(Parser &parser); std::string getStdString(Parser &parser);
std::wstring getStdWString(Parser &parser); std::wstring getStdWString(Parser &parser);
const char* getCString(Parser &parser);
}; };
} }

View File

@ -1,5 +1,4 @@
#ifndef HYPERION_COMMANDLINEPARSER_H #pragma once
#define HYPERION_COMMANDLINEPARSER_H
#include <QtCore> #include <QtCore>
#include <QtGui> #include <QtGui>
@ -20,101 +19,126 @@ namespace commandline
class Parser : public QObject class Parser : public QObject
{ {
protected: protected:
QHash<QString, Option *> _options; QHash<QString, Option *> _options;
QString _errorText; QString _errorText;
/* No public inheritance because we need to modify a few methods */ /* No public inheritance because we need to modify a few methods */
QCommandLineParser _parser; QCommandLineParser _parser;
QStringList _getNames(const char shortOption, const QString longOption); QStringList _getNames(const char shortOption, const QString longOption);
QString _getDescription(const QString description, const QString default_=QString()); QString _getDescription(const QString description, const QString default_=QString());
public: public:
bool parse(const QStringList &arguments); bool parse(const QStringList &arguments);
void process(const QStringList &arguments); void process(const QStringList &arguments);
void process(const QCoreApplication &app); void process(const QCoreApplication &app);
QString errorText() const; QString errorText() const;
template<class OptionT, class ... Args> template<class OptionT, class ... Args>
OptionT &add( OptionT &add(
const char shortOption, const char shortOption,
const QString longOption, const QString longOption,
const QString description, const QString description,
const QString default_, const QString default_,
Args ... args) Args ... args)
{ {
OptionT * option = new OptionT( OptionT * option = new OptionT(
_getNames(shortOption, longOption), _getNames(shortOption, longOption),
_getDescription(description, default_), _getDescription(description, default_),
longOption, longOption,
default_, default_,
args...); args...);
addOption(option); addOption(option);
return *option; return *option;
} }
/* gcc does not support default arguments for variadic templates which /* gcc does not support default arguments for variadic templates which
* makes this method necessary */ * makes this method necessary */
template<class OptionT> template<class OptionT>
OptionT &add( OptionT &add(
const char shortOption, const char shortOption,
const QString longOption, const QString longOption,
const QString description, const QString description,
const QString default_ = QString()) const QString default_ = QString())
{ {
OptionT * option = new OptionT( OptionT * option = new OptionT(
_getNames(shortOption, longOption), _getNames(shortOption, longOption),
_getDescription(description, default_), _getDescription(description, default_),
longOption, longOption,
default_); default_);
addOption(option); addOption(option);
return *option; return *option;
} }
Parser(QString description=QString()) Parser(QString description=QString())
{if(description.size())setApplicationDescription(description);}; {
QCommandLineOption addHelpOption() if(description.size())setApplicationDescription(description);
{ return _parser.addHelpOption(); } };
bool addOption(Option &option);
bool addOption(Option *option); QCommandLineOption addHelpOption()
void addPositionalArgument(const QString &name, const QString &description, const QString &syntax = QString()) {
{ _parser.addPositionalArgument(name, description, syntax); } return _parser.addHelpOption();
QCommandLineOption addVersionOption() };
{ return _parser.addVersionOption(); }
QString applicationDescription() const bool addOption(Option &option);
{ return _parser.applicationDescription(); } bool addOption(Option *option);
void clearPositionalArguments() void addPositionalArgument(const QString &name, const QString &description, const QString &syntax = QString())
{ _parser.clearPositionalArguments(); } {
QString helpText() const _parser.addPositionalArgument(name, description, syntax);
{ return _parser.helpText(); } };
bool isSet(const QString &name) const
{ return _parser.isSet(name); } QCommandLineOption addVersionOption()
bool isSet(const Option &option) const {
{ return _parser.isSet(option); } return _parser.addVersionOption();
bool isSet(const Option *option) const };
{ return _parser.isSet(*option); }
QStringList optionNames() const QString applicationDescription() const
{ return _parser.optionNames(); } { return _parser.applicationDescription(); }
QStringList positionalArguments() const
{ return _parser.positionalArguments(); } void clearPositionalArguments()
void setApplicationDescription(const QString &description) { _parser.clearPositionalArguments(); }
{ _parser.setApplicationDescription(description); }
void setSingleDashWordOptionMode(QCommandLineParser::SingleDashWordOptionMode singleDashWordOptionMode) QString helpText() const
{ _parser.setSingleDashWordOptionMode(singleDashWordOptionMode); } { return _parser.helpText(); }
void showHelp(int exitCode = 0)
{ _parser.showHelp(exitCode); } bool isSet(const QString &name) const
QStringList unknownOptionNames() const { return _parser.isSet(name); }
{ return _parser.unknownOptionNames(); }
QString value(const QString &optionName) const bool isSet(const Option &option) const
{ return _parser.value(optionName); } { return _parser.isSet(option); }
QString value(const Option &option) const
{ return _parser.value(option); } bool isSet(const Option *option) const
QStringList values(const QString &optionName) const { return _parser.isSet(*option); }
{ return _parser.values(optionName); }
QStringList values(const Option &option) const QStringList optionNames() const
{ return _parser.values(option); } { return _parser.optionNames(); }
QStringList positionalArguments() const
{ return _parser.positionalArguments(); }
void setApplicationDescription(const QString &description)
{ _parser.setApplicationDescription(description); }
void setSingleDashWordOptionMode(QCommandLineParser::SingleDashWordOptionMode singleDashWordOptionMode)
{ _parser.setSingleDashWordOptionMode(singleDashWordOptionMode); }
void showHelp(int exitCode = 0)
{ _parser.showHelp(exitCode); }
QStringList unknownOptionNames() const
{ return _parser.unknownOptionNames(); }
QString value(const QString &optionName) const
{ return _parser.value(optionName); }
QString value(const Option &option) const
{ return _parser.value(option); }
QStringList values(const QString &optionName) const
{ return _parser.values(optionName); }
QStringList values(const Option &option) const
{ return _parser.values(option); }
}; };
} }
#endif //HYPERION_COMMANDLINEPARSER_H

View File

@ -1,8 +1,9 @@
#pragma once
#include <string> #include <string>
namespace FileUtils { namespace FileUtils {
std::string getBaseName( std::string sourceFile); std::string getBaseName( std::string sourceFile);
}; };

View File

@ -1,3 +1,5 @@
#pragma once
#include <string> #include <string>
namespace Process { namespace Process {

View File

@ -24,3 +24,8 @@ std::wstring Option::getStdWString(Parser &parser)
return value(parser).toStdWString(); return value(parser).toStdWString();
} }
const char* Option::getCString(Parser &parser)
{
return value(parser).toLocal8Bit().constData();
}

View File

@ -1,5 +1,6 @@
<RCC> <RCC>
<qresource prefix="/"> <qresource prefix="/">
<file alias="hyperion-schema">hyperion.schema.json</file> <file alias="hyperion-schema">hyperion.schema.json</file>
<file alias="hyperion_default.config">../../config/hyperion.config.json.default</file>
</qresource> </qresource>
</RCC> </RCC>

View File

@ -34,14 +34,14 @@ int main(int argc, char ** argv)
// create the option parser and initialize all parser // create the option parser and initialize all parser
Parser parser("AmLogic capture application for Hyperion"); Parser parser("AmLogic capture application for Hyperion");
IntOption & argFps = parser.add<IntOption> ('f', "framerate", "Capture frame rate [default: %1]", "10"); IntOption & argFps = parser.add<IntOption> ('f', "framerate", "Capture frame rate [default: %1]", "10");
IntOption & argWidth = parser.add<IntOption> (0x0, "width", "Width of the captured image [default: %1]", "160", 160, 4096); IntOption & argWidth = parser.add<IntOption> (0x0, "width", "Width of the captured image [default: %1]", "160", 160, 4096);
IntOption & argHeight = parser.add<IntOption> (0x0, "height", "Height of the captured image [default: %1]", "160", 160, 4096); IntOption & argHeight = parser.add<IntOption> (0x0, "height", "Height of the captured image [default: %1]", "160", 160, 4096);
BooleanOption & argScreenshot = parser.add<BooleanOption> (0x0, "screenshot", "Take a single screenshot, save it to file and quit"); BooleanOption & argScreenshot = parser.add<BooleanOption>(0x0, "screenshot", "Take a single screenshot, save it to file and quit");
Option & argAddress = parser.add<Option> ('a', "address", "Set the address of the hyperion server [default: %1]", "127.0.0.1:19445"); Option & argAddress = parser.add<Option> ('a', "address", "Set the address of the hyperion server [default: %1]", "127.0.0.1:19445");
IntOption & argPriority = parser.add<IntOption> ('p', "priority", "Use the provided priority channel (the lower the number, the higher the priority) [default: %1]", "800"); IntOption & argPriority = parser.add<IntOption> ('p', "priority", "Use the provided priority channel (the lower the number, the higher the priority) [default: %1]", "800");
BooleanOption & argSkipReply = parser.add<BooleanOption> (0x0, "skip-reply", "Do not receive and check reply messages from Hyperion"); BooleanOption & argSkipReply = parser.add<BooleanOption>(0x0, "skip-reply", "Do not receive and check reply messages from Hyperion");
BooleanOption & argHelp = parser.add<BooleanOption> ('h', "help", "Show this help message and exit"); BooleanOption & argHelp = parser.add<BooleanOption>('h', "help", "Show this help message and exit");
// parse all options // parse all options
parser.process(app); parser.process(app);

View File

@ -33,23 +33,23 @@ int main(int argc, char ** argv)
// create the option parser and initialize all parameters // create the option parser and initialize all parameters
Parser parser("Dispmanx capture application for Hyperion"); Parser parser("Dispmanx capture application for Hyperion");
IntOption & argFps = parser.add<IntOption> ('f', "framerate", "Capture frame rate [default: %1]", "10"); IntOption & argFps = parser.add<IntOption> ('f', "framerate", "Capture frame rate [default: %1]", "10");
IntOption & argWidth = parser.add<IntOption> (0x0, "width", "Width of the captured image [default: %1]", "64", 32, 4096); IntOption & argWidth = parser.add<IntOption> (0x0, "width", "Width of the captured image [default: %1]", "64", 32, 4096);
IntOption & argHeight = parser.add<IntOption> (0x0, "height", "Height of the captured image [default: %1]", "64", 32, 4096); IntOption & argHeight = parser.add<IntOption> (0x0, "height", "Height of the captured image [default: %1]", "64", 32, 4096);
BooleanOption & argScreenshot = parser.add<BooleanOption> (0x0, "screenshot", "Take a single screenshot, save it to file and quit"); BooleanOption & argScreenshot = parser.add<BooleanOption>(0x0, "screenshot", "Take a single screenshot, save it to file and quit");
Option & argAddress = parser.add<Option> ('a', "address", "Set the address of the hyperion server [default: %1]", "127.0.0.1:19445"); Option & argAddress = parser.add<Option> ('a', "address", "Set the address of the hyperion server [default: %1]", "127.0.0.1:19445");
IntOption & argPriority = parser.add<IntOption> ('p', "priority", "Use the provided priority channel (the lower the number, the higher the priority) [default: %1]", "800"); IntOption & argPriority = parser.add<IntOption> ('p', "priority", "Use the provided priority channel (the lower the number, the higher the priority) [default: %1]", "800");
BooleanOption & argSkipReply = parser.add<BooleanOption> (0x0, "skip-reply", "Do not receive and check reply messages from Hyperion"); BooleanOption & argSkipReply = parser.add<BooleanOption>(0x0, "skip-reply", "Do not receive and check reply messages from Hyperion");
BooleanOption & argHelp = parser.add<BooleanOption> ('h', "help", "Show this help message and exit"); BooleanOption & argHelp = parser.add<BooleanOption>('h', "help", "Show this help message and exit");
IntOption & argCropLeft = parser.add<IntOption> (0x0, "crop-left", "pixels to remove on left after grabbing"); IntOption & argCropLeft = parser.add<IntOption> (0x0, "crop-left", "pixels to remove on left after grabbing");
IntOption & argCropRight = parser.add<IntOption> (0x0, "crop-right", "pixels to remove on right after grabbing"); IntOption & argCropRight = parser.add<IntOption> (0x0, "crop-right", "pixels to remove on right after grabbing");
IntOption & argCropTop = parser.add<IntOption> (0x0, "crop-top", "pixels to remove on top after grabbing"); IntOption & argCropTop = parser.add<IntOption> (0x0, "crop-top", "pixels to remove on top after grabbing");
IntOption & argCropBottom = parser.add<IntOption> (0x0, "crop-bottom", "pixels to remove on bottom after grabbing"); IntOption & argCropBottom = parser.add<IntOption> (0x0, "crop-bottom", "pixels to remove on bottom after grabbing");
BooleanOption & arg3DSBS = parser.add<BooleanOption> (0x0, "3DSBS", "Interpret the incoming video stream as 3D side-by-side"); BooleanOption & arg3DSBS = parser.add<BooleanOption>(0x0, "3DSBS", "Interpret the incoming video stream as 3D side-by-side");
BooleanOption & arg3DTAB = parser.add<BooleanOption> (0x0, "3DTAB", "Interpret the incoming video stream as 3D top-and-bottom"); BooleanOption & arg3DTAB = parser.add<BooleanOption>(0x0, "3DTAB", "Interpret the incoming video stream as 3D top-and-bottom");
// parse all options // parse all options
parser.process(app); parser.process(app);

View File

@ -27,15 +27,15 @@ int main(int argc, char ** argv)
// create the option parser and initialize all parameters // create the option parser and initialize all parameters
Parser parser("FrameBuffer capture application for Hyperion"); Parser parser("FrameBuffer capture application for Hyperion");
Option & argDevice = parser.add<Option> ('d', "device", "Set the video device [default: %1]", "/dev/video0"); Option & argDevice = parser.add<Option> ('d', "device", "Set the video device [default: %1]", "/dev/video0");
IntOption & argFps = parser.add<IntOption> ('f', "framerate", "Capture frame rate [default: %1]", "10"); IntOption & argFps = parser.add<IntOption> ('f', "framerate", "Capture frame rate [default: %1]", "10");
IntOption & argWidth = parser.add<IntOption> (0x0, "width", "Width of the captured image [default: %1]", "160", 160, 4096); IntOption & argWidth = parser.add<IntOption> (0x0, "width", "Width of the captured image [default: %1]", "160", 160, 4096);
IntOption & argHeight = parser.add<IntOption> (0x0, "height", "Height of the captured image [default: %1]", "160", 160, 4096); IntOption & argHeight = parser.add<IntOption> (0x0, "height", "Height of the captured image [default: %1]", "160", 160, 4096);
BooleanOption & argScreenshot = parser.add<BooleanOption> (0x0, "screenshot", "Take a single screenshot, save it to file and quit"); BooleanOption & argScreenshot = parser.add<BooleanOption>(0x0, "screenshot", "Take a single screenshot, save it to file and quit");
Option & argAddress = parser.add<Option> ('a', "address", "Set the address of the hyperion server [default: %1]", "127.0.0.1:19445"); Option & argAddress = parser.add<Option> ('a', "address", "Set the address of the hyperion server [default: %1]", "127.0.0.1:19445");
IntOption & argPriority = parser.add<IntOption> ('p', "priority", "Use the provided priority channel (the lower the number, the higher the priority) [default: %1]", "800"); IntOption & argPriority = parser.add<IntOption> ('p', "priority", "Use the provided priority channel (the lower the number, the higher the priority) [default: %1]", "800");
BooleanOption & argSkipReply = parser.add<BooleanOption> (0x0, "skip-reply", "Do not receive and check reply messages from Hyperion"); BooleanOption & argSkipReply = parser.add<BooleanOption>(0x0, "skip-reply", "Do not receive and check reply messages from Hyperion");
BooleanOption & argHelp = parser.add<BooleanOption> ('h', "help", "Show this help message and exit"); BooleanOption & argHelp = parser.add<BooleanOption>('h', "help", "Show this help message and exit");
// parse all options // parse all options
parser.process(app); parser.process(app);

View File

@ -27,15 +27,15 @@ int main(int argc, char ** argv)
// create the option parser and initialize all parameters // create the option parser and initialize all parameters
Parser parser("OSX capture application for Hyperion"); Parser parser("OSX capture application for Hyperion");
Option & argDisplay = parser.add<Option> ('d', "display", "Set the display to capture [default: %1]"); Option & argDisplay = parser.add<Option> ('d', "display", "Set the display to capture [default: %1]");
IntOption & argFps = parser.add<IntOption> ('f', "framerate", "Capture frame rate [default: %1]", "10", 1, 600); IntOption & argFps = parser.add<IntOption> ('f', "framerate", "Capture frame rate [default: %1]", "10", 1, 600);
IntOption & argWidth = parser.add<IntOption> (0x0, "width", "Width of the captured image [default: %1]", "160", 160, 4096); IntOption & argWidth = parser.add<IntOption> (0x0, "width", "Width of the captured image [default: %1]", "160", 160, 4096);
IntOption & argHeight = parser.add<IntOption> (0x0, "height", "Height of the captured image [default: %1]", "160", 160, 4096); IntOption & argHeight = parser.add<IntOption> (0x0, "height", "Height of the captured image [default: %1]", "160", 160, 4096);
BooleanOption & argScreenshot = parser.add<BooleanOption> (0x0, "screenshot", "Take a single screenshot, save it to file and quit"); BooleanOption & argScreenshot = parser.add<BooleanOption>(0x0, "screenshot", "Take a single screenshot, save it to file and quit");
Option & argAddress = parser.add<Option> ('a', "address", "Set the address of the hyperion server [default: %1]", "127.0.0.1:19445"); Option & argAddress = parser.add<Option> ('a', "address", "Set the address of the hyperion server [default: %1]", "127.0.0.1:19445");
IntOption & argPriority = parser.add<IntOption> ('p', "priority", "Use the provided priority channel (the lower the number, the higher the priority) [default: %1]", "800"); IntOption & argPriority = parser.add<IntOption> ('p', "priority", "Use the provided priority channel (the lower the number, the higher the priority) [default: %1]", "800");
BooleanOption & argSkipReply = parser.add<BooleanOption> (0x0, "skip-reply", "Do not receive and check reply messages from Hyperion"); BooleanOption & argSkipReply = parser.add<BooleanOption>(0x0, "skip-reply", "Do not receive and check reply messages from Hyperion");
BooleanOption & argHelp = parser.add<BooleanOption> ('h', "help", "Show this help message and exit"); BooleanOption & argHelp = parser.add<BooleanOption>('h', "help", "Show this help message and exit");
// parse all arguments // parse all arguments
parser.process(app); parser.process(app);

View File

@ -55,46 +55,46 @@ int main(int argc, char * argv[])
// create the option parser and initialize all parameters // create the option parser and initialize all parameters
Parser parser("Simple application to send a command to hyperion using the Json interface"); Parser parser("Simple application to send a command to hyperion using the Json interface");
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]", "localhost:19444");
IntOption & argPriority = parser.add<IntOption> ('p', "priority" , "Use to the provided priority channel (the lower the number, the higher the priority) [default: %1]", "100"); IntOption & argPriority = parser.add<IntOption> ('p', "priority" , "Use to the provided priority channel (the lower the number, the higher the priority) [default: %1]", "100");
IntOption & argDuration = parser.add<IntOption> ('d', "duration" , "Specify how long the leds should be switched on in milliseconds [default: infinity]"); IntOption & argDuration = parser.add<IntOption> ('d', "duration" , "Specify how long the leds should be switched on in milliseconds [default: infinity]");
ColorsOption & argColor = parser.add<ColorsOption> ('c', "color" , "Set all leds to a constant color (either RRGGBB hex getColors or a color name. The color may be repeated multiple time like: RRGGBBRRGGBB)"); ColorsOption & argColor = parser.add<ColorsOption> ('c', "color" , "Set all leds to a constant color (either RRGGBB hex getColors or a color name. The color may be repeated multiple time like: RRGGBBRRGGBB)");
ImageOption & argImage = parser.add<ImageOption> ('i', "image" , "Set the leds to the colors according to the given image file"); ImageOption & argImage = parser.add<ImageOption> ('i', "image" , "Set the leds to the colors according to the given image file");
Option & argEffect = parser.add<Option> ('e', "effect" , "Enable the effect with the given name"); Option & argEffect = parser.add<Option> ('e', "effect" , "Enable the effect with the given name");
Option & argEffectArgs = parser.add<Option> (0x0, "effectArgs", "Arguments to use in combination with the specified effect. Should be a Json object string.", ""); Option & argEffectArgs = parser.add<Option> (0x0, "effectArgs", "Arguments to use in combination with the specified effect. Should be a Json object string.", "");
BooleanOption & argServerInfo = parser.add<BooleanOption> ('l', "list" , "List server info and active effects with priority and duration"); BooleanOption & argServerInfo = parser.add<BooleanOption>('l', "list" , "List server info and active effects with priority and duration");
BooleanOption & argClear = parser.add<BooleanOption> ('x', "clear" , "Clear data for the priority channel provided by the -p option"); BooleanOption & argClear = parser.add<BooleanOption>('x', "clear" , "Clear data for the priority channel provided by the -p option");
BooleanOption & argClearAll = parser.add<BooleanOption> (0x0, "clearall" , "Clear data for all active priority channels"); BooleanOption & argClearAll = parser.add<BooleanOption>(0x0, "clearall" , "Clear data for all active priority channels");
Option & argEnableComponent = parser.add<Option> ('E', "enable" , "Enable the Component with the given name. Available Components are [SMOOTHING, BLACKBORDER, KODICHECKER, FORWARDER, UDPLISTENER, BOBLIGHT_SERVER, GRABBER, V4L]"); Option & argEnableComponent = parser.add<Option> ('E', "enable" , "Enable the Component with the given name. Available Components are [SMOOTHING, BLACKBORDER, KODICHECKER, FORWARDER, UDPLISTENER, BOBLIGHT_SERVER, GRABBER, V4L]");
Option & argDisableComponent = parser.add<Option> ('D', "disable" , "Disable the Component with the given name. Available Components are [SMOOTHING, BLACKBORDER, KODICHECKER, FORWARDER, UDPLISTENER, BOBLIGHT_SERVER, GRABBER, V4L]"); Option & argDisableComponent = parser.add<Option> ('D', "disable" , "Disable the Component with the given name. Available Components are [SMOOTHING, BLACKBORDER, KODICHECKER, FORWARDER, UDPLISTENER, BOBLIGHT_SERVER, GRABBER, V4L]");
Option & argId = parser.add<Option> ('q', "qualifier" , "Identifier(qualifier) of the transform to set"); Option & argId = parser.add<Option> ('q', "qualifier" , "Identifier(qualifier) of the transform to set");
DoubleOption & argSaturation = parser.add<DoubleOption> ('s', "saturation", "!DEPRECATED! Will be removed soon! Set the HSV saturation gain of the leds"); DoubleOption & argSaturation = parser.add<DoubleOption> ('s', "saturation", "!DEPRECATED! Will be removed soon! Set the HSV saturation gain of the leds");
DoubleOption & argValue = parser.add<DoubleOption> ('v', "getColors" , "!DEPRECATED! Will be removed soon! Set the HSV getColors gain of the leds"); DoubleOption & argValue = parser.add<DoubleOption> ('v', "getColors" , "!DEPRECATED! Will be removed soon! Set the HSV getColors gain of the leds");
DoubleOption & argSaturationL = parser.add<DoubleOption> ('u', "saturationL", "Set the HSL saturation gain of the leds"); DoubleOption & argSaturationL = parser.add<DoubleOption> ('u', "saturationL", "Set the HSL saturation gain of the leds");
DoubleOption & argLuminance = parser.add<DoubleOption> ('m', "luminance" , "Set the HSL luminance gain of the leds"); DoubleOption & argLuminance = parser.add<DoubleOption> ('m', "luminance" , "Set the HSL luminance gain of the leds");
DoubleOption & argLuminanceMin= parser.add<DoubleOption> ('n', "luminanceMin" , "Set the HSL luminance minimum of the leds (backlight)"); DoubleOption & argLuminanceMin= parser.add<DoubleOption> ('n', "luminanceMin" , "Set the HSL luminance minimum of the leds (backlight)");
ColorOption & argGamma = parser.add<ColorOption>('g', "gamma" , "Set the gamma of the leds (requires colors in hex format as RRGGBB)"); ColorOption & argGamma = parser.add<ColorOption> ('g', "gamma" , "Set the gamma of the leds (requires colors in hex format as RRGGBB)");
ColorOption & argThreshold = parser.add<ColorOption>('t', "threshold" , "Set the threshold of the leds (requires colors in hex format as RRGGBB)"); ColorOption & argThreshold = parser.add<ColorOption> ('t', "threshold" , "Set the threshold of the leds (requires colors in hex format as RRGGBB)");
ColorOption & argBlacklevel = parser.add<ColorOption>('b', "blacklevel", "!DEPRECATED! Will be removed soon! Set the blacklevel of the leds (requires colors in hex format as RRGGBB which are normally between 0.0 and 1.0)"); ColorOption & argBlacklevel = parser.add<ColorOption> ('b', "blacklevel", "!DEPRECATED! Will be removed soon! Set the blacklevel of the leds (requires colors in hex format as RRGGBB which are normally between 0.0 and 1.0)");
ColorOption & argWhitelevel = parser.add<ColorOption>('w', "whitelevel", "!DEPRECATED! Will be removed soon! Set the whitelevel of the leds (requires colors in hex format as RRGGBB which are normally between 0.0 and 1.0)"); ColorOption & argWhitelevel = parser.add<ColorOption> ('w', "whitelevel", "!DEPRECATED! Will be removed soon! Set the whitelevel of the leds (requires colors in hex format as RRGGBB which are normally between 0.0 and 1.0)");
BooleanOption & argPrint = parser.add<BooleanOption>(0x0, "print" , "Print the json input and output messages on stdout"); BooleanOption & argPrint = parser.add<BooleanOption>(0x0, "print" , "Print the json input and output messages on stdout");
BooleanOption & argHelp = parser.add<BooleanOption>('h', "help" , "Show this help message and exit"); BooleanOption & argHelp = parser.add<BooleanOption>('h', "help" , "Show this help message and exit");
Option & argIdC = parser.add<Option> ('y', "qualifier-c" , "!DEPRECATED! Will be removed soon! Identifier(qualifier) of the correction to set"); Option & argIdC = parser.add<Option> ('y', "qualifier-c" , "!DEPRECATED! Will be removed soon! Identifier(qualifier) of the correction to set");
ColorOption & argCorrection = parser.add<ColorOption>('Y', "correction" , "!DEPRECATED! Will be removed soon! Set the correction of the leds (requires colors in hex format as RRGGBB)"); ColorOption & argCorrection = parser.add<ColorOption> ('Y', "correction" , "!DEPRECATED! Will be removed soon! Set the correction of the leds (requires colors in hex format as RRGGBB)");
Option & argIdT = parser.add<Option> ('z', "qualifier-t" , "Identifier(qualifier) of the temperature correction to set"); Option & argIdT = parser.add<Option> ('z', "qualifier-t" , "Identifier(qualifier) of the temperature correction to set");
ColorOption & argTemperature= parser.add<ColorOption>('Z', "temperature" , "Set the temperature correction of the leds (requires colors in hex format as RRGGBB)"); ColorOption & argTemperature = parser.add<ColorOption> ('Z', "temperature" , "Set the temperature correction of the leds (requires colors in hex format as RRGGBB)");
Option & argIdA = parser.add<Option> ('j', "qualifier-a" , "Identifier(qualifier) of the adjustment to set"); Option & argIdA = parser.add<Option> ('j', "qualifier-a" , "Identifier(qualifier) of the adjustment to set");
ColorOption & argRAdjust = parser.add<ColorOption>('R', "redAdjustment" , "Set the adjustment of the red color (requires colors in hex format as RRGGBB)"); ColorOption & argRAdjust = parser.add<ColorOption> ('R', "redAdjustment" , "Set the adjustment of the red color (requires colors in hex format as RRGGBB)");
ColorOption & argGAdjust = parser.add<ColorOption>('G', "greenAdjustment", "Set the adjustment of the green color (requires colors in hex format as RRGGBB)"); ColorOption & argGAdjust = parser.add<ColorOption> ('G', "greenAdjustment", "Set the adjustment of the green color (requires colors in hex format as RRGGBB)");
ColorOption & argBAdjust = parser.add<ColorOption>('B', "blueAdjustment", "Set the adjustment of the blue color (requires colors in hex format as RRGGBB)"); ColorOption & argBAdjust = parser.add<ColorOption> ('B', "blueAdjustment", "Set the adjustment of the blue color (requires colors in hex format as RRGGBB)");
IntOption & argSource = parser.add<IntOption> (0x0, "sourceSelect" , "Set current active priority channel and deactivate auto source switching"); IntOption & argSource = parser.add<IntOption> (0x0, "sourceSelect" , "Set current active priority channel and deactivate auto source switching");
BooleanOption & argSourceAuto = parser.add<BooleanOption>(0x0, "sourceAutoSelect", "Enables auto source, if disabled prio by manual selecting input source"); BooleanOption & argSourceAuto = parser.add<BooleanOption>(0x0, "sourceAutoSelect", "Enables auto source, if disabled prio by manual selecting input source");
BooleanOption & argSourceOff = parser.add<BooleanOption>(0x0, "sourceOff", "select no source, this results in leds activly set to black (=off)"); BooleanOption & argSourceOff = parser.add<BooleanOption>(0x0, "sourceOff", "select no source, this results in leds activly set to black (=off)");
BooleanOption & argConfigGet = parser.add<BooleanOption>(0x0, "configGet" , "Print the current loaded Hyperion configuration file"); BooleanOption & argConfigGet = parser.add<BooleanOption>(0x0, "configGet" , "Print the current loaded Hyperion configuration file");
Option & argSchemaGet = parser.add<Option>(0x0, "schemaGet" , "Print the json schema for Hyperion configuration"); Option & argSchemaGet = parser.add<Option> (0x0, "schemaGet" , "Print the json schema for Hyperion configuration");
Option & argConfigSet = parser.add<Option>('W', "configSet", "Write to the actual loaded configuration file. Should be a Json object string."); Option & argConfigSet = parser.add<Option> ('W', "configSet", "Write to the actual loaded configuration file. Should be a Json object string.");
Option & argCreate = parser.add<Option>(0x0, "createkeys", "Create non exist Json Entry(s) in the actual loaded configuration file. Argument to use in combination with configSet."); Option & argCreate = parser.add<Option> (0x0, "createkeys", "Create non exist Json Entry(s) in the actual loaded configuration file. Argument to use in combination with configSet.");
Option & argOverwriteConfig = parser.add<Option>(0x0, "overwrite", "Overwrite the actual loaded configuration file with the Json object string from configSet. Argument to use in combination with configSet."); Option & argOverwriteConfig = parser.add<Option> (0x0, "overwrite", "Overwrite the actual loaded configuration file with the Json object string from configSet. Argument to use in combination with configSet.");
// parse all _options // parse all _options
parser.process(app); parser.process(app);

View File

@ -53,31 +53,31 @@ int main(int argc, char** argv)
// create the option parser and initialize all parameters // create the option parser and initialize all parameters
Parser parser("V4L capture application for Hyperion"); Parser parser("V4L capture application for Hyperion");
Option & argDevice = parser.add<Option> ('d', "device", "The device to use [default: %1]", "/dev/video0"); Option & argDevice = parser.add<Option> ('d', "device", "The device to use [default: %1]", "auto");
SwitchOption<VideoStandard> & argVideoStandard = parser.add<SwitchOption<VideoStandard>>('v', "video-standard", "The used video standard. Valid values are PAL, NTSC or no-change. [default: %1]", "no-change"); SwitchOption<VideoStandard> & argVideoStandard= parser.add<SwitchOption<VideoStandard>>('v', "video-standard", "The used video standard. Valid values are PAL, NTSC or no-change. [default: %1]", "no-change");
SwitchOption<PixelFormat> & argPixelFormat = parser.add<SwitchOption<PixelFormat>> (0x0, "pixel-format", "The use pixel format. Valid values are YUYV, UYVY, RGB32 or no-change. [default: %1]", "no-change"); SwitchOption<PixelFormat> & argPixelFormat = parser.add<SwitchOption<PixelFormat>> (0x0, "pixel-format", "The use pixel format. Valid values are YUYV, UYVY, RGB32 or no-change. [default: %1]", "no-change");
IntOption & argInput = parser.add<IntOption> (0x0, "input", "Input channel (optional)", "-1"); IntOption & argInput = parser.add<IntOption> (0x0, "input", "Input channel (optional)", "-1");
IntOption & argWidth = parser.add<IntOption> (0x0, "width", "Try to set the width of the video input [default: %1]", "-1"); IntOption & argWidth = parser.add<IntOption> (0x0, "width", "Try to set the width of the video input [default: %1]", "-1");
IntOption & argHeight = parser.add<IntOption> (0x0, "height", "Try to set the height of the video input [default: %1]", "-1"); IntOption & argHeight = parser.add<IntOption> (0x0, "height", "Try to set the height of the video input [default: %1]", "-1");
IntOption & argCropWidth = parser.add<IntOption> (0x0, "crop-width", "Number of pixels to crop from the left and right sides of the picture before decimation [default: %1]", "0"); IntOption & argCropWidth = parser.add<IntOption> (0x0, "crop-width", "Number of pixels to crop from the left and right sides of the picture before decimation [default: %1]", "0");
IntOption & argCropHeight = parser.add<IntOption> (0x0, "crop-height", "Number of pixels to crop from the top and the bottom of the picture before decimation [default: %1]", "0"); IntOption & argCropHeight = parser.add<IntOption> (0x0, "crop-height", "Number of pixels to crop from the top and the bottom of the picture before decimation [default: %1]", "0");
IntOption & argCropLeft = parser.add<IntOption> (0x0, "crop-left", "Number of pixels to crop from the left of the picture before decimation (overrides --crop-width)"); IntOption & argCropLeft = parser.add<IntOption> (0x0, "crop-left", "Number of pixels to crop from the left of the picture before decimation (overrides --crop-width)");
IntOption & argCropRight = parser.add<IntOption> (0x0, "crop-right", "Number of pixels to crop from the right of the picture before decimation (overrides --crop-width)"); IntOption & argCropRight = parser.add<IntOption> (0x0, "crop-right", "Number of pixels to crop from the right of the picture before decimation (overrides --crop-width)");
IntOption & argCropTop = parser.add<IntOption> (0x0, "crop-top", "Number of pixels to crop from the top of the picture before decimation (overrides --crop-height)"); IntOption & argCropTop = parser.add<IntOption> (0x0, "crop-top", "Number of pixels to crop from the top of the picture before decimation (overrides --crop-height)");
IntOption & argCropBottom = parser.add<IntOption> (0x0, "crop-bottom", "Number of pixels to crop from the bottom of the picture before decimation (overrides --crop-height)"); IntOption & argCropBottom = parser.add<IntOption> (0x0, "crop-bottom", "Number of pixels to crop from the bottom of the picture before decimation (overrides --crop-height)");
IntOption & argSizeDecimation = parser.add<IntOption> ('s', "size-decimator", "Decimation factor for the output size [default=%1]", "1"); IntOption & argSizeDecimation = parser.add<IntOption> ('s', "size-decimator", "Decimation factor for the output size [default=%1]", "1");
IntOption & argFrameDecimation = parser.add<IntOption> ('f', "frame-decimator", "Decimation factor for the video frames [default=%1]", "1"); IntOption & argFrameDecimation = parser.add<IntOption> ('f', "frame-decimator", "Decimation factor for the video frames [default=%1]", "1");
BooleanOption & argScreenshot = parser.add<BooleanOption> (0x0, "screenshot", "Take a single screenshot, save it to file and quit"); BooleanOption & argScreenshot = parser.add<BooleanOption>(0x0, "screenshot", "Take a single screenshot, save it to file and quit");
DoubleOption & argSignalThreshold = parser.add<DoubleOption> ('t', "signal-threshold", "The signal threshold for detecting the presence of a signal. Value should be between 0.0 and 1.0.", QString(), 0.0, 1.0); DoubleOption & argSignalThreshold = parser.add<DoubleOption> ('t', "signal-threshold", "The signal threshold for detecting the presence of a signal. Value should be between 0.0 and 1.0.", QString(), 0.0, 1.0);
DoubleOption & argRedSignalThreshold = parser.add<DoubleOption> (0x0, "red-threshold", "The red signal threshold. Value should be between 0.0 and 1.0. (overrides --signal-threshold)"); DoubleOption & argRedSignalThreshold = parser.add<DoubleOption> (0x0, "red-threshold", "The red signal threshold. Value should be between 0.0 and 1.0. (overrides --signal-threshold)");
DoubleOption & argGreenSignalThreshold = parser.add<DoubleOption> (0x0, "green-threshold", "The green signal threshold. Value should be between 0.0 and 1.0. (overrides --signal-threshold)"); DoubleOption & argGreenSignalThreshold= parser.add<DoubleOption> (0x0, "green-threshold", "The green signal threshold. Value should be between 0.0 and 1.0. (overrides --signal-threshold)");
DoubleOption & argBlueSignalThreshold = parser.add<DoubleOption> (0x0, "blue-threshold", "The blue signal threshold. Value should be between 0.0 and 1.0. (overrides --signal-threshold)"); DoubleOption & argBlueSignalThreshold = parser.add<DoubleOption> (0x0, "blue-threshold", "The blue signal threshold. Value should be between 0.0 and 1.0. (overrides --signal-threshold)");
BooleanOption & arg3DSBS = parser.add<BooleanOption> (0x0, "3DSBS", "Interpret the incoming video stream as 3D side-by-side"); BooleanOption & arg3DSBS = parser.add<BooleanOption>(0x0, "3DSBS", "Interpret the incoming video stream as 3D side-by-side");
BooleanOption & arg3DTAB = parser.add<BooleanOption> (0x0, "3DTAB", "Interpret the incoming video stream as 3D top-and-bottom"); BooleanOption & arg3DTAB = parser.add<BooleanOption>(0x0, "3DTAB", "Interpret the incoming video stream as 3D top-and-bottom");
Option & argAddress = parser.add<Option> ('a', "address", "Set the address of the hyperion server [default: %1]", "127.0.0.1:19445"); Option & argAddress = parser.add<Option> ('a', "address", "Set the address of the hyperion server [default: %1]", "127.0.0.1:19445");
IntOption & argPriority = parser.add<IntOption> ('p', "priority", "Use the provided priority channel (the lower the number, the higher the priority) [default: %1]", "800"); IntOption & argPriority = parser.add<IntOption> ('p', "priority", "Use the provided priority channel (the lower the number, the higher the priority) [default: %1]", "800");
BooleanOption & argSkipReply = parser.add<BooleanOption> (0x0, "skip-reply", "Do not receive and check reply messages from Hyperion"); BooleanOption & argSkipReply = parser.add<BooleanOption>(0x0, "skip-reply", "Do not receive and check reply messages from Hyperion");
BooleanOption & argHelp = parser.add<BooleanOption> ('h', "help", "Show this help message and exit"); BooleanOption & argHelp = parser.add<BooleanOption>('h', "help", "Show this help message and exit");
argVideoStandard.addSwitch("pal", VIDEOSTANDARD_PAL); argVideoStandard.addSwitch("pal", VIDEOSTANDARD_PAL);
argVideoStandard.addSwitch("ntsc", VIDEOSTANDARD_NTSC); argVideoStandard.addSwitch("ntsc", VIDEOSTANDARD_NTSC);

View File

@ -32,20 +32,20 @@ int main(int argc, char ** argv)
// create the option parser and initialize all parameters // create the option parser and initialize all parameters
Parser parser("X11 capture application for Hyperion"); Parser parser("X11 capture application for Hyperion");
IntOption & argFps = parser.add<IntOption> ('f', "framerate", "Capture frame rate [default: %1]", "10"); IntOption & argFps = parser.add<IntOption> ('f', "framerate", "Capture frame rate [default: %1]", "10");
BooleanOption & argXGetImage = parser.add<BooleanOption> ('x', "xgetimage", "Use XGetImage instead of XRender"); BooleanOption & argXGetImage = parser.add<BooleanOption>('x', "xgetimage", "Use XGetImage instead of XRender");
IntOption & argCropWidth = parser.add<IntOption> (0x0, "crop-width", "Number of pixels to crop from the left and right sides of the picture before decimation [default: %1]", "0"); IntOption & argCropWidth = parser.add<IntOption> (0x0, "crop-width", "Number of pixels to crop from the left and right sides of the picture before decimation [default: %1]", "0");
IntOption & argCropHeight = parser.add<IntOption> (0x0, "crop-height", "Number of pixels to crop from the top and the bottom of the picture before decimation [default: %1]", "0"); IntOption & argCropHeight = parser.add<IntOption> (0x0, "crop-height", "Number of pixels to crop from the top and the bottom of the picture before decimation [default: %1]", "0");
IntOption & argCropLeft = parser.add<IntOption> (0x0, "crop-left", "Number of pixels to crop from the left of the picture before decimation (overrides --crop-width)"); IntOption & argCropLeft = parser.add<IntOption> (0x0, "crop-left", "Number of pixels to crop from the left of the picture before decimation (overrides --crop-width)");
IntOption & argCropRight = parser.add<IntOption> (0x0, "crop-right", "Number of pixels to crop from the right of the picture before decimation (overrides --crop-width)"); IntOption & argCropRight = parser.add<IntOption> (0x0, "crop-right", "Number of pixels to crop from the right of the picture before decimation (overrides --crop-width)");
IntOption & argCropTop = parser.add<IntOption> (0x0, "crop-top", "Number of pixels to crop from the top of the picture before decimation (overrides --crop-height)"); IntOption & argCropTop = parser.add<IntOption> (0x0, "crop-top", "Number of pixels to crop from the top of the picture before decimation (overrides --crop-height)");
IntOption & argCropBottom = parser.add<IntOption> (0x0, "crop-bottom", "Number of pixels to crop from the bottom of the picture before decimation (overrides --crop-height)"); IntOption & argCropBottom = parser.add<IntOption> (0x0, "crop-bottom", "Number of pixels to crop from the bottom of the picture before decimation (overrides --crop-height)");
IntOption & argSizeDecimation = parser.add<IntOption> ('s', "size-decimator", "Decimation factor for the output size [default=%1]", "8"); IntOption & argSizeDecimation = parser.add<IntOption> ('s', "size-decimator", "Decimation factor for the output size [default=%1]", "8");
BooleanOption & argScreenshot = parser.add<BooleanOption> (0x0, "screenshot", "Take a single screenshot, save it to file and quit"); BooleanOption & argScreenshot = parser.add<BooleanOption>(0x0, "screenshot", "Take a single screenshot, save it to file and quit");
Option & argAddress = parser.add<Option> ('a', "address", "Set the address of the hyperion server [default: %1]", "127.0.0.1:19445"); Option & argAddress = parser.add<Option> ('a', "address", "Set the address of the hyperion server [default: %1]", "127.0.0.1:19445");
IntOption & argPriority = parser.add<IntOption> ('p', "priority", "Use the provided priority channel (the lower the number, the higher the priority) [default: %1]", "800"); IntOption & argPriority = parser.add<IntOption> ('p', "priority", "Use the provided priority channel (the lower the number, the higher the priority) [default: %1]", "800");
BooleanOption & argSkipReply = parser.add<BooleanOption> (0x0, "skip-reply", "Do not receive and check reply messages from Hyperion"); BooleanOption & argSkipReply = parser.add<BooleanOption>(0x0, "skip-reply", "Do not receive and check reply messages from Hyperion");
BooleanOption & argHelp = parser.add<BooleanOption> ('h', "help", "Show this help message and exit"); BooleanOption & argHelp = parser.add<BooleanOption>('h', "help", "Show this help message and exit");
// parse all options // parse all options
parser.process(app); parser.process(app);

View File

@ -41,5 +41,3 @@ endif ()
install ( TARGETS hyperiond DESTINATION "share/hyperion/bin/" COMPONENT "${PLATFORM}" ) install ( TARGETS hyperiond DESTINATION "share/hyperion/bin/" COMPONENT "${PLATFORM}" )
install ( DIRECTORY ${CMAKE_SOURCE_DIR}/bin/service DESTINATION "share/hyperion/" COMPONENT "${PLATFORM}" ) install ( DIRECTORY ${CMAKE_SOURCE_DIR}/bin/service DESTINATION "share/hyperion/" COMPONENT "${PLATFORM}" )
install ( DIRECTORY ${CMAKE_SOURCE_DIR}/config DESTINATION "share/hyperion/" COMPONENT "${PLATFORM}" )
install ( DIRECTORY ${CMAKE_SOURCE_DIR}/assets/webconfig DESTINATION "share/hyperion/" COMPONENT "${PLATFORM}" )

View File

@ -13,6 +13,9 @@
#include <QLocale> #include <QLocale>
#include <QFile> #include <QFile>
#include <QString> #include <QString>
#include <QResource>
#include <QDir>
#include <QStringList>
#include "HyperionConfig.h" #include "HyperionConfig.h"
@ -66,11 +69,14 @@ int main(int argc, char** argv)
Parser parser("Hyperion Daemon"); Parser parser("Hyperion Daemon");
parser.addHelpOption(); parser.addHelpOption();
BooleanOption & versionOption = parser.add<BooleanOption>(0x0, "version", "Show version information"); BooleanOption & versionOption = parser.add<BooleanOption>(0x0, "version", "Show version information");
IntOption & parentOption = parser.add<IntOption>('p', "parent", "pid of parent hyperiond"); // 2^22 is the max for Linux IntOption & parentOption = parser.add<IntOption> ('p', "parent", "pid of parent hyperiond"); // 2^22 is the max for Linux
BooleanOption & silentOption = parser.add<BooleanOption>('s', "silent", "do not print any outputs"); BooleanOption & silentOption = parser.add<BooleanOption>('s', "silent", "do not print any outputs");
BooleanOption & verboseOption = parser.add<BooleanOption>('v', "verbose", "Increase verbosity"); BooleanOption & verboseOption = parser.add<BooleanOption>('v', "verbose", "Increase verbosity");
BooleanOption & debugOption = parser.add<BooleanOption>('d', "debug", "Show debug messages"); BooleanOption & debugOption = parser.add<BooleanOption>('d', "debug", "Show debug messages");
Option & exportConfigOption = parser.add<Option> (0x0, "export-config", "export default config to file");
Option & exportEfxOption = parser.add<Option> (0x0, "export-effects", "export effects to given path");
parser.addPositionalArgument("config-files", QCoreApplication::translate("main", "Configuration files"), "[files...]"); parser.addPositionalArgument("config-files", QCoreApplication::translate("main", "Configuration files"), "[files...]");
parser.process(app); parser.process(app);
@ -112,6 +118,54 @@ int main(int argc, char** argv)
return 0; return 0;
} }
if (parser.isSet(exportConfigOption))
{
Q_INIT_RESOURCE(resource);
if (QFile::copy(":/hyperion_default.config",exportConfigOption.value(parser)))
{
Info(log, "export complete.");
return 0;
}
Error(log, "can not export to %s",exportConfigOption.getCString(parser));
return 1;
}
if (parser.isSet(exportEfxOption))
{
Q_INIT_RESOURCE(EffectEngine);
QDir directory(":/effects/");
QDir destDir(exportEfxOption.value(parser));
if (directory.exists() && destDir.exists())
{
std::cout << "extract to folder: " << std::endl;
QStringList filenames = directory.entryList(QStringList() << "*.json", QDir::Files, QDir::Name | QDir::IgnoreCase);
foreach (const QString & filename, filenames)
{
if (QFile::exists(destDir.dirName()+"/"+filename))
{
QFile::remove(destDir.dirName()+"/"+filename);
}
std::cout << "Extract: " << filename.toStdString() << " ... ";
if (QFile::copy(QString(":/effects/")+filename, destDir.dirName()+"/"+filename))
{
std::cout << "ok" << std::endl;
}
else
{
std::cout << "error, aborting" << std::endl;
return 1;
}
}
return 0;
}
Error(log, "can not export to %s",exportEfxOption.getCString(parser));
return 1;
}
if (configFiles.size() == 0) if (configFiles.size() == 0)
{ {
Error(log, "Missing required configuration file. Usage: hyperiond <options ...> [config.file ...]"); Error(log, "Missing required configuration file. Usage: hyperiond <options ...> [config.file ...]");
@ -139,7 +193,7 @@ int main(int argc, char** argv)
if ( argvId < 0) if ( argvId < 0)
{ {
Error(log, "No valid config found"); Warning(log, "No valid config found");
return 1; return 1;
} }