This repository has been archived on 2021-03-24. You can view files and clone it, but cannot push or open issues or pull requests.
2019-04-29 17:32:59 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
set -euf -o pipefail
|
|
|
|
|
2020-03-29 19:16:35 +00:00
|
|
|
youtube-dl --add-metadata -icx --no-cache-dir --no-call-home --audio-format mp3 --audio-quality 0 --prefer-ffmpeg --no-post-overwrites --geo-bypass -o "/mnt/remote/%(artist)s/%(album)s/%(artist)s - %(album)s - %(track_number)d%(track)s.%(ext)s" "$1"
|
2019-04-29 22:20:27 +00:00
|
|
|
|
2019-06-23 03:48:32 +00:00
|
|
|
echo "Trying to get cover..."
|
2019-04-29 22:20:27 +00:00
|
|
|
HTML_TEMP=$(mktemp)
|
|
|
|
curl -s "$1" > "$HTML_TEMP"
|
|
|
|
titulo=$(grep -Po "<title>.*</title>" "$HTML_TEMP" | sed 's/<[^>]*>//g')
|
2019-04-29 17:32:59 +00:00
|
|
|
disco=${titulo% | *}
|
|
|
|
grupo=${titulo#* | }
|
2020-03-29 19:16:35 +00:00
|
|
|
sed -n '/image_/s/.*rel="image_src"\s\+href="\([^"]\+\).*/\1/p' "$HTML_TEMP" | xargs -r curl -s --create-dirs -o "/mnt/remote/${grupo}/${disco}/cover.jpg" && echo "Got it" || echo "Failed :("
|