Go to the documentation of this file.
12 #include <processthreadsapi.h>
16 #include <QApplication>
27 #include <libmythbase/mythversion.h>
52 bool bOK =
file.open(QIODevice::ReadOnly);
56 LOG(VB_GENERAL, LOG_ERR,
57 QString(
"Unable to open file %1").arg(lockFile));
62 QString line(
file.readLine(100));
64 pid_t pid = line.toInt(&bOK);
68 LOG(VB_GENERAL, LOG_ERR,
69 QString(
"Got bad PID '%1' from lock file").arg(pid));
73 LOG(VB_GENERAL, LOG_NOTICE,
74 QString(
"Checking if PID %1 is still running").arg(pid));
77 HANDLE handy = OpenProcess(SYNCHRONIZE|PROCESS_TERMINATE, TRUE, pid);
78 return TerminateProcess(handy,0) == 0;
80 if (kill(pid, 0) == -1)
102 "Found a lock file but the owning process isn't running!\n"
103 "Removing stale lock file."));
106 LOG(VB_GENERAL, LOG_ERR,
107 QString(
"Failed to remove stale lock file - %1")
128 QString logDir = tempDir +
"logs";
154 QString logDir = tempDir +
"logs";
184 QString logDir = tempDir +
"logs";
199 if (selector->Create())
213 "Last run did not create a playable DVD."));
220 "Last run failed to create a DVD."));
229 QString
filename = tempDir +
"work/dvd";
232 if ((command.indexOf(
"internal", 0, Qt::CaseInsensitive) > -1) ||
233 (command.length() < 1))
236 command =
"Internal";
241 if (command.contains(
"%f"))
242 command = command.replace(
"%f",
filename);
258 QString sel = selection.toLower();
260 if (sel ==
"archive_create_dvd")
262 else if (sel ==
"archive_create_archive")
264 else if (sel ==
"archive_encode_video")
266 else if (sel ==
"archive_import_video")
268 else if (sel ==
"archive_last_log")
270 else if (sel ==
"archive_test_dvd")
272 else if (sel ==
"archive_burn_dvd")
291 mainMenu = qobject_cast<MythThemedMenu *>(parentObject);
293 if (mainMenu && mainMenu->objectName() ==
"mainmenu")
296 parentObject = parentObject->parent();
316 if (diag->foundTheme())
322 LOG(VB_GENERAL, LOG_ERR, QString(
"Couldn't find menu %1 or theme %2")
330 REG_KEY(
"Archive",
"TOGGLECUT", QT_TRANSLATE_NOOP(
"MythControls",
331 "Toggle use cut list state for selected program"),
"C");
333 REG_JUMP(QT_TRANSLATE_NOOP(
"MythControls",
"Create DVD"),
335 REG_JUMP(QT_TRANSLATE_NOOP(
"MythControls",
"Create Archive"),
337 REG_JUMP(QT_TRANSLATE_NOOP(
"MythControls",
"Import Archive"),
339 REG_JUMP(QT_TRANSLATE_NOOP(
"MythControls",
"View Archive Log"),
341 REG_JUMP(QT_TRANSLATE_NOOP(
"MythControls",
"Play Created DVD"),
343 REG_JUMP(QT_TRANSLATE_NOOP(
"MythControls",
"Burn DVD"),
350 MYTH_BINARY_VERSION))
352 LOG(VB_GENERAL, LOG_ERR,
"Test Popup Version Failed");
359 LOG(VB_GENERAL, LOG_ERR,
360 "Couldn't upgrade database to new schema, exiting.");
376 return runMenu(
"archivemenu.xml");
MythScreenStack * GetMainStack()
static void REG_KEY(const QString &Context, const QString &Action, const QString &Description, const QString &Key)
static void runTestDVD(void)
static bool checkProcess(const QString &lockFile)
static int runMenu(const QString &which_menu)
#define LOG(_MASK_, _LEVEL_, _QSTRING_)
static bool TestPluginVersion(const QString &name, const QString &libversion, const QString &pluginversion)
static bool checkLockFile(const QString &lockFile)
uint myth_system(const QString &command, uint flags, std::chrono::seconds timeout)
QString getTempDirectory(bool showError)
static void runCreateDVD(void)
int mythplugin_config(void)
static void initKeys(void)
bool HandleMedia(const QString &Handler, const QString &Mrl, const QString &Plot="", const QString &Title="", const QString &Subtitle="", const QString &Director="", int Season=0, int Episode=0, const QString &Inetref="", std::chrono::minutes LenMins=2h, const QString &Year="1895", const QString &Id="", bool UseBookmarks=false)
static void(* m_callback)(void *, QString &)
static void runImportVideo(void)
void showWarningDialog(const QString &msg)
static MythThemedMenu * menu
static void runCreateArchive(void)
static void * m_callbackdata
void checkTempDirectory()
MythCoreContext * gCoreContext
This global variable contains the MythCoreContext instance for the app.
int mythplugin_init(const char *libversion)
static void runEncodeVideo(void)
static void runShowLog(void)
static void REG_JUMP(const QString &Destination, const QString &Description, const QString &Key, void(*Callback)(void))
MythMainWindow * GetMythMainWindow(void)
bool UpgradeArchiveDatabaseSchema(void)
void ActivateSettingsCache(bool activate=true)
MythUIHelper * GetMythUI()
virtual void AddScreen(MythScreenType *screen, bool allowFade=true)
static void ArchiveCallback([[maybe_unused]] void *data, QString &selection)
QString GetSetting(const QString &key, const QString &defaultval="")
virtual MythScreenType * GetTopScreen(void) const
static void runBurnDVD(void)