Skip to content

Instantly share code, notes, and snippets.

@zsteva
Created January 30, 2018 21:34
Show Gist options
  • Save zsteva/5af657d9b78c697130da700a4ccd648f to your computer and use it in GitHub Desktop.
Save zsteva/5af657d9b78c697130da700a4ccd648f to your computer and use it in GitHub Desktop.
#!/bin/bash
URL="https://www.youtube.com/watch?v=MnIYp-PaoXg&list=PLRtkK6TD_2LLWHeAAYnalSVCXZV0T39vu&index=1"
~/bin/youtube-dl -x -k -o "%(playlist_index)02d. %(title)s - %(id)s.%(ext)s" --audio-format "mp3" --audio-quality 0 "$URL"
for F in *.mp3; do
ARTIST="Daniel Delux"
NUM=$(echo "${F}" | sed -e 's/^\([0-9]\+\)\..*$/\1/')
TITLE=$(echo "${F}" | sed -e 's/^[0-9]\+\.\s*//' -e 's/^\(.\+\) - \(.\+\) - .*$/\2/')
ALBUM=$(echo "${F}" | sed -e 's/^[0-9]\+\.\s*//' -e 's/^\(.\+\) - \(.\+\) - .*$/\1/')
id3v2 --artist "$ARTIST" --album "$ALBUM" --song "$TITLE" --TIT3 "$TITLE" --comment "" --year "" --track "$NUM" --genre 255 "$F"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment