summaryrefslogtreecommitdiff
path: root/yt2mp3
diff options
context:
space:
mode:
authorPatrick Simianer <p@simianer.de>2014-08-10 11:19:38 +0100
committerPatrick Simianer <p@simianer.de>2014-08-10 11:19:38 +0100
commit5869505d64c04c536bdcd71a197ade918c36bf1c (patch)
tree6af5232a9f2e058f15230a370a960f89871a2b74 /yt2mp3
init
Diffstat (limited to 'yt2mp3')
-rwxr-xr-xyt2mp321
1 files changed, 21 insertions, 0 deletions
diff --git a/yt2mp3 b/yt2mp3
new file mode 100755
index 0000000..4982bcf
--- /dev/null
+++ b/yt2mp3
@@ -0,0 +1,21 @@
+#!/bin/sh
+
+
+usage()
+{
+ echo "$0 <yt link> <mp3 file>"
+ exit 1
+}
+
+if [ -z $1 ] || [ -z $2 ]; then usage; fi
+
+TMP_FN=/tmp/youtube-dl-$RANDOM
+while [ -a $TMP_FN ]; do
+ TMP_FN=/tmp/youtube-dl-$RANDOM
+done
+echo $TMP_FN
+
+youtube-dl --output=$TMP_FN --format=18 "$1"
+ffmpeg -i $TMP_FN -acodec libmp3lame -ac 2 -ab 128k -vn -y "$2"
+rm $TMP_FN
+