dotfiles

configuration files for shell, text editor, graphical environment, etc.
git clone git://src.adamsgaard.dk/dotfiles
Log | Files | Refs | README | LICENSE Back to index

commit 67692f225cac1f89908cb158c10b8673b36bccd4
parent 9e0be5d5c6909961149c9380903dc84dcbcdba25
Author: Anders Damsgaard Christensen <adc@geo.au.dk>
Date:   Fri,  9 Sep 2016 10:44:24 -0700

Merge branch 'master' of github.com:anders-dc/dotfiles

Diffstat:
Mbin/youtube-dl-music.sh | 55+++++++++++++++++++++++++++++++++++++++++++++++++++++--
Mosx-install.sh | 2++
2 files changed, 55 insertions(+), 2 deletions(-)

diff --git a/bin/youtube-dl-music.sh b/bin/youtube-dl-music.sh @@ -1,7 +1,58 @@ #!/bin/bash -youtube-dl \ +set -e +set -u + +read -p "torify? [Y/n] " -n 1 -r +echo +if [[ $REPLY =~ ^[Nn]$ ]]; then + prefix="" +else + prefix="torify" +fi + +$prefix youtube-dl \ + --format bestaudio \ + --extract-audio \ + --audio-quality 0 \ + --audio-format mp3 \ + $1 + +read -p "add metadata? [y/N] " -n 1 -r +echo +if [[ $REPLY =~ ^[Yy]$ ]]; then + + filename=$(youtube-dl \ + --get-filename \ --format bestaudio \ --extract-audio \ --audio-quality 0 \ --audio-format mp3 \ - $1 + $1) + filename=$(echo $filename | sed "s/\..*$/.mp3/") + + read -p "artist: " artist + read -p "album: " album + read -p "song: " song + read -p "track [e.g. 01]: " track + + id3v2 --artist "$artist" --album "$album" --song "$song" --track "$track" \ + "$filename" +fi + +read -p "move to music folder? [y/N] " -n 1 -r +echo +if [[ $REPLY =~ ^[Yy]$ ]]; then + + if [[ "$(uname)" == 'Darwin' ]]; then + musicroot="$HOME/Music/iTunes/iTunes Media/Music/" + else + musicroot="$HOME/music/" + fi + + outdir="$musicroot/$artist/$album" + mkdir -p "$outdir" + mv "$filename" "$outdir/$song.mp3" + + echo "updating mpd" + mpc update > /dev/null +fi diff --git a/osx-install.sh b/osx-install.sh @@ -25,6 +25,7 @@ brews=( \ "cmake"\ "ctags-exuberant"\ "emacs-mac --with-spacemacs-icon"\ + "exiftool"\ "ffmpeg"\ "fortune"\ "gdbm"\ @@ -33,6 +34,7 @@ brews=( \ "gnu-getopt"\ "gnupg"\ "htop-osx"\ + "id3v2"\ "imagemagick"\ "imapfilter"\ "libav"\