bundlewrap/bundles/mixcloud-downloader/files/download.sh

77 lines
1.7 KiB
Bash
Raw Permalink Normal View History

#!/bin/bash
OPTS="--netrc"
OPTS="$OPTS --netrc-location /opt/mixcloud-downloader/netrc"
OPTS="$OPTS --retry-sleep linear=1::2"
OPTS="$OPTS --retry-sleep fragment:exp=1:60"
OPTS="$OPTS --extractor-retries 5"
if [[ -n "$DEBUG" ]]
then
set -x
else
OPTS="$OPTS -q"
fi
set -euo pipefail
if ! [[ -d /opt/mixcloud-downloader/venv ]]
then
virtualenv -p python3 /opt/mixcloud-downloader/venv
fi
source /opt/mixcloud-downloader/venv/bin/activate
pip install --upgrade pip yt-dlp
errors=0
2024-01-21 10:17:05 +00:00
for i in Neosignal tasmo starkato b4m ProjectPoltergeist jakehunnter davem_dokebi El1s4
do
echo "> mixcloud $i" >&2
if ! [[ -d "/storage/nas/Musik/mixcloud/$i" ]]
then
# no -p here, this should fail if
# zfs is not mounted
mkdir "/storage/nas/Musik/mixcloud/$i"
fi
(
cd "/storage/nas/Musik/mixcloud/$i"
yt-dlp $OPTS "https://mixcloud.com/$i"
echo $? >&2
) || errors=1
done
for i in CouchsofaLiveSets
do
echo "> archive.org $i" >&2
if ! [[ -d "/storage/nas/Musik/mixcloud/$i" ]]
then
# no -p here, this should fail if
# zfs is not mounted
mkdir "/storage/nas/Musik/mixcloud/$i"
fi
(
cd "/storage/nas/Musik/mixcloud/$i"
yt-dlp $OPTS "https://archive.org/details/$i"
echo $? >&2
) || errors=1
done
for i in tschunkelmusik zotanmew
do
echo "> soundcloud $i" >&2
if ! [[ -d "/storage/nas/Musik/mixcloud/$i" ]]
then
# no -p here, this should fail if
# zfs is not mounted
mkdir "/storage/nas/Musik/mixcloud/$i"
fi
(
cd "/storage/nas/Musik/mixcloud/$i"
yt-dlp $OPTS "https://soundcloud.com/$i"
echo $? >&2
) || errors=1
done
exit $errors