Skip to content

Commit

Permalink
plex_auto_scan
Browse files Browse the repository at this point in the history
register parts
  • Loading branch information
MrDoobPG authored and MrDoobPG committed Nov 2, 2019
1 parent e47c88a commit 418d654
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 11 deletions.
15 changes: 9 additions & 6 deletions menu/pgscan/scripts/plex_token.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,14 @@ if [ -z "$X_PLEX_TOKEN" ]; then
fi
cp -r $template $templatebackup
echo $X_PLEX_TOKEN >/var/plexguide/plex.token
#sed -i 's/plex_auth_token/'$X_PLEX_TOKEN'/g' $template
#use jq instead.
jq '.PLEX_TOKEN = "$X_PLEX_TOKEN"' $template | sponge $template

RAN=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1)
#sed -i 's/plex_autoscan_server_pass/'$RAN'/g' $template
#use jq instead
jq '.SERVER_PASS = "$RAN"' $template | sponge $template
echo $RAN >/var/plexguide/pgscan.serverpass


# #sed -i 's/plex_auth_token/'$X_PLEX_TOKEN'/g' $template
# #use jq instead.
# jq '.PLEX_TOKEN = "$X_PLEX_TOKEN"' $template | sponge $template
# #sed -i 's/plex_autoscan_server_pass/'$RAN'/g' $template
# #use jq instead
# jq '.SERVER_PASS = "$RAN"' $template | sponge $template
20 changes: 20 additions & 0 deletions menu/roles/plex_autoscan/tasks/subtasks/settings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,26 @@
mode: 0775
force: yes

- name: Recall User
shell: 'cat /var/plexguide/plex.user'
register: user

- name: Token Recall
shell: 'cat /var/plexguide/plex.token'
register: plex_auth_token

- name: Register IP
shell: 'cat /var/plexguide/server.ip'
register: ipaddress

- name: plex_auto_scan server pass
shell: 'cat /var/plexguide/pgscan.serverpass'
register: plex_autoscan_server_pass

- name: kick 4k Transcodes
shell: 'cat /var/plexguide/pgpatrol/video.transcodes4k'
register: video4k

when: not plex_autoscan_config.stat.exists

- name: Settings | Existing 'config.json' tasks
Expand Down
8 changes: 4 additions & 4 deletions menu/roles/plex_autoscan/templates/config.json.j2
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"PLEX_EMPTY_TRASH_MAX_FILES":100,
"PLEX_EMPTY_TRASH_ZERO_DELETED":false,
"PLEX_LD_LIBRARY_PATH":"/usr/lib/plexmediaserver/lib",
"PLEX_LOCAL_URL": "http://localhost:32400",
"PLEX_LOCAL_URL": "http://{{ipaddress.stdout}}:32400",
"PLEX_SCANNER":"/usr/lib/plexmediaserver/Plex\\ Media\\ Scanner",
"PLEX_SECTION_PATH_MAPPINGS":{
"1":[
Expand All @@ -54,8 +54,8 @@
]
},
"PLEX_SUPPORT_DIR":"/var/lib/plexmediaserver/Library/Application\\ Support",
"PLEX_USER":"plex",
"PLEX_TOKEN":"plex_auth_token",
"PLEX_USER":"{{user.stdout}}",
"PLEX_TOKEN":"{{plex_auth_token.stdout}}",
"PLEX_CHECK_BEFORE_SCAN":true,
"PLEX_WAIT_FOR_EXTERNAL_SCANNERS":false,
"RCLONE": {
Expand Down Expand Up @@ -89,7 +89,7 @@
"Thumbs.db"
],
"SERVER_IP":"0.0.0.0",
"SERVER_PASS":"plex_autoscan_server_pass",
"SERVER_PASS":"{{plex_autoscan_server_pass.stdout}}",
"SERVER_PATH_MAPPINGS":{
"/mnt/":[
"/mnt/"
Expand Down
2 changes: 1 addition & 1 deletion menu/tools/tools.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ function gcheck() {
⛔️ WARNING! - Must Configure RClone First /w >>> gdrive
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
NOTE: You must deploy PG Move or PG Blitz in order to use the backup
NOTE: You must deploy Move or Blitz in order to use the backup
function. GDrive configuration is required to move data!
EOF
Expand Down

0 comments on commit 418d654

Please sign in to comment.