Skip to content
Blake Grotewold edited this page Mar 10, 2014 · 2 revisions

Use this script to scrobble using lastfmsubmitd. This is just a draft and doesn't really work, because it has to monitor the playing state.

#!/bin/bash
 
LASTFMSUBMIT=/usr/lib/lastfmsubmitd/lastfmsubmit
 
function map_args () {
    case "$1" in
    duration)            echo "length" ;;
    musicbrainz_trackid) echo "mbid"   ;;
    *)                   echo "$1"     ;;
    esac
}
 
args=()
while [ $# -ge 2 ] ; do
    case "$1" in
    artist|album|title|duration|musicbrainz_trackid)
        args=("${args[@]}" "--$(map_args "$1")" "$2")
        ;;
    esac
    shift 2
done
 
$LASTFMSUBMIT "${args[@]}"