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
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
if [ ! -f /root/.tidal-dl.token.json ]; then
if [ -f /config/backup/tidal-dl.token.json ]; then
cp -p /config/backup/tidal-dl.token.json /root/.tidal-dl.token.json
# remove backup token
rm /config/backup/tidal-dl.token.json
TidalClientSetup () {
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
fi
if [ -f /root/.tidal-dl.token.json ]; then
if [[ $(find "/config/xdg/.tidal-dl.token.json" -mtime +6 -print) ]]; then
log "TIDAL :: ERROR :: Token expired, removing..."
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
# check for backup token and use it if exists
if [ ! -f /root/.tidal-dl.token.json ]; then
if [ -f /config/backup/tidal-dl.token.json ]; then
cp -p /config/backup/tidal-dl.token.json /root/.tidal-dl.token.json
# remove backup token
rm /config/backup/tidal-dl.token.json
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
if [ -f /root/.tidal-dl.token.json ]; then
if [[ $(find "/config/xdg/.tidal-dl.token.json" -mtime +6 -print) ]]; then
log "TIDAL :: ERROR :: Token expired, removing..."
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 () {
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"
}
if [ ! -z "$arlToken" ]; then
# Create directories
mkdir -p /config/{cache,logs}
if [ -f "/config/xdg/deemix/.arl" ]; then
rm "/config/xdg/deemix/.arl"
fi
if [ ! -f "/config/xdg/deemix/.arl" ]; then
echo -n "$arlToken" > "/config/xdg/deemix/.arl"
DeemixClientSetup () {
if [ ! -z "$arlToken" ]; then
# Create directories
mkdir -p /config/{cache,logs}
if [ -f "/config/xdg/deemix/.arl" ]; then
rm "/config/xdg/deemix/.arl"
fi
if [ ! -f "/config/xdg/deemix/.arl" ]; then
echo -n "$arlToken" > "/config/xdg/deemix/.arl"
fi
log "ARL Token: Configured"
else
log "ERROR: arlToken setting invalid, currently set to: $arlToken"
fi
log "ARL Token: Configured"
else
log "ERROR: arlToken setting invalid, currently set to: $arlToken"
fi
GetMissingCutOffList () {
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')
@ -694,7 +696,13 @@ LidarrTaskStatusCheck () {
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
SearchProcess
else

Loading…
Cancel
Save