22#include "libmythbase/mythconfig.h"
29#include "libmythbase/mythversion.h"
61 QString sel = selection.toLower();
74 else if (sel ==
"capture cards")
85 else if (sel ==
"video sources")
95 else if (sel ==
"card inputs")
106 else if (sel ==
"recording profile")
117 else if (sel ==
"channel editor")
123 if (chanedit->Create())
128 else if (sel ==
"storage groups")
139 else if (sel ==
"systemeventeditor")
150 else if (sel.startsWith(
"exiting_app") || (sel ==
"standby_mode"))
158 LOG(VB_GENERAL, LOG_ERR,
"Unknown menu action: " + selection);
166 QString(
tmp.constData()),
"setup.xml",
176 LOG(VB_GENERAL, LOG_ERR, QString(
"Couldn't use theme '%1'").arg(themename));
192 LOG(VB_GENERAL, LOG_ERR,
193 QString(
"Overriding broken theme '%1' with '%2'")
194 .arg(badtheme, themename));
212 LOG(VB_GENERAL, LOG_ERR, QString(
"Couldn't find theme '%1'")
231int main(
int argc,
char *argv[])
235 bool doScanList =
false;
236 bool doScanSaveOnly =
false;
237 bool scanInteractive =
true;
238 bool expertMode =
false;
240 bool scanFTAOnly =
false;
241 bool scanLCNOnly =
false;
242 bool scanCompleteOnly =
false;
243 bool scanFullChannelSearch =
false;
244 bool scanRemoveDuplicates =
false;
245 bool addFullTS =
false;
248 QString frequencyStandard =
"atsc";
249 QString modulation =
"vsb8";
250 QString region =
"us";
251 QString scanInputName =
"";
273 bool use_display =
true;
280 std::unique_ptr<QCoreApplication> app {
nullptr};
285 app = std::make_unique<QApplication>(argc, argv);
289 app = std::make_unique<QCoreApplication>(argc, argv);
296 QString mask(
"general");
306 doScanSaveOnly =
true;
308 scanInteractive =
false;
317 scanCompleteOnly =
true;
319 scanFullChannelSearch =
true;
321 scanRemoveDuplicates =
true;
357 if (!geometry.isEmpty())
363 if (!context.Init(use_display,
false,
true))
365 LOG(VB_GENERAL, LOG_ERR,
"Failed to init MythContext, exiting.");
382 QDir dir(fileprefix);
384 dir.mkdir(fileprefix);
389 bool okCardID = scanCardId != 0U;
391 if (scanInputName.isEmpty())
395 && scanInputName !=
"None");
397 doScan = (okCardID && okInputName);
401 std::cerr <<
"You must enter a valid cardid to scan." << std::endl;
405 std::cerr <<
"But no cards have been defined on this host"
409 std::cerr <<
"Valid cards: " << std::endl;
410 for (
uint id : cardids)
412 fprintf(
stderr,
"%5u: %s %s\n",
id,
421 std::cerr <<
"You must enter a valid input to scan this card."
423 std::cerr <<
"Valid input: "
433 uint inputid = scanCardId;
435 QMap<QString,QString> startChan;
440 if (frequencyStandard ==
"atsc")
442 else if (frequencyStandard ==
"dvbt")
444 else if (frequencyStandard ==
"mpeg")
446 else if (frequencyStandard ==
"iptv")
449 scanner.
ImportM3U(scanCardId, scanInputName, sourceid,
true);
451 else if (frequencyStandard ==
"extern")
460 scanner.
Scan(scantype,
470 scanFullChannelSearch,
471 scanRemoveDuplicates,
473 scanServiceRequirements,
476 startChan, frequencyStandard, modulation, region);
477 ret = QCoreApplication::exec();
486 std::cout<<
" scanid cardid sourceid processed date"<<std::endl;
487 for (
auto &
scan : scans)
489 printf(
"%5i %6i %8i %8s %20s\n",
491 scan.m_sourceid, (
scan.m_processed) ?
"yes" :
"no",
493 .toLatin1().constData());
495 std::cout<<std::endl;
502 std::cout<<
"*** SCAN IMPORT START ***"<<std::endl;
506 scanFTAOnly, scanLCNOnly,
508 scanFullChannelSearch,
509 scanRemoveDuplicates,
510 scanServiceRequirements);
513 std::cout<<
"*** SCAN IMPORT END ***"<<std::endl;
523 LOG(VB_GENERAL, LOG_ERR, QString(
"Couldn't find theme '%1'")
530 mainWindow->setWindowTitle(QObject::tr(
"MythTV Setup"));
543 LOG(VB_GENERAL, LOG_ERR,
544 "MySQL time zone support is missing. "
545 "Please install it and try again. "
546 "See 'mysql_tzinfo_to_sql' for assistance.");
552 LOG(VB_GENERAL, LOG_ERR,
"Couldn't upgrade database to new schema.");
574 if (expertEditor->
Create())
579 expertEditor =
nullptr;
580 LOG(VB_GENERAL, LOG_ERR,
581 "Unable to create expert settings editor window");
586 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)