1.0.3 - Use Variable for paths, no hardcode

- Change: LidarrAudiobookRootFolder -> lidarrAudiobookRootFolder for consistency
- Add spacing to make easier to read
- Adjust error checking process
pull/80/head
RandomNinjaAtk 2 years ago committed by GitHub
parent 9f4dfd5d57
commit 26b527fb01
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1,5 +1,5 @@
#!/usr/bin/env bash
scriptVersion="1.0.2"
scriptVersion="1.0.3"
agent="ERA ( https://github.com/Makario1337/ExtendedReleaseAdder )"
ArtistsJSON=$(jq '.artists[]' /config/artists.json)
@ -20,7 +20,7 @@ if [ -z "$lidarrUrl" ] || [ -z "$lidarrApiKey" ]; then
lidarrUrl="http://127.0.0.1:${lidarrPort}${lidarrUrlBase}"
fi
LidarrAudiobookRootFolder=$(curl -s GET "$lidarrUrl/api/v1/rootFolder" -H "X-Api-Key: ${lidarrApiKey}" | grep '\/audiobooks\/')
log "-----------------------------------------------------------------------------"
log " |\/| _ | _ ._o _ '|~/~/~/"
log " | |(_||<(_|| |(_) |_)_)/ "
@ -44,16 +44,18 @@ log "3"; sleep 1
log "2"; sleep 1
log "1"; sleep 1
if [ -z "$LidarrAudiobookRootFolder" ]; then
log "ERROR :: Audiobooks folder doesn't exist... "
if [ ! -d "$lidarrAudiobookRootFolder" ]; then
log "ERROR :: Audiobooks \"$lidarrAudiobookRootFolder\" folder doesn't exist... "
log "ERROR :: Check your Docker path mappings..."
log "ERROR :: Exiting ERA..."
exit
fi
if [ ! -d "/audiobooks" ]; then
log "ERROR :: Audiobooks folder doesn't exist... "
log "ERROR :: Check your Docker path mappings..."
lidarrAudiobookRootFolderCheck=$(curl -s GET "$lidarrUrl/api/v1/rootFolder" -H "X-Api-Key: ${lidarrApiKey}" | grep "$lidarrAudiobookRootFolder")
if [ -z "$lidarrAudiobookRootFolderCheck" ]; then
log "ERROR :: Audiobooks \"$lidarrAudiobookRootFolder\" is not added to Lidarr as a root folder... "
log "ERROR :: Add \"$lidarrAudiobookRootFolder\" to Lidarr as a root folder"
log "ERROR :: Exiting ERA..."
exit
fi
@ -107,6 +109,7 @@ log "Adding :: $artist"
sleep 1.5
SearchAllReleasesForArtist $search
}
if [ -z "$ArtistsJSON" ]
then
log "ERROR :: Did not find /config/artists.json or no artists in file... "

Loading…
Cancel
Save