Jag har iallafall knåpat ihop ett script för att underlätta spellistehantering i mpd, och det ser ut som följer;
Kod: Markera allt
#!/bin/sh
# mpdfav
# WTFPL etc.
#
# Feel free to patch and send me the diff
## Thu Sep 17 18:14:03 CEST 2009
# fixed 'bug' with empty id3-tags and retarded people who cannot spell
#
## Sat Sep 12 07:57:56 CEST 2009
# Creating playlists based on date was pretty useless for me; instead, it now
# reads the 'genre'-id3-tag.
# First off, some nice colors ey?
GRAY="\033[1;30m"
LIGHT_GRAY="\033[0;37m"
CYAN="\033[0;36m"
LIGHT_CYAN="\033[1;36m"
ORANGE="\033[1;31m"
NO_COLOR="\033[0m"
BOLD="\033[1m"
# Where do you want your playlists hidden?
LISTDIR=/mnt/Music_1/Playlists
GENRE=$(mpc --format %genre%|head -1)
# If called with an argument, that'll be the name of the playlist
if [ "$1" ];
then
NAME="$1.m3u"
elif [ -z $GENRE ];
then
NAME="random.m3u"
else
NAME="$(echo $GENRE|tr A-Z a-z|sed 's/[Pp]sychadelic/psychedelic/').m3u"
fi
# Check if file exists ...
if [ -f "$LISTDIR/$NAME" ];
then
mpc --format %file%|head -1 >> "$LISTDIR/$NAME"
# If not... (some people claim this is useless since >> would automagically
# create the file if it does not exist)
else
mpc --format %file%|head -1 > "$LISTDIR/$NAME"
fi
echo -e "$BOLD $ORANGE
CONTENT: $NO_COLOR\n
$CYAN`cat "$LISTDIR/$NAME"`$NO_COLOR \n$ORANGE
`cat "$LISTDIR/$NAME"|wc -l`$NO_COLOR tracks in $GRAY "$LISTDIR/$NAME"
$NO_COLOR
$BOLD $ORANGE
Latest: $NOCOLOR$CYAN`cat "$LISTDIR/$NAME"|tail -1`$NO_COLOR
"
Kod: Markera allt
NAME="$(echo $GENRE|tr A-Z a-z|sed 's/[Pp]sychadelic/psychedelic/').m3u"