mirror of
https://github.com/mrworf/plexupdate.git
synced 2025-08-19 04:49:34 -07:00
Added support for non-plexpass
It's now possible to use this tool to download the public version by supplying the -p option. Also renamed the tool to something more fitting. Signed-off-by: Henric Andersson <ha@sensenet.nu>
This commit is contained in:
parent
d686f94e68
commit
41f1b147fc
1 changed files with 27 additions and 16 deletions
|
@ -1,10 +1,12 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
#
|
#
|
||||||
# PlexPass Linux Server download tool v2.3
|
# Plex Linux Server download tool v2.4
|
||||||
# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
# This tool will login to the Plex homepage, locate the PlexPass
|
# This tool will download the latest version of Plex Media
|
||||||
# Plex Media Server for Linux and download it.
|
# Server for Linux. It supports both the public versions
|
||||||
|
# as well as the PlexPass versions.
|
||||||
#
|
#
|
||||||
|
# PlexPass users:
|
||||||
# Either modify this file to add email and password OR create
|
# Either modify this file to add email and password OR create
|
||||||
# a separate .plexupdate file in your home directory with these
|
# a separate .plexupdate file in your home directory with these
|
||||||
# values.
|
# values.
|
||||||
|
@ -30,7 +32,7 @@
|
||||||
# resiliance to HTML changes and also better error handling
|
# resiliance to HTML changes and also better error handling
|
||||||
# 2.3 Now reads an optional config file to avoid having to
|
# 2.3 Now reads an optional config file to avoid having to
|
||||||
# modify this script.
|
# modify this script.
|
||||||
#
|
# 2.4 Added support for the public versions of PMS
|
||||||
|
|
||||||
#################################################################
|
#################################################################
|
||||||
# Set these two to what you need, or create a .plexupdate file
|
# Set these two to what you need, or create a .plexupdate file
|
||||||
|
@ -51,27 +53,24 @@ fi
|
||||||
# Current pages we need
|
# Current pages we need
|
||||||
URL_LOGIN=https://plex.tv/users/sign_in
|
URL_LOGIN=https://plex.tv/users/sign_in
|
||||||
URL_DOWNLOAD=https://plex.tv/downloads?channel=plexpass
|
URL_DOWNLOAD=https://plex.tv/downloads?channel=plexpass
|
||||||
|
URL_DOWNLOAD_PUBLIC=https://plex.tv/downloads
|
||||||
|
|
||||||
# Defaults
|
# Defaults
|
||||||
RELEASE="64-bit"
|
RELEASE="64-bit"
|
||||||
KEEP=no
|
KEEP=no
|
||||||
FORCE=no
|
FORCE=no
|
||||||
|
PUBLIC=no
|
||||||
# Sanity check
|
|
||||||
if [ "${EMAIL}" == "" -o "${PASS}" == "" ]; then
|
|
||||||
echo "Error: No email and/or password provided, please edit me."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Parse commandline
|
# Parse commandline
|
||||||
set -- $(getopt fhko: -- "$@")
|
set -- $(getopt fhko: -- "$@")
|
||||||
while true;
|
while true;
|
||||||
do
|
do
|
||||||
case "$1" in
|
case "$1" in
|
||||||
(-h) echo -e "Usage: $(basename $0) [-fhko]\n\nf = Force download even if it exists (WILL NOT OVERWRITE)\nh = This help\nk = Reuse last authentication\no = 32-bit version (default 64 bit)\n"; exit 0;;
|
(-h) echo -e "Usage: $(basename $0) [-fhkop]\n\nf = Force download even if it exists (WILL NOT OVERWRITE)\nh = This help\nk = Reuse last authentication\no = 32-bit version (default 64 bit)\np = Public Plex Media Server version"; exit 0;;
|
||||||
(-f) FORCE=yes;;
|
(-f) FORCE=yes;;
|
||||||
(-k) KEEP=yes;;
|
(-k) KEEP=yes;;
|
||||||
(-o) RELEASE="32-bit";;
|
(-o) RELEASE="32-bit";;
|
||||||
|
(-p) PUBLIC=yes;;
|
||||||
(--) ;;
|
(--) ;;
|
||||||
(-*) echo "Error: unrecognized option $1" 1>&2; exit 1;;
|
(-*) echo "Error: unrecognized option $1" 1>&2; exit 1;;
|
||||||
(*) break;;
|
(*) break;;
|
||||||
|
@ -79,6 +78,13 @@ do
|
||||||
shift
|
shift
|
||||||
done
|
done
|
||||||
|
|
||||||
|
# Sanity check
|
||||||
|
if [ "${EMAIL}" == "" -o "${PASS}" == "" ] && [ "${PUBLIC}" == "no" ]; then
|
||||||
|
echo "Error: Need username & password to download PlexPass version. Otherwise run with -p to download public version."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
# Useful functions
|
# Useful functions
|
||||||
rawurlencode() {
|
rawurlencode() {
|
||||||
local string="${1}"
|
local string="${1}"
|
||||||
|
@ -114,7 +120,7 @@ keypair() {
|
||||||
# commit Sign in
|
# commit Sign in
|
||||||
|
|
||||||
# If user wants, we skip authentication, but only if previous auth exists
|
# If user wants, we skip authentication, but only if previous auth exists
|
||||||
if [ "${KEEP}" != "yes" -o ! -f /tmp/kaka ]; then
|
if [ "${KEEP}" != "yes" -o ! -f /tmp/kaka ] && [ "${PUBLIC}" == "no" ]; then
|
||||||
echo -n "Authenticating..."
|
echo -n "Authenticating..."
|
||||||
# Clean old session
|
# Clean old session
|
||||||
rm /tmp/kaka 2>/dev/null
|
rm /tmp/kaka 2>/dev/null
|
||||||
|
@ -147,6 +153,11 @@ if [ "${KEEP}" != "yes" -o ! -f /tmp/kaka ]; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
echo "OK"
|
echo "OK"
|
||||||
|
else
|
||||||
|
# It's a public version, so change URL and make doubly sure that cookies are empty
|
||||||
|
rm 2>/dev/null >/dev/null /tmp/kaka
|
||||||
|
touch /tmp/kaka
|
||||||
|
URL_DOWNLOAD=${URL_DOWNLOAD_PUBLIC}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Extract the URL for our release
|
# Extract the URL for our release
|
Loading…
Add table
Add a link
Reference in a new issue