#!/bin/sh # # mp3car.sh, Copyright © 2014 Matteo Cypriani # # This program is free software. It comes without any warranty, to # the extent permitted by applicable law. You can redistribute it # and/or modify it under the terms of the Do What The Fuck You Want # To Public License, Version 2, as published by Sam Hocevar. See # http://sam.zoy.org/wtfpl/COPYING for more details. # # This script uses pacpl (Perl Audio Converter) to convert any audio # files to low-quality MP3, suitable for listening in a car (default # parameters are VBR 32-128 kbps, joint stereo). # # Dependencies: pacpl, lame if [ $# -lt 1 ] ; then echo "Usage: $0 [input [...]]" exit 1 fi BASEOUTDIR="$HOME/tmp/mp3car" LAMEOPTIONS="-v -b 32 -B 128" for INPUT in "$@" ; do echo echo "*** CONVERTING \"$INPUT\" ***" OUTDIR="$BASEOUTDIR/$(basename "$INPUT")" echo "Destination directory: \"$OUTDIR\"" echo mkdir -p "$OUTDIR" pacpl \ --to mp3 --encoder lame --defopts 0 --eopts "$LAMEOPTIONS" \ --recursive --preserve --outdir "$OUTDIR" \ "$INPUT" done