28#include "libmythbase/mythversion.h"
60 QString sel = selection.toLower();
73 else if (sel ==
"capture cards")
84 else if (sel ==
"video sources")
94 else if (sel ==
"card inputs")
105 else if (sel ==
"recording profile")
116 else if (sel ==
"channel editor")
122 if (chanedit->Create())
127 else if (sel ==
"storage groups")
138 else if (sel ==
"systemeventeditor")
149 else if (sel.startsWith(
"exiting_app") || (sel ==
"standby_mode"))
157 LOG(VB_GENERAL, LOG_ERR,
"Unknown menu action: " + selection);
163 QByteArray tmp =
themedir.toLocal8Bit();
165 QString(tmp.constData()),
"setup.xml",
175 LOG(VB_GENERAL, LOG_ERR, QString(
"Couldn't use theme '%1'").arg(themename));
191 LOG(VB_GENERAL, LOG_ERR,
192 QString(
"Overriding broken theme '%1' with '%2'")
193 .arg(badtheme, themename));
211 LOG(VB_GENERAL, LOG_ERR, QString(
"Couldn't find theme '%1'")
230int main(
int argc,
char *argv[])
234 bool doScanList =
false;
235 bool doScanSaveOnly =
false;
236 bool scanInteractive =
true;
237 bool expertMode =
false;
239 bool scanFTAOnly =
false;
240 bool scanLCNOnly =
false;
241 bool scanCompleteOnly =
false;
242 bool scanFullChannelSearch =
false;
243 bool scanRemoveDuplicates =
false;
244 bool addFullTS =
false;
247 QString frequencyStandard =
"atsc";
248 QString modulation =
"vsb8";
249 QString region =
"us";
250 QString scanInputName =
"";
272 bool use_display =
true;
279 std::unique_ptr<QCoreApplication> app {
nullptr};
284 app = std::make_unique<QApplication>(argc, argv);
288 app = std::make_unique<QCoreApplication>(argc, argv);
295 QString mask(
"general");
305 doScanSaveOnly =
true;
307 scanInteractive =
false;
316 scanCompleteOnly =
true;
318 scanFullChannelSearch =
true;
320 scanRemoveDuplicates =
true;
356 if (!geometry.isEmpty())
362 if (!context.Init(use_display,
false,
true))
364 LOG(VB_GENERAL, LOG_ERR,
"Failed to init MythContext, exiting.");
381 QDir dir(fileprefix);
383 dir.mkdir(fileprefix);
388 bool okCardID = scanCardId != 0U;
390 if (scanInputName.isEmpty())
394 && scanInputName !=
"None");
396 doScan = (okCardID && okInputName);
400 std::cerr <<
"You must enter a valid cardid to scan.\n";
404 std::cerr <<
"But no cards have been defined on this host\n";
407 std::cerr <<
"Valid cards:\n";
408 for (
uint id : cardids)
410 fprintf(
stderr,
"%5u: %s %s\n",
id,
419 std::cerr <<
"You must enter a valid input to scan this card.\n";
420 std::cerr <<
"Valid input: "
430 uint inputid = scanCardId;
432 QMap<QString,QString> startChan;
437 if (frequencyStandard ==
"atsc")
439 else if (frequencyStandard ==
"dvbt")
441 else if (frequencyStandard ==
"mpeg")
443 else if (frequencyStandard ==
"iptv")
446 scanner.
ImportM3U(scanCardId, scanInputName, sourceid,
true);
448 else if (frequencyStandard ==
"extern")
457 scanner.
Scan(scantype,
467 scanFullChannelSearch,
468 scanRemoveDuplicates,
470 scanServiceRequirements,
473 startChan, frequencyStandard, modulation, region);
474 ret = QCoreApplication::exec();
483 std::cout<<
" scanid cardid sourceid processed date\n";
484 for (
auto &
scan : scans)
486 printf(
"%5i %6i %8i %8s %20s\n",
488 scan.m_sourceid, (
scan.m_processed) ?
"yes" :
"no",
490 .toLatin1().constData());
499 std::cout<<
"*** SCAN IMPORT START ***\n";
503 scanFTAOnly, scanLCNOnly,
505 scanFullChannelSearch,
506 scanRemoveDuplicates,
507 scanServiceRequirements);
510 std::cout<<
"*** SCAN IMPORT END ***\n";
520 LOG(VB_GENERAL, LOG_ERR, QString(
"Couldn't find theme '%1'")
527 mainWindow->setWindowTitle(QObject::tr(
"MythTV Setup"));
540 LOG(VB_GENERAL, LOG_ERR,
541 "MySQL time zone support is missing. "
542 "Please install it and try again. "
543 "See 'mysql_tzinfo_to_sql' for assistance.");
549 LOG(VB_GENERAL, LOG_ERR,
"Couldn't upgrade database to new schema.");
571 if (expertEditor->
Create())
576 expertEditor =
nullptr;
577 LOG(VB_GENERAL, LOG_ERR,
578 "Unable to create expert settings editor window");
583 QCoreApplication::exec();
static QString GetRawInputType(uint inputid)
static QString GetInputName(uint inputid)
static QString GetVideoDevice(uint inputid)
static std::vector< uint > GetInputIDs(const QString &videodevice=QString(), const QString &rawtype=QString(), const QString &inputname=QString(), QString hostname=QString())
Returns all inputids of inputs that uses the specified videodevice if specified, and optionally rawty...
static uint GetSourceID(uint inputid)
static void UpdateChannelGroups(void)
void Process(const ScanDTVTransportList &_transports, int sourceid=-1)
virtual bool ImportM3U(uint cardid, const QString &inputname, uint sourceid, bool is_mpts)
void Scan(int scantype, uint cardid, const QString &inputname, uint sourceid, bool do_ignore_signal_timeout, bool do_follow_nit, bool do_test_decryption, bool do_fta_only, bool do_lcn_only, bool do_complete_only, bool do_full_channel_search, bool do_remove_duplicates, bool do_add_full_ts, ServiceRequirements service_requirements, uint mplexid, const QMap< QString, QString > &startChan, const QString &freq_std, const QString &mod, const QString &tbl, const QString &tbl_start=QString(), const QString &tbl_end=QString())
static bool CheckTimeZoneSupport(void)
Check if MySQL has working timz zone support.
static bool prompt(bool force=false)
Ask the user for the language to use.
bool toBool(const QString &key) const
Returns stored QVariant as a boolean.
virtual bool Parse(int argc, const char *const *argv)
Loop through argv and populate arguments with values.
void ApplySettingsOverride(void)
Apply all overrides to the global context.
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.
uint toUInt(const QString &key) const
Returns stored QVariant as an unsigned integer, falling to default if not provided.
void PrintHelp(void) const
Print command line option help.
Startup context for MythTV.
QString GetSetting(const QString &key, const QString &defaultval="")
void OverrideSettingForSession(const QString &key, const QString &value)
static void ConfigureQtGUI(int SwapInterval, const MythCommandLineParser &CmdLine)
Shared static initialisation code for all MythTV GUI applications.
MythScreenStack * GetMainStack()
void SetEffectsEnabled(bool Enable)
void Init(bool MayReInit=true)
virtual void AddScreen(MythScreenType *screen, bool allowFade=true)
An editor for MythSystemEvent handler commands.
static void reload()
Reload all active translators based on the current language setting.
static void load(const QString &module_name)
Load a QTranslator for the user's preferred language.
static void ParseGeometryOverride(const QString &Geometry)
Parse an X11 style command line geometry string.
QString FindThemeDir(const QString &ThemeName, bool Fallback=true)
Returns the full path to the theme denoted by themename.
bool Create(void) override
Creates the UI screen.
void PerformSearch(const QString &sST, std::chrono::seconds timeout=2s)
Send a SSDP discover multicast datagram.
@ CurrentTransportScan
Scans the transport when there is no tuner (for ASI)
bool InitializeMythSchema(void)
command to get the the initial database layout from an empty database:
bool UpgradeTVDatabaseSchema(const bool upgradeAllowed, const bool upgradeIfNoUI, const bool informSystemd)
Called from outside dbcheck.cpp to update the schema.
std::vector< ScanDTVTransport > ScanDTVTransportList
@ GENERIC_EXIT_NO_MYTHCONTEXT
No MythContext available.
@ GENERIC_EXIT_DB_NOTIMEZONE
Missing DB time zone support.
@ GENERIC_EXIT_DB_OUTOFDATE
Database needs upgrade.
@ GENERIC_EXIT_OK
Exited with no error.
@ GENERIC_EXIT_NO_THEME
No Theme available.
@ GENERIC_EXIT_INVALID_CMDLINE
Command line parse error.
@ GENERIC_EXIT_DB_ERROR
Database error.
@ GENERIC_EXIT_NOT_OK
Exited with error.
static constexpr const char * MYTH_APPNAME_MYTHTV_SETUP
MythCoreContext * gCoreContext
This global variable contains the MythCoreContext instance for the app.
#define LOG(_MASK_, _LEVEL_, _QSTRING_)
MythMainWindow * GetMythMainWindow(void)
void setHttpProxy(void)
Get network proxy settings from OS, and use for [Q]Http[Comms].
int main(int argc, char *argv[])
static bool RunMenu(const QString &themedir, const QString &themename)
StartPrompter * startPrompt
static void SetupMenuCallback(void *, QString &selection)
ExitPrompter * exitPrompt
static int reloadTheme(void)
static MythThemedMenu * menu
static bool resetTheme(QString themedir, const QString &badtheme)
MythUIHelper * GetMythUI()
static constexpr const char * FALLBACK_UI_THEME
static constexpr const char * DEFAULT_UI_THEME
MythCommFlagCommandLineParser cmdline
def scan(profile, smoonURL, gate)
std::vector< ScanInfo > LoadScanList(void)
ScanDTVTransportList LoadScan(uint scanid)