From 870d6e17e67d2c3810697ef336e2aafea0bc61b8 Mon Sep 17 00:00:00 2001 From: Makario1337 <74052988+Makario1337@users.noreply.github.com> Date: Sat, 10 Dec 2022 16:49:26 +0100 Subject: [PATCH 1/3] Update run --- root/etc/services.d/extended_era/run | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/root/etc/services.d/extended_era/run b/root/etc/services.d/extended_era/run index 7b08c9b..1fd25d2 100644 --- a/root/etc/services.d/extended_era/run +++ b/root/etc/services.d/extended_era/run @@ -9,7 +9,7 @@ fi echo "Starting Script...." for (( ; ; )); do let i++ - bash /config/extended/scripts/ERA.sh + bash /config/extended/scripts/ERA.bash echo "Script sleeping for 24 hours..." sleep 24h done From d9f57dbe9fedf56bcb078d152a93690bbccfd971 Mon Sep 17 00:00:00 2001 From: Makario1337 <74052988+Makario1337@users.noreply.github.com> Date: Sat, 10 Dec 2022 16:50:06 +0100 Subject: [PATCH 2/3] Rename ERA + Removing previous downloads from logs --- root/scripts/{ERA.sh => ERA.bash} | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) rename root/scripts/{ERA.sh => ERA.bash} (90%) diff --git a/root/scripts/ERA.sh b/root/scripts/ERA.bash similarity index 90% rename from root/scripts/ERA.sh rename to root/scripts/ERA.bash index 1e8ed00..c9f799f 100644 --- a/root/scripts/ERA.sh +++ b/root/scripts/ERA.bash @@ -1,5 +1,5 @@ #!/usr/bin/env bash -scriptVersion="1.1.2" +scriptVersion="1.1.3" agent="ERA ( https://github.com/Makario1337/ExtendedReleaseAdder )" ### DEBUG ### @@ -69,8 +69,8 @@ AddReleaseToLidarr() { sed 's/"qualityProfileId": 0/"qualityProfileId": 1/g' | sed 's/"metadataProfileId": 0/"metadataProfileId": 1/g' | sed "s%\"metadataProfileId\": 1%\"metadataProfileId\": 1,\"rootFolderPath\": \"\" %g" | - sed 's/"metadataProfileId": 1/"metadataProfileId": 1,\"addOptions": {"monitor": "all","searchForMissingAlbums": false}/g' | - sed 's/"grabbed": false/"grabbed": false,\"addOptions": {"searchForNewAlbum": false}/g'| + sed 's/"metadataProfileId": 1/"metadataProfileId": 1,\"addOptions": {"monitor": "all","searchForMissingAlbums": true}/g' | + sed 's/"grabbed": false/"grabbed": false,\"addOptions": {"searchForNewAlbum": true}/g'| jq '.' | cut -c 2- | head -c -2) @@ -128,7 +128,6 @@ for artist in ${ERAArtistsList[@]}; do trim=$(echo $line | cut -c 2- | head -c -2) ReleaseName=$(wget -U "$agent" --timeout=0 -q -O - "https://musicbrainz.org/ws/2/release-group/$trim" | grep -o ".*" | sed 's///g' | head -c -9) AddReleaseToLidarr $trim "$artistname" "$ReleaseName" - sleep 1.5 done fi done @@ -138,14 +137,23 @@ RefreshArtists() { log "Refreshing all ERA artists, so new releasegroup entrys can be added" for artists in $RefreshArtistList do - curl -s -X POST "$lidarrUrl/api/v1/command" -H "accept: text/plain" -H "Content-Type: application/json" -H "X-Api-Key: $lidarrApiKey" -d "{\"name\":\"RefreshArtist\",\"artistId\":$artists}" - sleep 1.5 + curl -s -X POST "$lidarrUrl/api/v1/command" -H "accept: text/plain" -H "Content-Type: application/json" -H "X-Api-Key: $lidarrApiKey" -d "{\"name\":\"RefreshArtist\",\"artistId\":$artists}" + sleep 1.5 + done +} + +CleanPreviousDownloads() { + + for artist in ${ERAArtistsList[@]}; do + log "cleaning $artist" + find /config/extended/logs/notfound -type f -name '*$(echo $artist | tail -c +2 | head -c -2 )*' -delete done } SearchAllArtistsByTag CheckIfCollectedArtistsAreInLidarrInstance ArtistLookupAndCallAddReleaseToLidarr +CleanPreviousDownloads RefreshArtists log "DONE :: Finishing..." exit From 4fcaac45ad706c9daf8b522a1ff71018a5613e7a Mon Sep 17 00:00:00 2001 From: Makario1337 <74052988+Makario1337@users.noreply.github.com> Date: Sat, 10 Dec 2022 16:51:36 +0100 Subject: [PATCH 3/3] Update ERA.bash --- root/scripts/ERA.bash | 1 + 1 file changed, 1 insertion(+) diff --git a/root/scripts/ERA.bash b/root/scripts/ERA.bash index c9f799f..e82d8d8 100644 --- a/root/scripts/ERA.bash +++ b/root/scripts/ERA.bash @@ -128,6 +128,7 @@ for artist in ${ERAArtistsList[@]}; do trim=$(echo $line | cut -c 2- | head -c -2) ReleaseName=$(wget -U "$agent" --timeout=0 -q -O - "https://musicbrainz.org/ws/2/release-group/$trim" | grep -o "<title>.*" | sed 's///g' | head -c -9) AddReleaseToLidarr $trim "$artistname" "$ReleaseName" + sleep 1.5 done fi done