22#include "libmythbase/mythconfig.h"
29#include "libmythbase/mythversion.h"
62 QString sel = selection.toLower();
75 else if (sel ==
"capture cards")
86 else if (sel ==
"video sources")
96 else if (sel ==
"card inputs")
107 else if (sel ==
"recording profile")
118 else if (sel ==
"channel editor")
124 if (chanedit->Create())
129 else if (sel ==
"storage groups")
140 else if (sel ==
"systemeventeditor")
151 else if (sel.startsWith(
"exiting_app") || (sel ==
"standby_mode"))
159 LOG(VB_GENERAL, LOG_ERR,
"Unknown menu action: " + selection);
167 QString(
tmp.constData()),
"setup.xml",
177 LOG(VB_GENERAL, LOG_ERR, QString(
"Couldn't use theme '%1'").arg(themename));
193 LOG(VB_GENERAL, LOG_ERR,
194 QString(
"Overriding broken theme '%1' with '%2'")
195 .arg(badtheme, themename));
213 LOG(VB_GENERAL, LOG_ERR, QString(
"Couldn't find theme '%1'")
232int main(
int argc,
char *argv[])
236 bool doScanList =
false;
237 bool doScanSaveOnly =
false;
238 bool scanInteractive =
true;
239 bool expertMode =
false;
241 bool scanFTAOnly =
false;
242 bool scanLCNOnly =
false;
243 bool scanCompleteOnly =
false;
244 bool scanFullChannelSearch =
false;
245 bool scanRemoveDuplicates =
false;
246 bool addFullTS =
false;
249 QString frequencyStandard =
"atsc";
250 QString modulation =
"vsb8";
251 QString region =
"us";
252 QString scanInputName =
"";
274 bool use_display =
true;
281 std::unique_ptr<QCoreApplication> app {
nullptr};
286 app = std::make_unique<QApplication>(argc, argv);
290 app = std::make_unique<QCoreApplication>(argc, argv);
297 QString mask(
"general");
307 doScanSaveOnly =
true;
309 scanInteractive =
false;
318 scanCompleteOnly =
true;
320 scanFullChannelSearch =
true;
322 scanRemoveDuplicates =
true;
358 if (!geometry.isEmpty())
364 if (!context.Init(use_display,
false,
true))
366 LOG(VB_GENERAL, LOG_ERR,
"Failed to init MythContext, exiting.");
383 QDir dir(fileprefix);
385 dir.mkdir(fileprefix);
390 bool okCardID = scanCardId != 0U;
392 if (scanInputName.isEmpty())
396 && scanInputName !=
"None");
398 doScan = (okCardID && okInputName);
402 std::cerr <<
"You must enter a valid cardid to scan." << std::endl;
406 std::cerr <<
"But no cards have been defined on this host"
410 std::cerr <<
"Valid cards: " << std::endl;
411 for (
uint id : cardids)
413 fprintf(
stderr,
"%5u: %s %s\n",
id,
422 std::cerr <<
"You must enter a valid input to scan this card."
424 std::cerr <<
"Valid input: "
434 uint inputid = scanCardId;
436 QMap<QString,QString> startChan;
441 if (frequencyStandard ==
"atsc")
443 else if (frequencyStandard ==
"dvbt")
445 else if (frequencyStandard ==
"mpeg")
447 else if (frequencyStandard ==
"iptv")
450 scanner.
ImportM3U(scanCardId, scanInputName, sourceid,
true);
452 else if (frequencyStandard ==
"extern")
461 scanner.
Scan(scantype,
471 scanFullChannelSearch,
472 scanRemoveDuplicates,
474 scanServiceRequirements,
477 startChan, frequencyStandard, modulation, region);
478 ret = QCoreApplication::exec();
487 std::cout<<
" scanid cardid sourceid processed date"<<std::endl;
488 for (
auto &
scan : scans)
490 printf(
"%5i %6i %8i %8s %20s\n",
492 scan.m_sourceid, (
scan.m_processed) ?
"yes" :
"no",
494 .toLatin1().constData());
496 std::cout<<std::endl;
503 std::cout<<
"*** SCAN IMPORT START ***"<<std::endl;
507 scanFTAOnly, scanLCNOnly,
509 scanFullChannelSearch,
510 scanRemoveDuplicates,
511 scanServiceRequirements);
514 std::cout<<
"*** SCAN IMPORT END ***"<<std::endl;
524 LOG(VB_GENERAL, LOG_ERR, QString(
"Couldn't find theme '%1'")
531 mainWindow->setWindowTitle(QObject::tr(
"MythTV Setup"));
544 LOG(VB_GENERAL, LOG_ERR,
545 "MySQL time zone support is missing. "
546 "Please install it and try again. "
547 "See 'mysql_tzinfo_to_sql' for assistance.");
553 LOG(VB_GENERAL, LOG_ERR,
"Couldn't upgrade database to new schema.");
575 if (expertEditor->
Create())
580 expertEditor =
nullptr;
581 LOG(VB_GENERAL, LOG_ERR,
582 "Unable to create expert settings editor window");
587 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)
@ 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
MythCommFlagCommandLineParser cmdline
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
def scan(profile, smoonURL, gate)
std::vector< ScanInfo > LoadScanList(void)
ScanDTVTransportList LoadScan(uint scanid)