Skip to content

Commit

Permalink
token / plexpatrol
Browse files Browse the repository at this point in the history
  • Loading branch information
MrDoobPG authored and MrDoobPG committed Nov 25, 2019
1 parent e5f969d commit e3cb0f0
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 26 deletions.
14 changes: 10 additions & 4 deletions menu/plexpatrol/plexpatrol.sh
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,14 @@ badinput() {
question1
}

#######################################################################################
### Remove old folder and create first layout for token
section0(){
sect0="/var/plexguide/plexpatrol/plex.token"
if [[ ! -f $sect0 ]]; then
bash /opt/plexguide/menu/plexpatrol/token.sh
else question1 ; fi
}
bash /opt/plexguide/menu/plexpatrol/token.sh && oldvalue ; fi
}
#########################################################################################

selection1() {
tee <<-EOF
Expand Down Expand Up @@ -240,7 +242,7 @@ EOF
}
# FIRST QUESTION
question1() {

deploycheck
video=$(cat /var/plexguide/plexpatrol/video.transcodes)
video4k=$(cat /var/plexguide/plexpatrol/video.transcodes4k)
ips=$(cat /var/plexguide/plexpatrol/multiple.ips)
Expand All @@ -254,6 +256,9 @@ question1() {
🚀 Plex - Patrol Interface || l3uddz/plex_patrol
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Plex Token [ $pstatus ]
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
[1] Instantly Kick Video Transcodes? [ $video ]
[2] Instantly Kick Video 4k Transcodes? [ $video4k ]
Expand Down Expand Up @@ -304,3 +309,4 @@ variable /var/plexguide/plexpatrol/check.interval "NON-SET"
variable /var/plexguide/plexpatrol/multiple.ips "NON-SET"
variable /var/plexguide/plexpatrol/kick.minutes "NON-SET"
deploycheck
question1
15 changes: 10 additions & 5 deletions menu/plexpatrol/remove-plexpatrol.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,24 +11,29 @@
gather_facts: false
tasks:
# FACTS ######################################################################
#when: not config.stat.exists
- name: Check Service's Existance
stat:
path: '/etc/systemd/system/plexpatrol.service'
register: pgp
ignore_errors: yes
- name: Stop service
service:
name: plexpatrol
state: stopped
when: pgp.stat.exists
ignore_errors: yes
- name: Daemon-PTS-Patrol stop
- name: Daemon-Plex-Patrol stop
systemd: state=stopped name=plexpatrol daemon_reload=yes enabled=no
ignore_errors: yes
- name: Remove Basic Directories
- name: Remove old and new Basic Directories
file: 'path={{item}} state=absent mode=0775 owner=1000 group=1000'
with_items:
- '/opt/appdata/plexpatrol/'
- '/opt/pgpatrol/'
- '/opt/appdata/pgpatrol/'
- '/var/plexguide/pgpatrol'
- '/var/plexguide/plexpatrol'
- '/etc/systemd/system/plexpatrol.service'
- '/var/plexguide/plexpatrol'
- '/etc/systemd/system/pgpatrol.service'
19 changes: 2 additions & 17 deletions menu/plexpatrol/token.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,28 +21,14 @@ badinput2() {
question2
}

tokenstatus() {
ptokendep=$(cat /var/plexguide/plexpatrol/plex.token)
if [ "$ptokendep" != "" ]; then
PGSELFTEST=$(curl -LI "http://localhost:32400/system?X-Plex-Token=$(cat /var/plexguide/plexpatrol/plex.token)" -o /dev/null -w '%{http_code}\n' -s)
if [[ $PGSELFTEST -ge 200 && $PGSELFTEST -le 299 ]]; then
pstatus="✅ DEPLOYED"
else
pstatus="❌ DEPLOYED BUT TOKEN FAILED"
fi
else pstatus="⚠️ NOT DEPLOYED"; fi
}

question1() {
tee <<-EOF
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
🌎 PlexToken Generator
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Token Status : [$pstatus]
[ 1 ] - Generate new Token for Plex Patrol
Generate new Token for Plex Patrol
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
EOF
Expand Down Expand Up @@ -130,7 +116,7 @@ if [ -z "$X_PLEX_TOKEN" ]; then
fi
echo $X_PLEX_TOKEN >/var/plexguide/plexpatrol/plex.token

token=$(cat /var/plexguide/plex.token)
token=$(cat /var/plexguide/plexpatrol/plex.token)
if [ "$token" != "" ]; then
tee <<-EOF
Expand All @@ -155,5 +141,4 @@ EOF
}

# FUNCTIONS END ##############################################################
tokenstatus
question1

0 comments on commit e3cb0f0

Please sign in to comment.