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 getUserAgent()
- str debugInformation() - str debugInformation()
- list[str] networkAddresses() - list[str] networkAddresses()
- int networkPort()
- void userInformation(dict userModel)
- void openExternalUrl(str url) - Opens in external browser. - void openExternalUrl(str url) - Opens in external browser.
- void runUserScript(str script) - Starts processes in the datadir + scripts/ - void runUserScript(str script) - Starts processes in the datadir + scripts/
- void hello(str version) - called by web client when loading done - void hello(str version) - called by web client when loading done

View File

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

View File

@ -8,7 +8,7 @@ Terminal=false
Type=Application Type=Application
Categories=AudioVideo;Video;Player;TV; Categories=AudioVideo;Video;Player;TV;
Actions=DesktopF;DesktopW; Actions=DesktopF;DesktopW;TVF;TVW
[Desktop Action DesktopF] [Desktop Action DesktopF]
Name=Desktop [Fullscreen] Name=Desktop [Fullscreen]
@ -17,3 +17,11 @@ Exec=jellyfinmediaplayer --fullscreen --desktop
[Desktop Action DesktopW] [Desktop Action DesktopW]
Name=Desktop [Windowed] Name=Desktop [Windowed]
Exec=jellyfinmediaplayer --windowed --desktop 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__", "section": "__meta__",
"version": 4 "version": 5
}, },
{ {
"section": "state", "section": "state",
@ -20,9 +20,8 @@
"values": [ "values": [
{ {
"value": "webMode", "value": "webMode",
"default": "tv", "default": "desktop",
"hidden": true, "hidden": true,
"platforms": [ "windows", "macosx" ],
"possible_values": [ "possible_values": [
[ "desktop", "desktop" ], [ "desktop", "desktop" ],
[ "tv", "tv" ] [ "tv", "tv" ]
@ -30,18 +29,13 @@
}, },
{ {
"value": "layout", "value": "layout",
"default": "auto", "default": "desktop",
"hidden": true, "hidden": true,
"possible_values": [ "possible_values": [
[ "auto", "auto" ], [ "desktop", "desktop" ],
[ "tv", "tv" ] [ "tv", "tv" ]
] ]
}, },
{
"value": "remoteInspector",
"default": false,
"hidden": true
},
{ {
"value": "fullscreen", "value": "fullscreen",
"default": false, "default": false,
@ -57,30 +51,6 @@
"value": "alwaysOnTop", "value": "alwaysOnTop",
"default": false "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", "value": "hdmi_poweron",
"default": false, "default": false,
@ -112,11 +82,6 @@
"default": false, "default": false,
"platforms": [ "windows" ] "platforms": [ "windows" ]
}, },
{
"value": "clientUUID",
"default": "",
"hidden": true
},
{ {
"value": "showPowerOptions", "value": "showPowerOptions",
"default": true, "default": true,
@ -136,16 +101,6 @@
], ],
"hidden": true "hidden": true
}, },
{
"value": "preventSystemScreensaver",
"default": false,
"hidden": true
},
{
"value": "useHelper",
"default": true,
"hidden": true
},
{ {
"value": "forceFSScreen", "value": "forceFSScreen",
"platforms_excluded": [ "oe" ], "platforms_excluded": [ "oe" ],
@ -255,15 +210,7 @@
}, },
{ {
"value": "hardwareDecoding", "value": "hardwareDecoding",
"default": [ "default": "enabled",
{
"value": "enabled",
"platforms": [ "oe" ]
},
{
"value": "disabled"
}
],
"possible_values": [ "possible_values": [
[ "enabled", "video.decode.enabled", { "platforms_excluded": "osx" } ], [ "enabled", "video.decode.enabled", { "platforms_excluded": "osx" } ],
[ "enabled", "video.decode.enabled.modern", { "platforms": "osx" } ], [ "enabled", "video.decode.enabled.modern", { "platforms": "osx" } ],
@ -278,16 +225,6 @@
"default": false, "default": false,
"platforms_excluded": "oe_rpi" "platforms_excluded": "oe_rpi"
}, },
{
"value": "directPlay",
"default": true,
"hidden": true
},
{
"value": "directStream",
"default": true,
"hidden": true
},
{ {
"value": "sync_mode", "value": "sync_mode",
"default": "audio", "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", "section": "path",
"hidden": true, "hidden": true,
"values": [ "values": [
{
"value": "startupurl_tv",
"default": "bundled"
},
{ {
"value": "startupurl_desktop", "value": "startupurl_desktop",
"default": "bundled" "default": "bundled"
}, },
{
"value": "helperprogram",
"default": ""
},
{ {
"value": "startupurl_extension", "value": "startupurl_extension",
"default": "bundled" "default": "bundled"
@ -495,12 +398,6 @@
} }
] ]
}, },
{
"section": "webclient",
"hidden": true,
"storage": true,
"values": []
},
{ {
"section": "system", "section": "system",
"hidden": true, "hidden": true,
@ -527,10 +424,5 @@
"platforms": [ "oe" ] "platforms": [ "oe" ]
} }
] ]
},
{
"section": "privacy",
"hidden": true,
"values": []
} }
] ]

View File

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

View File

@ -94,13 +94,10 @@ int main(int argc, char *argv[])
parser.addHelpOption(); parser.addHelpOption();
parser.addVersionOption(); parser.addVersionOption();
parser.addOptions({{{"l", "licenses"}, "Show license information"}, parser.addOptions({{{"l", "licenses"}, "Show license information"},
{{"a", "from-auto-update"}, "When invoked from auto-update"},
{"desktop", "Start in desktop mode"}, {"desktop", "Start in desktop mode"},
{"tv", "Start in TV mode"}, {"tv", "Start in TV mode"},
{"auto-layout", "Use auto-layout mode"},
{"windowed", "Start in windowed mode"}, {"windowed", "Start in windowed mode"},
{"fullscreen", "Start in fullscreen"}, {"fullscreen", "Start in fullscreen"},
{"no-updates", "Disable auto-updating"},
{"terminal", "Log to terminal"}, {"terminal", "Log to terminal"},
{"disable-gpu", "Disable QtWebEngine gpu accel"}}); {"disable-gpu", "Disable QtWebEngine gpu accel"}});
@ -192,10 +189,6 @@ int main(int argc, char *argv[])
SettingsComponent::Get().setCommandLineValues(parser.optionNames()); 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(); QtWebEngine::initialize();
// load QtWebChannel so that we can register our components with it. // 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) void SettingsComponent::loadConf(const QString& path, bool storage)
{ {
bool migrateTvMode = false; bool migrateJmpSettings = false;
QJsonObject json = loadJson(path); QJsonObject json = loadJson(path);
int version = json["version"].toInt(0); int version = json["version"].toInt(0);
// Migrate to settings version 4 if (version == 4 && m_settingsVersion == 5)
if (version == 3 && m_settingsVersion == 4)
{ {
// We only need to make sure that old users have the migrateJmpSettings = true;
// webmode set to "tv" so that we don't flip their
// interface unnecessarly
migrateTvMode = true;
} }
else if (version != m_settingsVersion) else if (version != m_settingsVersion)
{ {
@ -268,8 +264,13 @@ void SettingsComponent::loadConf(const QString& path, bool storage)
sec->setValue(setting, jsonSection.value(setting).toVariant()); sec->setValue(setting, jsonSection.value(setting).toVariant());
} }
if (migrateTvMode) if (migrateJmpSettings) {
getSection(SETTINGS_SECTION_MAIN)->setValue("webMode", "tv"); 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() bool SettingsComponent::resetAndSaveOldConfiguration()
{ {
@ -774,8 +758,6 @@ void SettingsComponent::setCommandLineValues(const QStringList& values)
{ {
QLOG_DEBUG() << values; QLOG_DEBUG() << values;
QString mode = ""; // unset, different from "auto"
for (const QString& value : values) for (const QString& value : values)
{ {
if (value == "fullscreen") if (value == "fullscreen")
@ -783,14 +765,9 @@ void SettingsComponent::setCommandLineValues(const QStringList& values)
else if (value == "windowed") else if (value == "windowed")
setValue(SETTINGS_SECTION_MAIN, "fullscreen", false); setValue(SETTINGS_SECTION_MAIN, "fullscreen", false);
else if (value == "desktop") else if (value == "desktop")
mode = "desktop"; setValue(SETTINGS_SECTION_MAIN, "layout", "desktop");
else if (value == "tv") else if (value == "tv")
mode = "tv"; setValue(SETTINGS_SECTION_MAIN, "layout", "tv");
else if (value == "auto-layout")
mode = "auto";
} }
setValue(SETTINGS_SECTION_MAIN, "layout", "auto");
setValue(SETTINGS_SECTION_MAIN, "webMode", "desktop");
} }

View File

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

View File

@ -249,12 +249,6 @@ QString SystemComponent::debugInformation()
return debugInfo; return debugInfo;
} }
/////////////////////////////////////////////////////////////////////////////////////////
int SystemComponent::networkPort() const
{
return SettingsComponent::Get().value(SETTINGS_SECTION_MAIN, "webserverport").toInt();
}
///////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////
QStringList SystemComponent::networkAddresses() const QStringList SystemComponent::networkAddresses() const
{ {
@ -273,21 +267,6 @@ QStringList SystemComponent::networkAddresses() const
return list; 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) void SystemComponent::openExternalUrl(const QString& url)
{ {
@ -347,6 +326,7 @@ QString SystemComponent::getNativeShellScript()
QJsonObject clientData; QJsonObject clientData;
clientData.insert("deviceName", QJsonValue::fromVariant(SettingsComponent::Get().getClientName())); clientData.insert("deviceName", QJsonValue::fromVariant(SettingsComponent::Get().getClientName()));
clientData.insert("scriptPath", QJsonValue::fromVariant("file:///" + path)); 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()); nativeshellString.replace("@@data@@", QJsonDocument(clientData).toJson(QJsonDocument::Compact).toBase64());
return nativeshellString; return nativeshellString;
} }

View File

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

View File

@ -142,20 +142,6 @@ QString Utils::PrimaryIPv4Address()
return ""; 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) bool Utils::safelyWriteFile(const QString& filename, const QByteArray& data)
{ {

View File

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