Go to the documentation of this file.
12 #include <processthreadsapi.h>
16 #include <QApplication>
26 #include <libmythbase/mythversion.h>
51 bool bOK =
file.open(QIODevice::ReadOnly);
55 LOG(VB_GENERAL, LOG_ERR,
56 QString(
"Unable to open file %1").arg(lockFile));
61 QString line(
file.readLine(100));
63 pid_t pid = line.toInt(&bOK);
67 LOG(VB_GENERAL, LOG_ERR,
68 QString(
"Got bad PID '%1' from lock file").arg(pid));
72 LOG(VB_GENERAL, LOG_NOTICE,
73 QString(
"Checking if PID %1 is still running").arg(pid));
76 HANDLE handy = OpenProcess(SYNCHRONIZE|PROCESS_TERMINATE, TRUE, pid);
77 return TerminateProcess(handy,0) == 0;
79 if (kill(pid, 0) == -1)
101 "Found a lock file but the owning process isn't running!\n"
102 "Removing stale lock file."));
105 LOG(VB_GENERAL, LOG_ERR,
106 QString(
"Failed to remove stale lock file - %1")
127 QString logDir = tempDir +
"logs";
153 QString logDir = tempDir +
"logs";
183 QString logDir = tempDir +
"logs";
198 if (selector->Create())
212 "Last run did not create a playable DVD."));
219 "Last run failed to create a DVD."));
228 QString
filename = tempDir +
"work/dvd";
231 if ((command.indexOf(
"internal", 0, Qt::CaseInsensitive) > -1) ||
232 (command.length() < 1))
235 command =
"Internal";
240 if (command.contains(
"%f"))
241 command = command.replace(
"%f",
filename);
257 QString sel = selection.toLower();
259 if (sel ==
"archive_create_dvd")
261 else if (sel ==
"archive_create_archive")
263 else if (sel ==
"archive_encode_video")
265 else if (sel ==
"archive_import_video")
267 else if (sel ==
"archive_last_log")
269 else if (sel ==
"archive_test_dvd")
271 else if (sel ==
"archive_burn_dvd")
290 mainMenu = qobject_cast<MythThemedMenu *>(parentObject);
292 if (mainMenu && mainMenu->objectName() ==
"mainmenu")
295 parentObject = parentObject->parent();
315 if (diag->foundTheme())
321 LOG(VB_GENERAL, LOG_ERR, QString(
"Couldn't find menu %1 or theme %2")
329 REG_KEY(
"Archive",
"TOGGLECUT", QT_TRANSLATE_NOOP(
"MythControls",
330 "Toggle use cut list state for selected program"),
"C");
332 REG_JUMP(QT_TRANSLATE_NOOP(
"MythControls",
"Create DVD"),
334 REG_JUMP(QT_TRANSLATE_NOOP(
"MythControls",
"Create Archive"),
336 REG_JUMP(QT_TRANSLATE_NOOP(
"MythControls",
"Import Archive"),
338 REG_JUMP(QT_TRANSLATE_NOOP(
"MythControls",
"View Archive Log"),
340 REG_JUMP(QT_TRANSLATE_NOOP(
"MythControls",
"Play Created DVD"),
342 REG_JUMP(QT_TRANSLATE_NOOP(
"MythControls",
"Burn DVD"),
349 MYTH_BINARY_VERSION))
351 LOG(VB_GENERAL, LOG_ERR,
"Test Popup Version Failed");
358 LOG(VB_GENERAL, LOG_ERR,
359 "Couldn't upgrade database to new schema, exiting.");
375 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)