Cleanup settings, use tv setting, enable hwdec by default.

This commit is contained in:
Ian Walton 2021-04-18 14:27:29 -04:00
parent e15cff1aa2
commit dcc36e370f
12 changed files with 30 additions and 203 deletions

View File

@ -141,8 +141,6 @@ system/SystemComponent - [header](https://github.com/plexinc/plex-media-player/b
- str getUserAgent()
- str debugInformation()
- list[str] networkAddresses()
- int networkPort()
- void userInformation(dict userModel)
- void openExternalUrl(str url) - Opens in external browser.
- void runUserScript(str script) - Starts processes in the datadir + scripts/
- void hello(str version) - called by web client when loading done

View File

@ -1,5 +1,4 @@
const viewdata = JSON.parse(window.atob("@@data@@"));
console.log(viewdata);
const features = [
"filedownload",
@ -115,7 +114,7 @@ window.NativeShell.AppHost = {
})();
},
getDefaultLayout() {
return "desktop";
return viewdata.mode;
},
supports(command) {
return features.includes(command.toLowerCase());

View File

@ -8,7 +8,7 @@ Terminal=false
Type=Application
Categories=AudioVideo;Video;Player;TV;
Actions=DesktopF;DesktopW;
Actions=DesktopF;DesktopW;TVF;TVW
[Desktop Action DesktopF]
Name=Desktop [Fullscreen]
@ -17,3 +17,11 @@ Exec=jellyfinmediaplayer --fullscreen --desktop
[Desktop Action DesktopW]
Name=Desktop [Windowed]
Exec=jellyfinmediaplayer --windowed --desktop
[Desktop Action TVF]
Name=TV [Fullscreen]
Exec=jellyfinmediaplayer --fullscreen --tv
[Desktop Action TVW]
Name=TV [Windowed]
Exec=jellyfinmediaplayer --windowed --tv

View File

@ -1,7 +1,7 @@
[
{
"section": "__meta__",
"version": 4
"version": 5
},
{
"section": "state",
@ -20,9 +20,8 @@
"values": [
{
"value": "webMode",
"default": "tv",
"default": "desktop",
"hidden": true,
"platforms": [ "windows", "macosx" ],
"possible_values": [
[ "desktop", "desktop" ],
[ "tv", "tv" ]
@ -30,18 +29,13 @@
},
{
"value": "layout",
"default": "auto",
"default": "desktop",
"hidden": true,
"possible_values": [
[ "auto", "auto" ],
[ "desktop", "desktop" ],
[ "tv", "tv" ]
]
},
{
"value": "remoteInspector",
"default": false,
"hidden": true
},
{
"value": "fullscreen",
"default": false,
@ -57,30 +51,6 @@
"value": "alwaysOnTop",
"default": false
},
{
"value": "webserverport",
"default": 32433,
"hidden": true
},
{
"value": "automaticUpdates",
"default": true,
"hidden": true
},
{
"value": "manualUpdateCheck",
"input_type": "button",
"default": true,
"hidden": true
},
{
"value": "updateChannel",
"default": 0,
"hidden": true,
"possible_values": [
[ 0, "Stable" ]
]
},
{
"value": "hdmi_poweron",
"default": false,
@ -112,11 +82,6 @@
"default": false,
"platforms": [ "windows" ]
},
{
"value": "clientUUID",
"default": "",
"hidden": true
},
{
"value": "showPowerOptions",
"default": true,
@ -136,16 +101,6 @@
],
"hidden": true
},
{
"value": "preventSystemScreensaver",
"default": false,
"hidden": true
},
{
"value": "useHelper",
"default": true,
"hidden": true
},
{
"value": "forceFSScreen",
"platforms_excluded": [ "oe" ],
@ -255,15 +210,7 @@
},
{
"value": "hardwareDecoding",
"default": [
{
"value": "enabled",
"platforms": [ "oe" ]
},
{
"value": "disabled"
}
],
"default": "enabled",
"possible_values": [
[ "enabled", "video.decode.enabled", { "platforms_excluded": "osx" } ],
[ "enabled", "video.decode.enabled.modern", { "platforms": "osx" } ],
@ -278,16 +225,6 @@
"default": false,
"platforms_excluded": "oe_rpi"
},
{
"value": "directPlay",
"default": true,
"hidden": true
},
{
"value": "directStream",
"default": true,
"hidden": true
},
{
"value": "sync_mode",
"default": "audio",
@ -403,48 +340,14 @@
}
]
},
{
"section": "manualServers",
"hidden": true,
"values": [
{
"value": "ip1",
"default": "",
"input_type": "ip"
},
{
"value": "port1",
"default": "32400",
"input_type": "port"
},
{
"value": "ip2",
"default": "",
"input_type": "ip"
},
{
"value": "port2",
"default": "32400",
"input_type": "port"
}
]
},
{
"section": "path",
"hidden": true,
"values": [
{
"value": "startupurl_tv",
"default": "bundled"
},
{
"value": "startupurl_desktop",
"default": "bundled"
},
{
"value": "helperprogram",
"default": ""
},
{
"value": "startupurl_extension",
"default": "bundled"
@ -495,12 +398,6 @@
}
]
},
{
"section": "webclient",
"hidden": true,
"storage": true,
"values": []
},
{
"section": "system",
"hidden": true,
@ -527,10 +424,5 @@
"platforms": [ "oe" ]
}
]
},
{
"section": "privacy",
"hidden": true,
"values": []
}
]

View File

@ -160,7 +160,7 @@ void InputRoku::handleQueryDeviceInfo(QHttpRequest* request, QHttpResponse* resp
writer.writeStartDocument();
writer.writeStartElement("device-info");
writer.writeTextElement("udn", Utils::ClientUUID());
//writer.writeTextElement("udn", Utils::ClientUUID());
writer.writeTextElement("serial-number", ROKU_SERIAL_NUMBER);
writer.writeTextElement("device-id", ROKU_SERIAL_NUMBER);
writer.writeTextElement("vendor-name", "Roku");
@ -243,7 +243,7 @@ void InputRoku::handleRootInfo(QHttpRequest* request, QHttpResponse* response)
writer.writeTextElement("modelNumber", "4200X");
writer.writeTextElement("modelURL", "http://www.roku.com");
writer.writeTextElement("serialNumber", ROKU_SERIAL_NUMBER);
writer.writeTextElement("UDN", "uuid:" + Utils::ClientUUID());
//writer.writeTextElement("UDN", "uuid:" + Utils::ClientUUID());
writer.writeStartElement("serviceList");
writer.writeStartElement("service");

View File

@ -94,13 +94,10 @@ int main(int argc, char *argv[])
parser.addHelpOption();
parser.addVersionOption();
parser.addOptions({{{"l", "licenses"}, "Show license information"},
{{"a", "from-auto-update"}, "When invoked from auto-update"},
{"desktop", "Start in desktop mode"},
{"tv", "Start in TV mode"},
{"auto-layout", "Use auto-layout mode"},
{"windowed", "Start in windowed mode"},
{"fullscreen", "Start in fullscreen"},
{"no-updates", "Disable auto-updating"},
{"terminal", "Log to terminal"},
{"disable-gpu", "Disable QtWebEngine gpu accel"}});
@ -192,10 +189,6 @@ int main(int argc, char *argv[])
SettingsComponent::Get().setCommandLineValues(parser.optionNames());
// enable remote inspection if we have the correct setting for it.
if (SettingsComponent::Get().value(SETTINGS_SECTION_MAIN, "remoteInspector").toBool())
qputenv("QTWEBENGINE_REMOTE_DEBUGGING", "0.0.0.0:9992");
QtWebEngine::initialize();
// load QtWebChannel so that we can register our components with it.

View File

@ -214,18 +214,14 @@ void SettingsComponent::load()
///////////////////////////////////////////////////////////////////////////////////////////////////
void SettingsComponent::loadConf(const QString& path, bool storage)
{
bool migrateTvMode = false;
bool migrateJmpSettings = false;
QJsonObject json = loadJson(path);
int version = json["version"].toInt(0);
// Migrate to settings version 4
if (version == 3 && m_settingsVersion == 4)
if (version == 4 && m_settingsVersion == 5)
{
// We only need to make sure that old users have the
// webmode set to "tv" so that we don't flip their
// interface unnecessarly
migrateTvMode = true;
migrateJmpSettings = true;
}
else if (version != m_settingsVersion)
{
@ -268,8 +264,13 @@ void SettingsComponent::loadConf(const QString& path, bool storage)
sec->setValue(setting, jsonSection.value(setting).toVariant());
}
if (migrateTvMode)
getSection(SETTINGS_SECTION_MAIN)->setValue("webMode", "tv");
if (migrateJmpSettings) {
getSection(SETTINGS_SECTION_MAIN)->setValue("webMode", "desktop");
getSection(SETTINGS_SECTION_MAIN)->setValue("layout", "desktop");
if (getSection(SETTINGS_SECTION_VIDEO)->value("hardwareDecoding") == "disabled") {
getSection(SETTINGS_SECTION_VIDEO)->setValue("hardwareDecoding", "enabled");
}
}
}
///////////////////////////////////////////////////////////////////////////////////////////////////
@ -698,23 +699,6 @@ void SettingsComponent::setupVersion()
}
}
/////////////////////////////////////////////////////////////////////////////////////////
void SettingsComponent::setUserRoleList(const QStringList& userRoles)
{
QVariantList values;
// Channel names and values are aligned with values expected by plex.tv.
// See: https://github.com/plexinc/plex-media-player-private/issues/642
// Public is always available as the default value.
QVariantMap publicChannel;
publicChannel.insert("value", 0);
publicChannel.insert("title", "Public");
values << publicChannel;
updatePossibleValues(SETTINGS_SECTION_MAIN, "updateChannel", values);
}
/////////////////////////////////////////////////////////////////////////////////////////
bool SettingsComponent::resetAndSaveOldConfiguration()
{
@ -774,8 +758,6 @@ void SettingsComponent::setCommandLineValues(const QStringList& values)
{
QLOG_DEBUG() << values;
QString mode = ""; // unset, different from "auto"
for (const QString& value : values)
{
if (value == "fullscreen")
@ -783,14 +765,9 @@ void SettingsComponent::setCommandLineValues(const QStringList& values)
else if (value == "windowed")
setValue(SETTINGS_SECTION_MAIN, "fullscreen", false);
else if (value == "desktop")
mode = "desktop";
setValue(SETTINGS_SECTION_MAIN, "layout", "desktop");
else if (value == "tv")
mode = "tv";
else if (value == "auto-layout")
mode = "auto";
setValue(SETTINGS_SECTION_MAIN, "layout", "tv");
}
setValue(SETTINGS_SECTION_MAIN, "layout", "auto");
setValue(SETTINGS_SECTION_MAIN, "webMode", "desktop");
}

View File

@ -80,8 +80,6 @@ public:
// part of the map.
Q_SIGNAL void sectionValueUpdate(const QString& section, const QVariantMap& values);
void setUserRoleList(const QStringList& userRoles);
// A hack to load a value from the config file at very early init time, before
// the SettingsComponent is created.
//

View File

@ -249,12 +249,6 @@ QString SystemComponent::debugInformation()
return debugInfo;
}
/////////////////////////////////////////////////////////////////////////////////////////
int SystemComponent::networkPort() const
{
return SettingsComponent::Get().value(SETTINGS_SECTION_MAIN, "webserverport").toInt();
}
/////////////////////////////////////////////////////////////////////////////////////////
QStringList SystemComponent::networkAddresses() const
{
@ -273,21 +267,6 @@ QStringList SystemComponent::networkAddresses() const
return list;
}
/////////////////////////////////////////////////////////////////////////////////////////
void SystemComponent::userInformation(const QVariantMap& userModel)
{
QStringList roleList;
for(const QVariant& role : userModel.value("roles").toList())
{
roleList << role.toMap().value("id").toString();
}
SettingsComponent::Get().setUserRoleList(roleList);
m_authenticationToken = userModel.value("authToken").toString();
emit userInfoChanged();
}
/////////////////////////////////////////////////////////////////////////////////////////
void SystemComponent::openExternalUrl(const QString& url)
{
@ -347,6 +326,7 @@ QString SystemComponent::getNativeShellScript()
QJsonObject clientData;
clientData.insert("deviceName", QJsonValue::fromVariant(SettingsComponent::Get().getClientName()));
clientData.insert("scriptPath", QJsonValue::fromVariant("file:///" + path));
clientData.insert("mode", QJsonValue::fromVariant(SettingsComponent::Get().value(SETTINGS_SECTION_MAIN, "layout").toString()));
nativeshellString.replace("@@data@@", QJsonDocument(clientData).toJson(QJsonDocument::Compact).toBase64());
return nativeshellString;
}

View File

@ -39,9 +39,6 @@ public:
Q_INVOKABLE QString debugInformation();
Q_INVOKABLE QStringList networkAddresses() const;
Q_INVOKABLE int networkPort() const;
Q_INVOKABLE void userInformation(const QVariantMap& userModel);
Q_INVOKABLE void openExternalUrl(const QString& url);

View File

@ -142,20 +142,6 @@ QString Utils::PrimaryIPv4Address()
return "";
}
/////////////////////////////////////////////////////////////////////////////////////////
QString Utils::ClientUUID()
{
QString storedUUID = SettingsComponent::Get().value(SETTINGS_SECTION_MAIN, "clientUUID").toString();
if (storedUUID.isEmpty())
{
QString newUUID = QUuid::createUuid().toString();
newUUID = newUUID.replace("{", "").replace("}", "");
SettingsComponent::Get().setValue(SETTINGS_SECTION_MAIN, "clientUUID", newUUID);
return newUUID;
}
return storedUUID;
}
///////////////////////////////////////////////////////////////////////////////////////////////////
bool Utils::safelyWriteFile(const QString& filename, const QByteArray& data)
{

View File

@ -56,7 +56,6 @@ namespace Utils
QString CurrentUserId();
QString ComputerName();
QString PrimaryIPv4Address();
QString ClientUUID();
bool safelyWriteFile(const QString& filename, const QByteArray& data);
QString sanitizeForHttpSeparators(const QString& input);
}