blob: 41d2b443cf9d52ef39e00ce282ef5049009052b5 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
#!/usr/bin/env dash
# shellcheck source=/dev/null
SHELL_LIBRARY_VERSION="1.1.3" . %SHELL_LIBRARY_PATH
DOWN_DIR=/home/soispha/media/music/down/
tmp=$(mktmp)
config=$(mktmp)
fd . "$DOWN_DIR" --exclude spotdl.log > "$tmp";
cat << EO > "$config"
--log-level INFO
--cache-path /home/soispha/.config/spotdl/.spotipy
--audio youtube-music youtube
--lyrics genius musixmatch azlyrics
--ffmpeg ffmpeg
--format mp3
--output {artists}-{title}.{output-ext}
--overwrite skip
--client-id 5f573c9620494bae87890c0f08a60293
--client-secret 212476d9b0f3472eaa762d90b19b0ba8
--threads 16
--print-errors
--preload
EO
[ "$(wc -l "$tmp" | awk '{print $1}')" -gt 2 ] && die "something is already downloaded"
rm "${DOWN_DIR}spotdl.log"
cd "$DOWN_DIR" || die "BUG: no $DOWN_DIR"
# The sub shell needs to be unquoted, as the arguments may not be treated as one.
unbuffer spotdl $(cat "$config") download "$1" | tee "$DOWN_DIR/spotdl.log"
[ -d ~/.spotdl ] && rm -r ~/.spotdl
|