## Author: Steve Youngs <steve@steveyoungs.com>
## Maintainer: Steve Youngs <steve@steveyoungs.com>
## Created: <2006-08-08>
-## Time-stamp: <Sunday Jun 19, 2011 12:21:40 steve>
+## Time-stamp: <Sunday Jun 19, 2011 16:47:17 steve>
## Redistribution and use in source and binary forms, with or without
## modification, are permitted provided that the following conditions
[ -a ALBUM ] [ --album=ALBUM ] [ -s ARTIST ] [ --sameartist=ARTIST ]
[ -t ENCODING_TYPE ] [ --type=ENCODING_TYPE ] [ -f | --flac_copy ]
[ -e FILE | --edit_rcfile=FILE ] [ -O | --online ] [ -d DIR | --dir=DIR ]
+ [ -p PLAYLISTFILE | --playlist=PLAYLISTFILE ]
$ourname
[ -h | --help ]
$ourname
--online
Attempt to grab the track info from freedb.freedb.org.
+ -p PLAYLISTFILE
+ --playlist=PLAYLISTFILE
+ Write a playlist file to PLAYLISTFILE. Argument PLAYLISTFILE
+ is _NOT_ optional, and should be given as the full path to the
+ file.
+
-r FILE
--rcfile=FILE
Get track titles and artist names from FILE. Argument FILE
fi
# create an rcfile
+ :>$rcfile # make sure it is empty
+
+ for (( i=0; i<$tracks; i++ )); do
+ TRACK=""
+ for TITLE in $(grep TTITLE${i}= ${zlog}|cut -d= -f2); do
+ TRACK="${TRACK} ${TITLE}"
+ done
+ TRACK=${TRACK//[[:cntrl:]]/}
+ TRACK=${TRACK/[[:space:]]/}
+ echo ${TRACK} >> ${rcfile}
+ done
+
if [[ $various == yes || -n $(grep TTITLE $zlog|grep $art) ]]; then
- grep TTITLE $zlog|cut -d= -f2|sed 's@ [-/] @|@' > $rcfile
+ sed -i 's@ [-/] @|@g' $rcfile
else
- grep TTITLE $zlog|cut -d= -f2 > $rcfile
sed -i "s@^@${art}|@g" $rcfile
fi
--ty $year --tg $genre --tc $zcomment $wavfile \
--tn $i ${dir}/$filename[$i]
fi
+ [[ $write_playlist == yes ]] && echo ${dir}$filename[$i] >> $plfile
fi
[[ -f $wavfile ]] && rm -f $wavfile
done
-N $i $wavfile
rm $wavfile
fi
+ [[ $write_playlist == yes ]] && echo ${dir}/$filename[$i] >> $plfile
fi
done
}
# Command line parsing
-args=mofihVO-:r:a:s:t:e:d:
+args=mofihVO-:r:a:s:t:e:d:p:
flavour=0
rc=0
interactive=no
(album?*) album=${OPTARG/album=/} ;;
(sameartist?*) art=${OPTARG/sameartist=/} ;;
(dir?*) dir=${OPTARG/dir=/} ;;
+ (playlist?*) write_playlist=yes; plfile=${OPTARG/playlist=/} ;;
(version) _version; exit 0 ;;
(help) cmd=usage; rv=0 ;;
(*)
(s) art=$OPTARG ;;
(t) atype=$OPTARG; (( ++flavour )) ;;
(d) dir=$OPTARG ;;
+ (p) write_playlist=yes; plfile=$OPTARG ;;
(V) _version; exit 0 ;;
(h) cmd=usage; rv=0 ;;
(*) rv=2 ;;