Skip to content

Commit

Permalink
Update pgscan.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
MrDoobPG authored and MrDoobPG committed Oct 23, 2019
1 parent adecbf2 commit 6b970a9
Showing 1 changed file with 17 additions and 20 deletions.
37 changes: 17 additions & 20 deletions menu/pgscan/pgscan.sh
Original file line number Diff line number Diff line change
Expand Up @@ -67,26 +67,6 @@ badinput() {
question1
}

# Print Plex Autoscan URL
showupdomain() {
#If SERVER_IP is 0.0.0.0, assign public IP address to REAL_IP.
SERVER_IP=$(ip a | grep glo | awk '{print $2}' | head -1 | cut -f1 -d/)
SUBDOMAIN=$(cat /var/plexguide/server.domain)
PAS_CONFIG="/opt/appdata/pgscan/config/config.json"

SERVER_IP=$(cat ${PAS_CONFIG} | jq -r .SERVER_IP)
SERVER_PORT=$(cat ${PAS_CONFIG} | jq -r .SERVER_PORT)
SERVER_PASS=$(cat ${PAS_CONFIG} | jq -r .SERVER_PASS)

if (( SIMPLE - 1 )); then
echo "Your Plex Autoscan URL:"
echo "http://${SUBDOMAIN}:${SERVER_PORT}/${SERVER_PASS}"
echo ""
else
echo http://${SUBDOMAIN}:${SERVER_PORT}/${SERVER_PASS}
fi
}

# FIRST QUESTION
question1() {

Expand All @@ -111,12 +91,29 @@ EOF
ansible-playbook /opt/plexguide/menu/pgscan/pgscan.yml
ansible-playbook /opt/plexguide/menu/pgscan/alias/alias.yml
question1
elif [ "$typed" == "2" ]; then
showupdomain
elif [[ "$typed" == "Z" || "$typed" == "z" ]]; then
exit
else badinput; fi
}
showupdomain() {
#If SERVER_IP is 0.0.0.0, assign public IP address to REAL_IP.
SERVER_IP=$(ip a | grep glo | awk '{print $2}' | head -1 | cut -f1 -d/)
SUBDOMAIN=$(cat /var/plexguide/server.domain)
PAS_CONFIG="/opt/appdata/pgscan/config/config.json"

SERVER_IP=$(cat ${PAS_CONFIG} | jq -r .SERVER_IP)
SERVER_PORT=$(cat ${PAS_CONFIG} | jq -r .SERVER_PORT)
SERVER_PASS=$(cat ${PAS_CONFIG} | jq -r .SERVER_PASS)

if (( SIMPLE - 1 )); then
echo "Your Plex Autoscan URL:"
echo "http://${SUBDOMAIN}:${SERVER_PORT}/${SERVER_PASS}"
echo ""
else
echo http://${SUBDOMAIN}:${SERVER_PORT}/${SERVER_PASS}
fi
tee <<-EOF
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Expand Down

0 comments on commit 6b970a9

Please sign in to comment.