added debug mode to mkplaylist

This commit is contained in:
Eric Phillips
2010-10-03 19:36:35 -06:00
parent f28e0a93d0
commit a7ae22e64f
+20 -9
View File
@@ -1,19 +1,30 @@
#!/bin/bash #!/bin/bash
#usage mkplaylist.sh listname(optional) audiodir(optional) #usage mkplaylist.sh listname(optional) audiodir(optional)
#or if $1 = debug BASEDIR will have /tmp prepended
#variables #variables
BASEDIR="/media/sdb1" BASEDIR="/media/sansa"
BASEDIR="/tmp/sdb1/" #uncomment to test or debug
DATE=`date +%m%d` DATE=`date +%m%d`
LISTNAME="podcast-${DATE}" LISTNAME="podcast-${DATE}"
AUDIODIR="${LISTNAME}" AUDIODIR="${LISTNAME}"
TMPFILE="/tmp/podcast-${DATE}.tmp" TMPFILE="/tmp/podcast-${DATE}.tmp"
#print variables for debugging
echo ${BASEDIR} #set debug mode and create some dirs in /tmp
echo ${DATE} #for testing and/or debugging
echo ${LISTNAME} if [[ $1 == "debug" ]]
echo ${AUDIODIR} then
echo ${TMPFILE} BASEDIR="/tmp${BASEDIR}"
mkdir -p "${BASEDIR}/MUSIC/${AUDIODIR}"
mkdir "${BASEDIR}/PLAYLISTS"
echo ${BASEDIR}
echo ${DATE}
echo ${LISTNAME}
echo ${AUDIODIR}
echo ${TMPFILE}
shift
echo "$@"
echo "$1"
fi
#mk tmp playlist #mk tmp playlist
echo "PLP PLAYLIST" > ${TMPFILE} echo "PLP PLAYLIST" > ${TMPFILE}
@@ -28,5 +39,5 @@ done
# convert playlist for use on sansa e280 and copy it there # convert playlist for use on sansa e280 and copy it there
unix2dos ${TMPFILE} unix2dos ${TMPFILE}
iconv -f ASCII -t UTF16LE -o "${BASEDIR}PLAYLISTS/${LISTNAME}.PLA" ${TMPFILE} iconv -f ASCII -t UTF16LE -o "${BASEDIR}/PLAYLISTS/${LISTNAME}.PLA" ${TMPFILE}
rm ${TMPFILE} rm ${TMPFILE}