Skip to content

Commit

Permalink
Update plex_pw.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
MrDoobPG authored and MrDoobPG committed Nov 20, 2019
1 parent 6d7d333 commit 7c10761
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion menu/plex_dupe/scripts/plex_pw.sh
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,27 @@ EOF
question3() {
echo "$pw" >/var/plex_dupe/plex.pw
echo "$user" >/var/plex_dupe/plex.user
ansible-playbook /opt/plexguide/menu/plex_dupe/scripts/token.yml
PLEX_LOGIN=$(cat /var/plex_dupe/plex.user)
PLEX_PASSWORD=$(cat /var/plex_dupe/plex.pw)

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>\(.*\)<\/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
echo $X_PLEX_TOKEN >/var/plex_dupe/plex.token

token=$(cat /var/plex_dupe/plex.token)
if [ "$token" != "" ]; then
tee <<-EOF
Expand Down

0 comments on commit 7c10761

Please sign in to comment.