From 418d654123b842014f3ae57d8fc43747b1a17a81 Mon Sep 17 00:00:00 2001 From: MrDoobPG <46342172+MrDoobPG@users.noreply.github.com> Date: Sat, 2 Nov 2019 14:24:01 +0100 Subject: [PATCH] plex_auto_scan register parts --- menu/pgscan/scripts/plex_token.sh | 15 ++++++++------ .../plex_autoscan/tasks/subtasks/settings.yml | 20 +++++++++++++++++++ .../plex_autoscan/templates/config.json.j2 | 8 ++++---- menu/tools/tools.sh | 2 +- 4 files changed, 34 insertions(+), 11 deletions(-) diff --git a/menu/pgscan/scripts/plex_token.sh b/menu/pgscan/scripts/plex_token.sh index fdc07397..d3d8531d 100644 --- a/menu/pgscan/scripts/plex_token.sh +++ b/menu/pgscan/scripts/plex_token.sh @@ -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 diff --git a/menu/roles/plex_autoscan/tasks/subtasks/settings.yml b/menu/roles/plex_autoscan/tasks/subtasks/settings.yml index 3e7846d4..97915529 100644 --- a/menu/roles/plex_autoscan/tasks/subtasks/settings.yml +++ b/menu/roles/plex_autoscan/tasks/subtasks/settings.yml @@ -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 diff --git a/menu/roles/plex_autoscan/templates/config.json.j2 b/menu/roles/plex_autoscan/templates/config.json.j2 index 08fc51c8..e220db43 100644 --- a/menu/roles/plex_autoscan/templates/config.json.j2 +++ b/menu/roles/plex_autoscan/templates/config.json.j2 @@ -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":[ @@ -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": { @@ -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/" diff --git a/menu/tools/tools.sh b/menu/tools/tools.sh index 5f3f5e4e..46235756 100644 --- a/menu/tools/tools.sh +++ b/menu/tools/tools.sh @@ -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