13#if QT_VERSION >= QT_VERSION_CHECK(6,5,0)
14#include <QtSystemDetection>
17#include <processthreadsapi.h>
21#include <QApplication>
31#include <libmythbase/mythversion.h>
56 bool bOK =
file.open(QIODevice::ReadOnly);
60 LOG(VB_GENERAL, LOG_ERR,
61 QString(
"Unable to open file %1").arg(lockFile));
66 QString line(
file.readLine(100));
68 pid_t pid = line.toInt(&bOK);
72 LOG(VB_GENERAL, LOG_ERR,
73 QString(
"Got bad PID '%1' from lock file").arg(pid));
77 LOG(VB_GENERAL, LOG_NOTICE,
78 QString(
"Checking if PID %1 is still running").arg(pid));
81 HANDLE handy = OpenProcess(SYNCHRONIZE|PROCESS_TERMINATE, TRUE, pid);
82 return TerminateProcess(handy,0) == 0;
84 if (kill(pid, 0) == -1)
106 "Found a lock file but the owning process isn't running!\n"
107 "Removing stale lock file."));
110 LOG(VB_GENERAL, LOG_ERR,
111 QString(
"Failed to remove stale lock file - %1")
132 QString logDir = tempDir +
"logs";
158 QString logDir = tempDir +
"logs";
188 QString logDir = tempDir +
"logs";
203 if (selector->Create())
217 "Last run did not create a playable DVD."));
224 "Last run failed to create a DVD."));
233 QString
filename = tempDir +
"work/dvd";
236 if ((command.indexOf(
"internal", 0, Qt::CaseInsensitive) > -1) ||
237 (command.length() < 1))
240 command =
"Internal";
245 if (command.contains(
"%f"))
246 command = command.replace(
"%f",
filename);
262 QString sel = selection.toLower();
264 if (sel ==
"archive_create_dvd") {
266 }
else if (sel ==
"archive_create_archive") {
268 }
else if (sel ==
"archive_encode_video") {
270 }
else if (sel ==
"archive_import_video") {
272 }
else if (sel ==
"archive_last_log") {
274 }
else if (sel ==
"archive_test_dvd") {
276 }
else if (sel ==
"archive_burn_dvd") {
294 mainMenu = qobject_cast<MythThemedMenu *>(parentObject);
296 if (mainMenu && mainMenu->objectName() ==
"mainmenu")
299 parentObject = parentObject->parent();
321 if (diag->foundTheme())
327 LOG(VB_GENERAL, LOG_ERR, QString(
"Couldn't find menu %1 or theme %2")
335 REG_KEY(
"Archive",
"TOGGLECUT", QT_TRANSLATE_NOOP(
"MythControls",
336 "Toggle use cut list state for selected program"),
"C");
338 REG_JUMP(QT_TRANSLATE_NOOP(
"MythControls",
"Create DVD"),
340 REG_JUMP(QT_TRANSLATE_NOOP(
"MythControls",
"Create Archive"),
342 REG_JUMP(QT_TRANSLATE_NOOP(
"MythControls",
"Import Archive"),
344 REG_JUMP(QT_TRANSLATE_NOOP(
"MythControls",
"View Archive Log"),
346 REG_JUMP(QT_TRANSLATE_NOOP(
"MythControls",
"Play Created DVD"),
348 REG_JUMP(QT_TRANSLATE_NOOP(
"MythControls",
"Burn DVD"),
355 MYTH_BINARY_VERSION))
357 LOG(VB_GENERAL, LOG_ERR,
"Test Popup Version Failed");
364 LOG(VB_GENERAL, LOG_ERR,
365 "Couldn't upgrade database to new schema, exiting.");
381 return runMenu(
"archivemenu.xml");
bool UpgradeArchiveDatabaseSchema(void)
void checkTempDirectory()
void showWarningDialog(const QString &msg)
QString getTempDirectory(bool showError)
void ActivateSettingsCache(bool activate=true)
QString GetSetting(const QString &key, const QString &defaultval="")
static bool TestPluginVersion(const QString &name, const QString &libversion, const QString &pluginversion)
MythScreenStack * GetMainStack()
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)
virtual void AddScreen(MythScreenType *screen, bool allowFade=true)
virtual MythScreenType * GetTopScreen(void) const
static bool checkLockFile(const QString &lockFile)
static void runTestDVD(void)
int mythplugin_config(void)
static void runCreateDVD(void)
static void(* m_callback)(void *, QString &)
static void runBurnDVD(void)
static bool checkProcess(const QString &lockFile)
static void initKeys(void)
static void runImportVideo(void)
static int runMenu(const QString &which_menu)
static void runEncodeVideo(void)
static void ArchiveCallback(void *data, QString &selection)
static void runShowLog(void)
int mythplugin_init(const char *libversion)
static void runCreateArchive(void)
static void * m_callbackdata
MythCoreContext * gCoreContext
This global variable contains the MythCoreContext instance for the app.
#define LOG(_MASK_, _LEVEL_, _QSTRING_)
MythMainWindow * GetMythMainWindow(void)
static void REG_JUMP(const QString &Destination, const QString &Description, const QString &Key, void(*Callback)(void))
static void REG_KEY(const QString &Context, const QString &Action, const QString &Description, const QString &Key)
uint myth_system(const QString &command, uint flags, std::chrono::seconds timeout)
static MythThemedMenu * menu
MythUIHelper * GetMythUI()