#!/usr/bin/env bash
# shell-fm helper
#* lastfm://user/${user}/loved
#* lastfm://user/${user}/personal
#* lastfm://usertags/${user}/${usertag}
#* lastfm://artist/${artist}/similarartists
#* lastfm://artist/${artist}/fans
#* lastfm://globaltags/${globaltag}
killall -9 shell-fm
function usage() {
printf "Usage: %s: [-u username] [[-p(ersonal)] [-l(oved)]] [-g globaltag] [-a artist]\n" $(basename $0) >&2
}
command="lastfm:/"
artflag=
while getopts 'u:plg:a' OPTION
do
case $OPTION in
u) command="$command/user/$OPTARG"
;;
l) command="$command/loved"
break
;;
p) command="$command/personal"
break
;;
a) artflag=1
command="$command/artist/$artist"
break
;;
?) usage
exit 2
;;
esac
done
#printf "Remaining arguments are: %s\n" "$*"
shift $(($OPTIND - 1))
rest=""
if [ $artflag ]
then
while [ $# -ge 1 ]; do
if [ "$rest" != "" ]; then
rest="$rest+"
fi
rest="$rest${1}"
shift
done
fi
shell-fm -d $command$rest
(In order to use you need to install also a small "shell-fm" application.)
No comments:
Post a Comment