Go to the documentation of this file. 1 #include "libmythbase/mythconfig.h"
2 #if CONFIG_SYSTEMD_NOTIFY
3 #include <systemd/sd-daemon.h>
11 #include <QCoreApplication>
13 #include <QApplication>
21 #include <QProcessEnvironment>
33 #include "libmythbase/mythversion.h"
55 #define LOC QString("MythBackend: ")
56 #define LOC_WARN QString("MythBackend, Warning: ")
57 #define LOC_ERR QString("MythBackend, Error: ")
66 int main(
int argc,
char **argv)
88 for (
long i =
UNUSED_FILENO; i < sysconf(_SC_OPEN_MAX) - 1; ++i)
90 QCoreApplication a(argc, argv);
94 QApplication a(argc, argv);
99 QString path = QCoreApplication::applicationDirPath();
101 QString(
"%1/../Resources/lib/%2/site-packages:%3")
103 .arg(QFileInfo(PYTHON_EXE).fileName())
104 .arg(QProcessEnvironment::systemEnvironment().value(
"PYTHONPATH"))
105 .toUtf8().constData(), 1);
114 QString mask(
"general");
128 #if CONFIG_SYSTEMD_NOTIFY
129 (void)sd_notify(0,
"STATUS=Connecting to database.");
134 LOG(VB_GENERAL, LOG_CRIT,
"Failed to init MythContext.");
159 #ifdef _WIN32 // TODO Needs fixing for Windows
void setHttpProxy(void)
Get network proxy settings from OS, and use for [Q]Http[Comms].
MythCommFlagCommandLineParser cmdline
QString GetPlaybackURL(ProgramInfo *pginfo, bool storePath)
Startup context for MythTV.
#define LOG(_MASK_, _LEVEL_, _QSTRING_)
int main(int argc, char **argv)
@ GENERIC_EXIT_OK
Exited with no error.
virtual bool Parse(int argc, const char *const *argv)
Loop through argv and populate arguments with values.
@ GENERIC_EXIT_NO_MYTHCONTEXT
No MythContext available.
static constexpr const char * MYTH_APPNAME_MYTHBACKEND
static void PrintVersion(void)
Print application version information.
void PrintHelp(void) const
Print command line option help.
int Daemonize(void) const
Fork application into background, and detatch from terminal.
MythCoreContext * gCoreContext
This global variable contains the MythCoreContext instance for the app.
void ApplySettingsOverride(void)
Apply all overrides to the global context.
static QString cleanup(const QString &str)
static void Init(QObject *parent=nullptr)
Holds information on recordings and videos.
QString toString(const QString &key) const
Returns stored QVariant as a QString, falling to default if not provided.
bool toBool(const QString &key) const
Returns stored QVariant as a boolean.
int handle_command(const MythBackendCommandLineParser &cmdline)
static constexpr long UNUSED_FILENO
int ConfigureLogging(const QString &mask="general", bool progress=false)
Read in logging options and initialize the logging interface.
static void load(const QString &module_name)
Load a QTranslator for the user's preferred language.
@ GENERIC_EXIT_INVALID_CMDLINE
Command line parse error.
int run_backend(MythBackendCommandLineParser &cmdline)
void SetAsBackend(bool backend)
MythContext * gContext
This global variable contains the MythContext instance for the application.
bool Init(bool gui=true, bool promptForBackend=false, bool disableAutoDiscovery=false, bool ignoreDB=false)