Update download.sh

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

@ -11,46 +11,48 @@ log () {
} }
mkdir -p /config/xdg mkdir -p /config/xdg
touch /config/xdg.tidal-dl.log
if [ ! -f /config/xdg/.tidal-dl.json ]; then
log "TIDAL :: No default config found, importing default config \"tidal.json\""
if [ -f /scripts/tidal-dl.json ]; then
cp /scripts/tidal-dl.json /config/xdg/.tidal-dl.json
chmod 777 -R /config/xdg/
fi
tidal-dl -o /downloads/lidarr/incomplete
tidal-dl -r P1080
tidal-dl -q HiFi
fi
# check for backup token and use it if exists TidalClientSetup () {
if [ ! -f /root/.tidal-dl.token.json ]; then touch /config/xdg/.tidal-dl.log
if [ -f /config/backup/tidal-dl.token.json ]; then if [ ! -f /config/xdg/.tidal-dl.json ]; then
cp -p /config/backup/tidal-dl.token.json /root/.tidal-dl.token.json log "TIDAL :: No default config found, importing default config \"tidal.json\""
# remove backup token if [ -f /scripts/tidal-dl.json ]; then
rm /config/backup/tidal-dl.token.json cp /scripts/tidal-dl.json /config/xdg/.tidal-dl.json
chmod 777 -R /config/xdg/
fi
tidal-dl -o /downloads/lidarr/incomplete
tidal-dl -r P1080
tidal-dl -q HiFi
fi fi
fi
if [ -f /root/.tidal-dl.token.json ]; then # check for backup token and use it if exists
if [[ $(find "/config/xdg/.tidal-dl.token.json" -mtime +6 -print) ]]; then if [ ! -f /root/.tidal-dl.token.json ]; then
log "TIDAL :: ERROR :: Token expired, removing..." if [ -f /config/backup/tidal-dl.token.json ]; then
rm /config/xdg/.tidal-dl.token.json cp -p /config/backup/tidal-dl.token.json /root/.tidal-dl.token.json
else # remove backup token
# create backup of token to allow for container updates rm /config/backup/tidal-dl.token.json
if [ ! -d /config/backup ]; then
mkdir -p /config/backup
fi fi
cp -p /config/xdg/.tidal-dl.token.json /config/backup/tidal-dl.token.json
fi fi
fi
if [ ! -f /config/xdg/.tidal-dl.token.json ]; then if [ -f /root/.tidal-dl.token.json ]; then
log "TIDAL :: ERROR :: Loading client for required authentication, please authenticate, then exit the client..." if [[ $(find "/config/xdg/.tidal-dl.token.json" -mtime +6 -print) ]]; then
tidal-dl log "TIDAL :: ERROR :: Token expired, removing..."
fi rm /config/xdg/.tidal-dl.token.json
else
# create backup of token to allow for container updates
if [ ! -d /config/backup ]; then
mkdir -p /config/backup
fi
cp -p /config/xdg/.tidal-dl.token.json /config/backup/tidal-dl.token.json
fi
fi
if [ ! -f /config/xdg/.tidal-dl.token.json ]; then
log "TIDAL :: ERROR :: Loading client for required authentication, please authenticate, then exit the client..."
tidal-dl
fi
}
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')"
@ -157,22 +159,22 @@ NotifyLidarrForImport () {
log ":: $processNumber of $wantedListAlbumTotal :: $lidarrArtistNameSanitized :: $lidarrAlbumTitle :: LIDARR IMPORT NOTIFICATION SENT! :: $1" log ":: $processNumber of $wantedListAlbumTotal :: $lidarrArtistNameSanitized :: $lidarrAlbumTitle :: LIDARR IMPORT NOTIFICATION SENT! :: $1"
} }
DeemixClientSetup () {
if [ ! -z "$arlToken" ]; then if [ ! -z "$arlToken" ]; then
# Create directories # Create directories
mkdir -p /config/{cache,logs} mkdir -p /config/{cache,logs}
if [ -f "/config/xdg/deemix/.arl" ]; then if [ -f "/config/xdg/deemix/.arl" ]; then
rm "/config/xdg/deemix/.arl" rm "/config/xdg/deemix/.arl"
fi fi
if [ ! -f "/config/xdg/deemix/.arl" ]; then if [ ! -f "/config/xdg/deemix/.arl" ]; then
echo -n "$arlToken" > "/config/xdg/deemix/.arl" echo -n "$arlToken" > "/config/xdg/deemix/.arl"
fi
log "ARL Token: Configured"
else
log "ERROR: arlToken setting invalid, currently set to: $arlToken"
fi fi
log "ARL Token: Configured"
else
log "ERROR: arlToken setting invalid, currently set to: $arlToken"
fi fi
GetMissingCutOffList () { GetMissingCutOffList () {
log "Downloading missing list..." log "Downloading missing list..."
missingAlbumIds=$(curl -s "$lidarrUrl/api/v1/wanted/missing?page=1&pagesize=1000000000&sortKey=releaseDate&sortDirection=desc&apikey=${lidarrApiKey}" | jq -r '.records | .[] | .id') missingAlbumIds=$(curl -s "$lidarrUrl/api/v1/wanted/missing?page=1&pagesize=1000000000&sortKey=releaseDate&sortDirection=desc&apikey=${lidarrApiKey}" | jq -r '.records | .[] | .id')
@ -694,7 +696,13 @@ LidarrTaskStatusCheck () {
done done
} }
if [ "$dlClientSource" = "deezer" ] || [ "$dlClientSource" = "tidal" ] || [ "$dlClientSource" = "both" ];then if [ "$dlClientSource" = "deezer" ] || [ "$dlClientSource" = "both" ]; then
DeemixClientSetup
if [ "$dlClientSource" = "tidal" ] || [ "$dlClientSource" = "both" ]; then
TidalClientSetup
fi
if [ "$dlClientSource" = "deezer" ] || [ "$dlClientSource" = "tidal" ] || [ "$dlClientSource" = "both" ]; then
GetMissingCutOffList GetMissingCutOffList
SearchProcess SearchProcess
else else

Loading…
Cancel
Save