Graceful exit when plexToken not configured

pull/6/head
RandomNinjaAtk 3 years ago committed by GitHub
parent 338fe8d56f
commit b742a0d161
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1,13 +1,11 @@
#!/usr/bin/env bash
lidarrApiKey="$(grep "<ApiKey>" /config/config.xml | sed "s/\ <ApiKey>//;s/<\/ApiKey>//")"
lidarrUrl="http://127.0.0.1:8686"
lidarrRootFolderPath="$(dirname "$lidarr_artist_path")"
exec &>> "/config/logs/PlexNotify.txt"
chmod 777 "/config/logs/PlexNotify.txt"
log () {
m_time=`date "+%F %T"`
echo $m_time" "$1
echo $m_time" :: "$1
}
if [ "$lidarr_eventtype" == "Test" ]; then
@ -15,6 +13,11 @@ if [ "$lidarr_eventtype" == "Test" ]; then
exit 0
fi
if [ -z "$plexToken" ]; then
log "ERROR :: Plex Token Not configured"
exit
fi
plexLibraries="$(curl -s "$plexUrl/library/sections?X-Plex-Token=$plexToken" | xq .)"
if echo "$plexLibraries" | grep "$lidarrRootFolderPath" | read; then
if echo "$plexLibraries" | jq -r ".MediaContainer.Directory[] | select(.Location.\"@path\"==\"$lidarrRootFolderPath\") | .\"@key\"" &>/dev/null; then

Loading…
Cancel
Save