Update download.sh

pull/6/head
RandomNinjaAtk 2 years ago committed by GitHub
parent a93dcf2ccc
commit 811db13fd9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -21,7 +21,7 @@ TidalClientSetup () {
cp /scripts/tidal-dl.json /config/xdg/.tidal-dl.json cp /scripts/tidal-dl.json /config/xdg/.tidal-dl.json
chmod 777 -R /config/xdg/ chmod 777 -R /config/xdg/
fi fi
tidal-dl -o /downloads/lidarr/incomplete tidal-dl -o /downloads/lidarr-extended/incomplete
tidal-dl -r P1080 tidal-dl -r P1080
tidal-dl -q HiFi tidal-dl -q HiFi
fi fi
@ -57,15 +57,15 @@ TidalClientSetup () {
DownloadProcess () { DownloadProcess () {
downloadedAlbumTitleClean="$(echo "$downloadedAlbumTitle" | sed -e "s%[^[:alpha:][:digit:]._' ]% %g" -e "s/ */ /g" | sed 's/^[.]*//' | sed 's/[.]*$//g' | sed 's/^ *//g' | sed 's/ *$//g')" downloadedAlbumTitleClean="$(echo "$downloadedAlbumTitle" | sed -e "s%[^[:alpha:][:digit:]._' ]% %g" -e "s/ */ /g" | sed 's/^[.]*//' | sed 's/[.]*$//g' | sed 's/^ *//g' | sed 's/ *$//g')"
if [ ! -d "/downloads/lidarr" ]; then if [ ! -d "/downloads/lidarr-extended" ]; then
mkdir -p /downloads/lidarr mkdir -p /downloads/lidarr-extended
chmod 777 /downloads/lidarr chmod 777 /downloads/lidarr-extended
chown abc:abc /downloads/lidarr chown abc:abc /downloads/lidarr-extended
fi fi
if [ ! -d "/downloads/lidarr/incomplete" ]; then if [ ! -d "/downloads/lidarr-extended/incomplete" ]; then
mkdir -p /downloads/lidarr/incomplete mkdir -p /downloads/lidarr-extended/incomplete
chmod 777 /downloads/lidarr/incomplete chmod 777 /downloads/lidarr-extended/incomplete
chown abc:abc /downloads/lidarr/incomplete chown abc:abc /downloads/lidarr-extended/incomplete
fi fi
if [ ! -d "/config/extended/logs" ]; then if [ ! -d "/config/extended/logs" ]; then
@ -90,23 +90,23 @@ DownloadProcess () {
mkdir -p /config/extended/logs/downloaded/tidal mkdir -p /config/extended/logs/downloaded/tidal
chmod 777 /config/extended/logs/downloaded/tidal chmod 777 /config/extended/logs/downloaded/tidal
chown abc:abc /config/extended/logs/downloaded/tidal chown abc:abc /config/extended/logs/downloaded/tidal
fi fi
if [ ! -d "/downloads/lidarr/incomplete" ]; then if [ ! -d "/downloads/lidarr-extended/incomplete" ]; then
mkdir -p /downloads/lidarr/incomplete mkdir -p /downloads/lidarr-extended/incomplete
chmod 777 /downloads/lidarr/incomplete chmod 777 /downloads/lidarr-extended/incomplete
chown abc:abc /downloads/lidarr/incomplete chown abc:abc /downloads/lidarr-extended/incomplete
else else
rm -rf /downloads/lidarr/incomplete/* rm -rf /downloads/lidarr-extended/incomplete/*
fi fi
if [ "$2" = "DEEZER" ]; then if [ "$2" = "DEEZER" ]; then
deemix -b flac -p /downloads/lidarr/incomplete "https://www.deezer.com/us/album/$1" deemix -b flac -p /downloads/lidarr-extended/incomplete "https://www.deezer.com/us/album/$1"
if [ -d "/tmp/deemix-imgs" ]; then if [ -d "/tmp/deemix-imgs" ]; then
rm -rf /tmp/deemix-imgs rm -rf /tmp/deemix-imgs
fi fi
touch /config/extended/logs/downloaded/deezer/$1 touch /config/extended/logs/downloaded/deezer/$1
downloadCount=$(find /downloads/lidarr/incomplete/ -type f -regex ".*/.*\.\(flac\|opus\|m4a\|mp3\)" | wc -l) downloadCount=$(find /downloads/lidarr-extended/incomplete/ -type f -regex ".*/.*\.\(flac\|opus\|m4a\|mp3\)" | wc -l)
if [ $downloadCount -le 0 ]; then if [ $downloadCount -le 0 ]; then
log ":: $processNumber of $wantedListAlbumTotal :: $lidarrArtistNameSanitized :: $lidarrAlbumTitle :: ERROR :: download failed" log ":: $processNumber of $wantedListAlbumTotal :: $lidarrArtistNameSanitized :: $lidarrAlbumTitle :: ERROR :: download failed"
return return
@ -114,7 +114,7 @@ DownloadProcess () {
elif [ "$2" = "TIDAL" ]; then elif [ "$2" = "TIDAL" ]; then
tidal-dl -l "https://tidal.com/browse/album/$1" tidal-dl -l "https://tidal.com/browse/album/$1"
touch /config/extended/logs/downloaded/tidal/$1 touch /config/extended/logs/downloaded/tidal/$1
downloadCount=$(find /downloads/lidarr/incomplete/ -type f -regex ".*/.*\.\(flac\|opus\|m4a\|mp3\)" | wc -l) downloadCount=$(find /downloads/lidarr-extended/incomplete/ -type f -regex ".*/.*\.\(flac\|opus\|m4a\|mp3\)" | wc -l)
if [ $downloadCount -le 0 ]; then if [ $downloadCount -le 0 ]; then
log ":: $processNumber of $wantedListAlbumTotal :: $lidarrArtistNameSanitized :: $lidarrAlbumTitle :: ERROR :: download failed" log ":: $processNumber of $wantedListAlbumTotal :: $lidarrArtistNameSanitized :: $lidarrAlbumTitle :: ERROR :: download failed"
return return
@ -137,19 +137,19 @@ DownloadProcess () {
chmod 777 /downloads/lidarr/complete chmod 777 /downloads/lidarr/complete
chown abc:abc /downloads/lidarr/complete chown abc:abc /downloads/lidarr/complete
fi fi
mkdir -p "/downloads/lidarr/complete/$downloadedAlbumFolder" mkdir -p "/downloads/lidarr-extended/complete/$downloadedAlbumFolder"
mv "$file" "/downloads/lidarr/complete/$downloadedAlbumFolder"/ mv "$file" "/downloads/lidarr-extended/complete/$downloadedAlbumFolder"/
done done
chmod 777 "/downloads/lidarr/complete/$downloadedAlbumFolder" chmod 777 "/downloads/lidarr-extended/complete/$downloadedAlbumFolder"
chown abc:abc "/downloads/lidarr/complete/$downloadedAlbumFolder" chown abc:abc "/downloads/lidarr-extended/complete/$downloadedAlbumFolder"
chmod 666 "/downloads/lidarr/complete/$downloadedAlbumFolder"/* chmod 666 "/downloads/lidarr-extended/complete/$downloadedAlbumFolder"/*
chown abc:abc "/downloads/lidarr/complete/$downloadedAlbumFolder"/* chown abc:abc "/downloads/lidarr-extended/complete/$downloadedAlbumFolder"/*
ProcessWithBeets "/downloads/lidarr/complete/$downloadedAlbumFolder" "${albumquality^^}" "$2" ProcessWithBeets "/downloads/lidarr-extended/complete/$downloadedAlbumFolder" "${albumquality^^}" "$2"
if [ -d "/downloads/lidarr/complete/$downloadedAlbumFolder" ]; then if [ -d "/downloads/lidarr-extended/complete/$downloadedAlbumFolder" ]; then
NotifyLidarrForImport "/downloads/lidarr/complete/$downloadedAlbumFolder" NotifyLidarrForImport "/downloads/lidarr-extended/complete/$downloadedAlbumFolder"
fi fi
rm -rf /downloads/lidarr/incomplete/* rm -rf /downloads/lidarr/incomplete/*
} }

Loading…
Cancel
Save