|
|
@ -1,5 +1,5 @@
|
|
|
|
#!/usr/bin/env bash
|
|
|
|
#!/usr/bin/env bash
|
|
|
|
scriptVersion="1.0.006"
|
|
|
|
scriptVersion="1.0.007"
|
|
|
|
|
|
|
|
|
|
|
|
notfidedBy="Radarr"
|
|
|
|
notfidedBy="Radarr"
|
|
|
|
arrRootFolderPath="$(dirname "$radarr_movie_path")"
|
|
|
|
arrRootFolderPath="$(dirname "$radarr_movie_path")"
|
|
|
@ -40,17 +40,27 @@ if [ "$arrEventType" == "Test" ]; then
|
|
|
|
exit 0
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
# Validate connection
|
|
|
|
PlexConnectionError () {
|
|
|
|
plexVersion=$(curl -s "$plexUrl/?X-Plex-Token=$plexToken" | xq . | jq -r '.MediaContainer."@version"')
|
|
|
|
log "ERROR :: Cannot communicate with Plex"
|
|
|
|
if [ $plexVersion = null ]; then
|
|
|
|
log "ERROR :: Please check your plexUrl and plexToken"
|
|
|
|
log "$notfidedBy :: ERROR :: Cannot communicate with Plex"
|
|
|
|
log "ERROR :: Configured plexUrl \"$plexUrl\""
|
|
|
|
log "$notfidedBy :: ERROR :: Please check your plexUrl and plexToken"
|
|
|
|
log "ERROR :: Configured plexToken \"$plexToken\""
|
|
|
|
log "$notfidedBy :: ERROR :: Configured plexUrl \"$plexUrl\""
|
|
|
|
log "ERROR :: Exiting..."
|
|
|
|
log "$notfidedBy :: ERROR :: Configured plexToken \"$plexToken\""
|
|
|
|
|
|
|
|
log "$notfidedBy :: ERROR :: Exiting..."
|
|
|
|
|
|
|
|
exit
|
|
|
|
exit
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Validate connection
|
|
|
|
|
|
|
|
if curl -s "$plexUrl/?X-Plex-Token=$plexToken" | xq . &>/dev/null; then
|
|
|
|
|
|
|
|
plexVersion=$(curl -s "$plexUrl/?X-Plex-Token=$plexToken" | xq . | jq -r '.MediaContainer."@version"')
|
|
|
|
|
|
|
|
if [ "$plexVersion" == "null" ]; then
|
|
|
|
|
|
|
|
# Error out if version is null, indicates bad token
|
|
|
|
|
|
|
|
PlexConnectionError
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
log "Plex Connection Established, version: $plexVersion"
|
|
|
|
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
else
|
|
|
|
log "$notfidedBy :: Plex Connection Established, version: $plexVersion"
|
|
|
|
# Error out if error in curl | xq . command output
|
|
|
|
|
|
|
|
PlexConnectionError
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
plexLibraries="$(curl -s "$plexUrl/library/sections?X-Plex-Token=$plexToken")"
|
|
|
|
plexLibraries="$(curl -s "$plexUrl/library/sections?X-Plex-Token=$plexToken")"
|
|
|
|