|
@@ -6,6 +6,9 @@
|
|
|
#include <QDesktopServices>
|
|
|
#include <QDir>
|
|
|
#include <QJsonObject>
|
|
|
+#include <QNetworkRequest>
|
|
|
+#include <QNetworkAccessManager>
|
|
|
+#include <QNetworkReply>
|
|
|
|
|
|
#include "input/InputComponent.h"
|
|
|
#include "SystemComponent.h"
|
|
@@ -331,6 +334,33 @@ QString SystemComponent::getNativeShellScript()
|
|
|
return nativeshellString;
|
|
|
}
|
|
|
|
|
|
+/////////////////////////////////////////////////////////////////////////////////////////
|
|
|
+void SystemComponent::checkForUpdates()
|
|
|
+{
|
|
|
+ if (SettingsComponent::Get().value(SETTINGS_SECTION_MAIN, "checkForUpdates").toBool()) {
|
|
|
+ QNetworkAccessManager *manager = new QNetworkAccessManager(this);
|
|
|
+ QString checkUrl = "https://github.com/jellyfin/jellyfin-media-player/releases/latest";
|
|
|
+ QUrl qCheckUrl = QUrl(checkUrl);
|
|
|
+ QLOG_DEBUG() << QString("Checking URL for updates: %1").arg(checkUrl);
|
|
|
+ QNetworkRequest req(qCheckUrl);
|
|
|
+
|
|
|
+ connect(manager, &QNetworkAccessManager::finished, this, &SystemComponent::updateInfoHandler);
|
|
|
+ manager->get(req);
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+/////////////////////////////////////////////////////////////////////////////////////////
|
|
|
+void SystemComponent::updateInfoHandler(QNetworkReply* reply)
|
|
|
+{
|
|
|
+ if (reply->error() == QNetworkReply::NoError) {
|
|
|
+ int statusCode = reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt();
|
|
|
+ if(statusCode == 302) {
|
|
|
+ QUrl redirectUrl = reply->attribute(QNetworkRequest::RedirectionTargetAttribute).toUrl();
|
|
|
+ emit updateInfoEmitted(redirectUrl.toString());
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
/////////////////////////////////////////////////////////////////////////////////////////
|
|
|
#define BASESTR "protocols=shoutcast,http-video;videoDecoders=h264{profile:high&resolution:2160&level:52};audioDecoders=mp3,aac,dts{bitrate:800000&channels:%1},ac3{bitrate:800000&channels:%2}"
|
|
|
|