Skip to content

Instantly share code, notes, and snippets.

@nejni-marji
Last active August 29, 2015 14:17
Show Gist options
  • Save nejni-marji/ce52ad7b6ebbf308bd34 to your computer and use it in GitHub Desktop.
Save nejni-marji/ce52ad7b6ebbf308bd34 to your computer and use it in GitHub Desktop.
#!/bin/bash
#set -x
# {{{ Preparing files
touch /tmp/bandcamp.m3u
rm /tmp/bandcamp.m3u
youtube-dl --ignore-errors --get-title --get-url -- $1 > /tmp/bctotal
# }}}
# {{{ Making playlist
export len=`cat /tmp/bctotal | wc -l`
for i in `seq $(($len/2))`; do
export title=`sed $(($i*2-1))'q;d' /tmp/bctotal`
export url=`sed $(($i*2))'q;d' /tmp/bctotal`
echo '#EXTM3U' > /tmp/url-plist
echo '#EXTINF:,'$title >> /tmp/url-plist
echo $url >> /tmp/url-plist
cat /tmp/url-plist >> /tmp/bandcamp.m3u
done
# }}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment