1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
|
#!/bin/sh
# This file is maintained at http://git.mdcc.cx/draai
#
# Copyright: © 2008 Joost van Baal. This program is in the public domain.
# dr_file2tag - build tag info from filename
#
# example usage:
# eval `dr_file2tag 03-Wochtzchée-Sleepin_instructions_\(extract\).ogg`
#
set -e
file="$1"
# [artist-]title.{ogg,mp3}
# strip .mp3 , .ogg
file="`echo $file | sed 's/\.[^\.]*$//'`"
# strip leading 01-
file="`echo $file | sed 's/^[0-9]*-//'`"
file="`echo $file | sed 's/_/ /g'`"
artist="`echo $file | cut -d- -f1`"
if test "$artist" != "$file"
then
echo "ARTIST=$artist"
file="`echo $file | cut -d- -f2`"
fi
echo "TITLE=$file"
# oggenc(1):
# ARTIST is -a, ALBUM is -l TITLE is -t.
|