|
|
@ -17,7 +17,11 @@ fi
|
|
|
|
|
|
|
|
|
|
|
|
plexLibraries="$(curl -s "$plexUrl/library/sections?X-Plex-Token=$plexToken" | xq .)"
|
|
|
|
plexLibraries="$(curl -s "$plexUrl/library/sections?X-Plex-Token=$plexToken" | xq .)"
|
|
|
|
if echo "$plexLibraries" | grep "$lidarrRootFolderPath" | read; then
|
|
|
|
if echo "$plexLibraries" | grep "$lidarrRootFolderPath" | read; then
|
|
|
|
plexlibrarykey="$(echo "$plexLibraries" | jq -r ".MediaContainer.Directory[] | select(.Location.\"@path\"==\"$lidarrRootFolderPath\") | .\"@key\"" | head -n 1)"
|
|
|
|
if echo "$plexLibraries" | jq -r ".MediaContainer.Directory[] | select(.Location.\"@path\"==\"$lidarrRootFolderPath\") | .\"@key\"" | head -n 1 &>/dev/null; then
|
|
|
|
|
|
|
|
plexlibrarykey="$(echo "$plexLibraries" | jq -r ".MediaContainer.Directory[] | select(.Location.\"@path\"==\"$lidarrRootFolderPath\") | .\"@key\"" | head -n 1)"
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
plexlibrarykey="$(echo "$plexLibraries" | jq -r ".MediaContainer.Directory | select(.Location.\"@path\"==\"$lidarrRootFolderPath\") | .\"@key\"" | head -n 1)"
|
|
|
|
|
|
|
|
fi
|
|
|
|
if [ -z "$plexlibrarykey" ]; then
|
|
|
|
if [ -z "$plexlibrarykey" ]; then
|
|
|
|
log "ERROR: No Plex Library key found for \"$lidarrRootFolderPath\""
|
|
|
|
log "ERROR: No Plex Library key found for \"$lidarrRootFolderPath\""
|
|
|
|
exit 1
|
|
|
|
exit 1
|
|
|
|