scripts

misc scripts and tools
git clone git://git.2f30.org/scripts.git
Log | Files | Refs

commit cfe2ebf1bd441a49ad2f67cf661b2904cb0b6fd2
parent 3efb5da978f6413605f0a722f53ce1193f4d23c8
Author: lostd <lostd@2f30.org>
Date:   Wed Nov  6 12:12:29 +0200

set output dir in one place

Diffstat:
ytfetch | 11++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/ytfetch b/ytfetch @@ -3,9 +3,10 @@ # Simple script to download songs from youtube and encode # them to mp3 using ffmpeg. This script also handles playlists. # -# By default the script writes the encoded files to -# $HOME/music/yt - just replace it in the code if you don't prefer -# that location. +# By default the script writes the encoded files to $HOME/music/yt +# Set the YTDIR enviroment var for a different location. + +YTDIR=$(test -n "$YTDIR" && echo "$YTDIR" || echo $HOME/music/yt) if test -z "$1"; then echo "usage: $(basename $0) yt-url..." 1>&2 @@ -25,9 +26,9 @@ for v in "$@"; do youtube-dl -o "$scratch/%(title)s.%(ext)s" "$v" done -mkdir -p $HOME/music/yt +mkdir -p $YTDIR # Encode all of them cd $scratch find . \( -name "*.mp4" -o -name "*.flv" \) -exec sh -c \ - 'ffmpeg -i "$0" "$HOME/music/yt/${0%.*}.mp3"' {} \; + 'ffmpeg -i "$0" "'$YTDIR'/${0%.*}.mp3"' {} \;