16#include <QCoreApplication>
28#include "libmythbase/mythversion.h"
35int main(
int argc,
char **argv)
37 int special_port = -1;
38 QString startup_message =
"";
39 std::chrono::seconds message_time = 30s;
63 QCoreApplication a(argc, argv);
71 QString mask(
"general");
79 if (special_port < 1 || special_port > 65534)
81 LOG(VB_GENERAL, LOG_ERR,
"lcdserver: Bad port number");
89 message_time = std::chrono::seconds(
cmdline.
toInt(
"messagetime"));
90 if (message_time < 1s || message_time > 1000s)
92 LOG(VB_GENERAL, LOG_ERR,
"lcdserver: Bad message duration");
99 if (debug_level < 0 || debug_level > 10)
101 LOG(VB_GENERAL, LOG_ERR,
"lcdserver: Bad debug level");
108 if (!context.Init(
false))
110 LOG(VB_GENERAL, LOG_ERR,
111 "lcdserver: Could not initialize MythContext. Exiting.");
121 if (special_port > 0)
123 assigned_port = special_port;
126 auto *server =
new LCDServer(assigned_port, startup_message, message_time);
128 QCoreApplication::exec();
bool toBool(const QString &key) const
Returns stored QVariant as a boolean.
int toInt(const QString &key) const
Returns stored QVariant as an integer, falling to default if not provided.
virtual bool Parse(int argc, const char *const *argv)
Loop through argv and populate arguments with values.
int Daemonize(void) const
Fork application into background, and detatch from terminal.
int ConfigureLogging(const QString &mask="general", bool progress=false)
Read in logging options and initialize the logging interface.
QString toString(const QString &key) const
Returns stored QVariant as a QString, falling to default if not provided.
static void PrintVersion(void)
Print application version information.
void PrintHelp(void) const
Print command line option help.
Startup context for MythTV.
bool ConnectToMasterServer(bool blockingClient=true, bool openEventSocket=true)
int GetNumSetting(const QString &key, int defaultval=0)
static void load(const QString &module_name)
Load a QTranslator for the user's preferred language.
@ GENERIC_EXIT_NO_MYTHCONTEXT
No MythContext available.
@ GENERIC_EXIT_OK
Exited with no error.
@ GENERIC_EXIT_INVALID_CMDLINE
Command line parse error.
static constexpr const char * MYTH_APPNAME_MYTHLCDSERVER
MythCoreContext * gCoreContext
This global variable contains the MythCoreContext instance for the app.
int main(int argc, char **argv)
#define LOG(_MASK_, _LEVEL_, _QSTRING_)
MythCommFlagCommandLineParser cmdline