aboutsummaryrefslogtreecommitdiff
path: root/local/bin/music-dl
diff options
context:
space:
mode:
authorCharles Cabergs <me@cacharle.xyz>2021-02-24 17:07:33 +0100
committerCharles Cabergs <me@cacharle.xyz>2021-02-24 17:07:33 +0100
commit468a789dbc4b1928c035d8590895efc533520a27 (patch)
tree74cb056c37eaa50cd50491a7665608488ed4feb1 /local/bin/music-dl
parentf9883d2c3b3699d91e98feeffd7eece546f7c57e (diff)
downloaddotfiles-468a789dbc4b1928c035d8590895efc533520a27.tar.gz
dotfiles-468a789dbc4b1928c035d8590895efc533520a27.tar.bz2
dotfiles-468a789dbc4b1928c035d8590895efc533520a27.zip
Updated file tree to match XDG base directory specification
Diffstat (limited to 'local/bin/music-dl')
-rwxr-xr-xlocal/bin/music-dl34
1 files changed, 34 insertions, 0 deletions
diff --git a/local/bin/music-dl b/local/bin/music-dl
new file mode 100755
index 0000000..a16cd97
--- /dev/null
+++ b/local/bin/music-dl
@@ -0,0 +1,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"'