@ -12,48 +12,46 @@ mkdir -p /config/xdg
touch /config/xdg.tidal-dl.log
touch /config/xdg.tidal-dl.log
if [ ! -f /config/xdg/.tidal-dl.json ] ; then
if [ ! -f /config/xdg/.tidal-dl.json ] ; then
log "TIDAL :: No default config found, importing default config \"tidal.json\""
log "TIDAL :: No default config found, importing default config \"tidal.json\""
if [ -f /scripts/tidal-dl.json ] ; then
if [ -f /scripts/tidal-dl.json ] ; then
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/incomplete
tidal-dl -r P1080
tidal-dl -r P1080
tidal-dl -q HiFi
tidal-dl -q HiFi
fi
fi
# check for backup token and use it if exists
# check for backup token and use it if exists
if [ ! -f /root/.tidal-dl.token.json ] ; then
if [ ! -f /root/.tidal-dl.token.json ] ; then
if [ -f /config/backup/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
cp -p /config/backup/tidal-dl.token.json /root/.tidal-dl.token.json
# remove backup token
# remove backup token
rm /config/backup/tidal-dl.token.json
rm /config/backup/tidal-dl.token.json
fi
fi
fi
fi
if [ -f /root/.tidal-dl.token.json ] ; then
if [ -f /root/.tidal-dl.token.json ] ; then
if [ [ $( find "/config/xdg/.tidal-dl.token.json" -mtime +6 -print) ] ] ; then
if [ [ $( find "/config/xdg/.tidal-dl.token.json" -mtime +6 -print) ] ] ; then
log "TIDAL :: ERROR :: Token expired, removing..."
log "TIDAL :: ERROR :: Token expired, removing..."
rm /config/xdg/.tidal-dl.token.json
rm /config/xdg/.tidal-dl.token.json
else
else
# create backup of token to allow for container updates
# create backup of token to allow for container updates
if [ ! -d /config/backup ] ; then
if [ ! -d /config/backup ] ; then
mkdir -p /config/backup
mkdir -p /config/backup
fi
cp -p /config/xdg/.tidal-dl.token.json /config/backup/tidal-dl.token.json
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 /config/xdg/.tidal-dl.token.json ] ; then
log "TIDAL :: ERROR :: Loading client for required authentication, please authenticate, then exit the client..."
log "TIDAL :: ERROR :: Loading client for required authentication, please authenticate, then exit the client..."
tidal-dl
tidal-dl
fi
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' ) "
if [ ! -d "/downloads/lidarr" ] ; then
if [ ! -d "/downloads/lidarr" ] ; then
mkdir -p /downloads/lidarr
mkdir -p /downloads/lidarr