[Backend+Scripts] Make appimage updating easier.
This commit is contained in:
parent
074ced6844
commit
9c51bb3ad3
|
@ -18,7 +18,7 @@ mkdir -p appdir/usr/lib
|
||||||
if [ "$ARCH" == "" ]; then
|
if [ "$ARCH" == "" ]; then
|
||||||
ARCH="x86_64"
|
ARCH="x86_64"
|
||||||
fi
|
fi
|
||||||
wget https://github.com/AppImage/AppImageUpdate/releases/download/continuous/appimageupdatetool-x86_64.AppImage -O appdir/usr/bin/appimageupdatetool
|
wget https://github.com/AppImage/AppImageUpdate/releases/download/continuous/AppImageUpdate-x86_64.AppImage -O appdir/usr/bin/appimageupdatetool
|
||||||
chmod +x appdir/usr/bin/appimageupdatetool
|
chmod +x appdir/usr/bin/appimageupdatetool
|
||||||
|
|
||||||
wget https://yt-dl.org/downloads/latest/youtube-dl -O appdir/usr/bin/youtube-dl
|
wget https://yt-dl.org/downloads/latest/youtube-dl -O appdir/usr/bin/youtube-dl
|
||||||
|
|
|
@ -468,6 +468,12 @@ MpvPlayerBackend::updateDurationString()
|
||||||
getProperty("speed").toString()));
|
getProperty("speed").toString()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
MpvPlayerBackend::updateAppImage()
|
||||||
|
{
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
MpvPlayerBackend::handle_mpv_event(mpv_event* event)
|
MpvPlayerBackend::handle_mpv_event(mpv_event* event)
|
||||||
{
|
{
|
||||||
|
|
|
@ -30,11 +30,12 @@ public:
|
||||||
virtual Renderer* createRenderer() const;
|
virtual Renderer* createRenderer() const;
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
// All 4 required for Player API
|
// All 5 required for Player API
|
||||||
QVariant playerCommand(const Enums::Commands& command, const QVariant& args);
|
QVariant playerCommand(const Enums::Commands& command, const QVariant& args);
|
||||||
QVariant playerCommand(const Enums::Commands& command);
|
QVariant playerCommand(const Enums::Commands& command);
|
||||||
void launchAboutQt();
|
void launchAboutQt();
|
||||||
void toggleOnTop();
|
void toggleOnTop();
|
||||||
|
void updateAppImage();
|
||||||
// Optional but handy for MPV or custom backend settings.
|
// Optional but handy for MPV or custom backend settings.
|
||||||
void command(const QVariant& params);
|
void command(const QVariant& params);
|
||||||
void setProperty(const QString& name, const QVariant& value);
|
void setProperty(const QString& name, const QVariant& value);
|
||||||
|
|
18
src/main.cpp
18
src/main.cpp
|
@ -76,6 +76,12 @@ main(int argc, char* argv[])
|
||||||
if (json["target_commitish"].toString().endsWith(current_version) == 0) {
|
if (json["target_commitish"].toString().endsWith(current_version) == 0) {
|
||||||
qDebug() << "Latest Version: " << json["target_commitish"].toString();
|
qDebug() << "Latest Version: " << json["target_commitish"].toString();
|
||||||
qDebug() << "Update Available. Please update ASAP.";
|
qDebug() << "Update Available. Please update ASAP.";
|
||||||
|
QProcess notifier;
|
||||||
|
notifier.setProcessChannelMode(QProcess::ForwardedChannels);
|
||||||
|
notifier.start("notify-send",
|
||||||
|
QStringList()
|
||||||
|
<< "KittehPlayer" << "New update avalable!" << "--icon=KittehPlayer";
|
||||||
|
notifier.waitForFinished();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
qDebug() << "Couldn't check for new version.";
|
qDebug() << "Couldn't check for new version.";
|
||||||
|
@ -87,17 +93,7 @@ main(int argc, char* argv[])
|
||||||
app.setApplicationName("KittehPlayer");
|
app.setApplicationName("KittehPlayer");
|
||||||
for (int i = 1; i < argc; ++i) {
|
for (int i = 1; i < argc; ++i) {
|
||||||
if (!qstrcmp(argv[i], "--update")) {
|
if (!qstrcmp(argv[i], "--update")) {
|
||||||
QString program =
|
update();
|
||||||
QProcessEnvironment::systemEnvironment().value("APPDIR", "") +
|
|
||||||
"/usr/bin/appimageupdatetool";
|
|
||||||
QProcess updater;
|
|
||||||
updater.setProcessChannelMode(QProcess::ForwardedChannels);
|
|
||||||
updater.start(program,
|
|
||||||
QStringList()
|
|
||||||
<< QProcessEnvironment::systemEnvironment().value(
|
|
||||||
"APPIMAGE", ""));
|
|
||||||
updater.waitForFinished();
|
|
||||||
exit(0);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -217,6 +217,10 @@ MenuBar {
|
||||||
onTriggered: Qt.quit()
|
onTriggered: Qt.quit()
|
||||||
shortcut: keybinds.quit
|
shortcut: keybinds.quit
|
||||||
}
|
}
|
||||||
|
Action {
|
||||||
|
text: "Update"
|
||||||
|
onTriggered: player.updateAppImage()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CustomMenu {
|
CustomMenu {
|
||||||
|
|
|
@ -1,7 +1,10 @@
|
||||||
#include "utils.hpp"
|
#include "utils.hpp"
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
|
||||||
|
#include <QApplication>
|
||||||
#include <QGuiApplication>
|
#include <QGuiApplication>
|
||||||
|
#include <QProcessEnvironment>
|
||||||
|
#include <QQmlApplicationEngine>
|
||||||
#include <QtCore>
|
#include <QtCore>
|
||||||
|
|
||||||
QString
|
QString
|
||||||
|
@ -11,6 +14,20 @@ getPlatformName()
|
||||||
qobject_cast<QGuiApplication*>(QCoreApplication::instance());
|
qobject_cast<QGuiApplication*>(QCoreApplication::instance());
|
||||||
return qapp->platformName();
|
return qapp->platformName();
|
||||||
}
|
}
|
||||||
|
void
|
||||||
|
update()
|
||||||
|
{
|
||||||
|
QString program =
|
||||||
|
QProcessEnvironment::systemEnvironment().value("APPDIR", "") +
|
||||||
|
"/usr/bin/appimageupdatetool";
|
||||||
|
QProcess updater;
|
||||||
|
updater.setProcessChannelMode(QProcess::ForwardedChannels);
|
||||||
|
updater.start(program,
|
||||||
|
QStringList() << QProcessEnvironment::systemEnvironment().value(
|
||||||
|
"APPIMAGE", ""));
|
||||||
|
updater.waitForFinished();
|
||||||
|
qApp->exit();
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
#include <QX11Info>
|
#include <QX11Info>
|
||||||
|
|
|
@ -7,5 +7,7 @@ void
|
||||||
SetDPMS(bool on);
|
SetDPMS(bool on);
|
||||||
void
|
void
|
||||||
AlwaysOnTop(WId wid, bool on);
|
AlwaysOnTop(WId wid, bool on);
|
||||||
|
void
|
||||||
|
update();
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue