From f479181dae3cbc6045180ba588a75f9359504ba4 Mon Sep 17 00:00:00 2001 From: RandomNinjaAtk Date: Fri, 24 Jun 2022 14:49:44 +0000 Subject: [PATCH] v1.0.0058 - adjustments to auth processes --- root/scripts/download.sh | 35 ++++++++++++++--------------------- 1 file changed, 14 insertions(+), 21 deletions(-) diff --git a/root/scripts/download.sh b/root/scripts/download.sh index 5ee2a8d..511a563 100644 --- a/root/scripts/download.sh +++ b/root/scripts/download.sh @@ -1,5 +1,5 @@ #!/usr/bin/env bash -scriptVersion="1.0.0057" +scriptVersion="1.0.0058" lidarrUrlBase="$(cat /config/config.xml | xq | jq -r .Config.UrlBase)" if [ "$lidarrUrlBase" = "null" ]; then lidarrUrlBase="" @@ -47,7 +47,9 @@ log () { echo $m_time" "$1 } -mkdir -p /config/xdg +if [ ! -d /config/xdg ]; then + mkdir -p /config/xdg +fi Configuration () { processstartid="$(ps -A -o pid,cmd|grep "start.sh" | grep -v grep | head -n 1 | awk '{print $1}')" @@ -317,28 +319,18 @@ TidalClientSetup () { fi fi + if [ -d /config/backup ]; then + rm -rf /config/backup + fi + tidal-dl -o /downloads/lidarr-extended/incomplete DownloadFormat - # check for backup token and use it if exists - if [ ! -f /config/xdg/.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 - fi - + if [ -f /config/xdg/.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 @@ -572,14 +564,15 @@ DeemixClientSetup () { if [ -d "/tmp/deemix-imgs" ]; then rm -rf /tmp/deemix-imgs fi - downloadCount=$(find /downloads/lidarr-extended/incomplete/ -type f -regex ".*/.*\.\(flac\|opus\|m4a\|mp3\)" | wc -l) - if [ $downloadCount -le 0 ]; then + downloadCount=$(find /downloads/lidarr-extended/incomplete/ -type f -regex ".*/.*\.\(flac\|opus\|m4a\|mp3\)" | wc -l) + if [ $downloadCount -le 0 ]; then log ":: deemix client setup verification :: ERROR :: Download failed" - log ":: deemix client setup verification :: ERROR :: Please review log for errors in client" + log ":: deemix client setup verification :: ERROR :: Please review log for errors in client" + log ":: deemix client setup verification :: ERROR :: Try updating your ARL Token to possibly resolve the issue..." log ":: deemix client setup verification :: ERROR :: Exiting..." rm -rf /downloads/lidarr-extended/incomplete/* exit - else + else rm -rf /downloads/lidarr-extended/incomplete/* log ":: deemix client setup verification :: Download Verification Success" fi