From 321a366f5e32dd08a61d4723039fa80e76b8dfbb Mon Sep 17 00:00:00 2001 From: deathbybandaid Date: Tue, 14 Mar 2023 09:41:15 -0400 Subject: [PATCH] test --- plex-token.sh | 10 ++++++---- token-local | 5 ----- token-remote | 38 -------------------------------------- 3 files changed, 6 insertions(+), 47 deletions(-) delete mode 100644 token-local delete mode 100644 token-remote diff --git a/plex-token.sh b/plex-token.sh index cacc527..a46a2b2 100644 --- a/plex-token.sh +++ b/plex-token.sh @@ -1,9 +1,11 @@ #!/bin/bash # ChuckPa already wrote a great function for getting host info -source ./DBRepair.sh show exit -# >/dev/null 2>&1 +#source ./DBRepair.sh show exit >/dev/null 2>&1 -HostConfig +PLEX_PREFERENCES_XML="/opt/plex/Library/Application Support/Plex Media Server/Preferences.xml" -echo "$AppSuppDir" +# get token +LOCAL_PLEX_TOKEN=`cat "${PREF}" | sed -e 's;^.* PlexOnlineToken=";;' | sed -e 's;".*$;;' | tail -1` + +echo "Local Token found in $PLEX_PREFERENCES_XML: $LOCAL_PLEX_TOKEN" diff --git a/token-local b/token-local deleted file mode 100644 index 68a7170..0000000 --- a/token-local +++ /dev/null @@ -1,5 +0,0 @@ -# configs -PREF="/opt/plex/Library/Application Support/Plex Media Server/Preferences.xml" - -# get token -TOKEN=`cat "${PREF}" | sed -e 's;^.* PlexOnlineToken=";;' | sed -e 's;".*$;;' | tail -1` diff --git a/token-remote b/token-remote deleted file mode 100644 index cc369fa..0000000 --- a/token-remote +++ /dev/null @@ -1,38 +0,0 @@ -if [ -z "$PLEX_LOGIN" ] || [ -z "$PLEX_PASSWORD" ]; then - PLEX_LOGIN=$1 - PLEX_PASSWORD=$2 -fi - -while [ -z "$PLEX_LOGIN" ]; do - >&2 echo -n 'Your Plex login (e-mail or username): ' - read PLEX_LOGIN -done - -while [ -z "$PLEX_PASSWORD" ]; do - >&2 echo -n 'Your Plex password: ' - read PLEX_PASSWORD -done - ->&2 echo 'Retrieving a X-Plex-Token using Plex login/password...' - -curl -qu "${PLEX_LOGIN}":"${PLEX_PASSWORD}" 'https://plex.tv/users/sign_in.xml' \ - -X POST -H 'X-Plex-Device-Name: PlexMediaServer' \ - -H 'X-Plex-Provides: server' \ - -H 'X-Plex-Version: 0.9' \ - -H 'X-Plex-Platform-Version: 0.9' \ - -H 'X-Plex-Platform: xcid' \ - -H 'X-Plex-Product: Plex Media Server'\ - -H 'X-Plex-Device: Linux'\ - -H 'X-Plex-Client-Identifier: XXXX' --compressed >/tmp/plex_sign_in -X_PLEX_TOKEN=$(sed -n 's/.*\(.*\)<\/authentication-token>.*/\1/p' /tmp/plex_sign_in) -if [ -z "$X_PLEX_TOKEN" ]; then - cat /tmp/plex_sign_in - rm -f /tmp/plex_sign_in - >&2 echo 'Failed to retrieve the X-Plex-Token.' - exit 1 -fi -rm -f /tmp/plex_sign_in - ->&2 echo "Your X_PLEX_TOKEN:" - -echo $X_PLEX_TOKEN