diff --git a/host-specific/misaki/services.nix b/host-specific/misaki/services.nix index cbc9040..5f93605 100644 --- a/host-specific/misaki/services.nix +++ b/host-specific/misaki/services.nix @@ -769,10 +769,10 @@ in user = "noah"; package = unstable.plex.override { plexRaw = unstable.plexRaw.overrideAttrs rec { - version = "1.43.3.10896-cb3ebc72d"; + version = "1.43.4.10903-e5521bd8c"; src = unstable.fetchurl { url = "https://downloads.plex.tv/plex-media-server-new/${version}/debian/plexmediaserver_${version}_amd64.deb"; - sha256 = "sha256-qgnyZt3PQI4Qz3ulYbbkVObhCbqUFjlraWW9THnzcUk="; + sha256 = "sha256-b2ocgzbXeeHyAVGmk0NJiEutb2pmsYorGJuW5Vw7Pts="; }; }; }; diff --git a/overlays/scripts/update-plex b/overlays/scripts/update-plex index fe0c8af..96bc374 100755 --- a/overlays/scripts/update-plex +++ b/overlays/scripts/update-plex @@ -5,7 +5,25 @@ flag e + services=`{realpath `{dirname $0}^/../../host-specific/misaki/services.nix} echo Fetching latest Plex version... -version=`{curl -fsSL https://plex.tv/api/downloads/5.json | jq -r '.computer.Linux.version'} + +# Beta releases need a Plex Pass account token. Take it from the server's +# Preferences.xml when available; without a token, check the public channel. +plex_prefs='/var/lib/plex/Plex Media Server/Preferences.xml' +if (~ $PLEX_TOKEN ()) { + if (test -r $plex_prefs) { + PLEX_TOKEN=`{grep -oP '[Pp]lex(Online)?[Tt]oken="\K[^"]+' $plex_prefs} + echo Using Plex Pass token from $plex_prefs + } +} + +api=https://plex.tv/api/downloads/5.json +token_args=() +if (! ~ $PLEX_TOKEN ()) { + api=$api^'?channel=plexpass' + token_args=(-H 'X-Plex-Token: '^$PLEX_TOKEN) +} + +version=`{curl -fsSL $token_args $api | jq -r '.computer.Linux.version'} if (~ $version () null) { echo Failed to determine latest Plex version >[1=2]