aboutsummaryrefslogtreecommitdiff
path: root/local/bin/music-dl
blob: a16cd97091074466dc39eb101bcdbba444636137 (plain)
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
#!/bin/sh

conf_filename=music-dl.conf

error() {
    echo "Error: $1"
    return 1
}

fatal() {
    error "$1"
    exit 1
}

[ ! -f "$conf_filename" ] && fatal "'$conf_filename' not found in current directory"

conf_get() {
    key="$1"
    matches="$(sed -n 's/^'"$key"'=\(.*\)$/\1/ p' $conf_filename)"
    if [ -z "$matches" ]
    then
        error "'$key' not found in '$conf_filename'"
        return 1
    fi
    echo "$matches" | tail -n 1
}

conf_get bonjour || echo pas bien
conf_get aurevoir


# ytdl='youtube-dl --output "%(title)s.%(ext)s"'
# ytdlp='youtube-dl --audio-format mp3 -i --output "%(playlist_index)s-%(title)s.%(ext)s"'
# ytdla='youtube-dl --audio-format mp3 -i -x -f bestaudio/best --output "%(playlist_index)s-%(title)s.%(ext)s"'