Console Last.fm player: shell-fm

Table of Contents

Configuration
Playlist script

Configuration

by ross at 18:10:13 on March 20, 2014

Last.FM has changed the API. shell-fm will not work anymore until its author update it. I am using audio/vagalume for now.

Install

# cd /home/ports/multimedia/shell-fm
# make install clean
# mkdir -p /root/.shell-fm/cache

Select sound server

shell-fm uses libao for sound output. See libao.conf(5) for details on configuration. For example, to use NAS audio server, create /usr/local/etc/libao.conf:

default_driver=nas

Edit /root/.shell-fm/shell-fm.rc:

username = login
password = passwd
np-file = /root/.shell-fm/now-playing
np-file-format = %a — %t
proxy = coffin.lan:3128

Remove proxy if you don't use any. Add default-radio = lastfm://... if you want to.

# chmod 600 /root/.shell-fm/shell-fm.rc

Add to /etc/rc.conf:

shellfm_enable="YES"

Create /usr/local/etc/rc.d/shell-fm:

#!/bin/sh

# PROVIDE: shellfm
# REQUIRE: DAEMON nasd
# BEFORE:  LOGIN

. /etc/rc.subr

name="shellfm"
rcvar=`set_rcvar`
command="/usr/local/bin/shell-fm"

start_precmd="shellfm_prestart"

shellfm_prestart()
{
        export HOME="/root"
#       Optionaly redirect sound using NAS:
#        export AUDIOSERVER="tcp/slim.lan:8000"
        rm -f /root/.shell-fm/now-playing
}

load_rc_config $name

: ${shellfm_enable="NO"}
: ${shellfm_flags="-d -i localhost"}

run_rc_command "$1"

My shell-fm plays through NAS. If yours don't or you haven't created rc.d script for it remove nasd from REQUIRE.

# chmod a+x /usr/local/etc/rc.d/shell-fm
# service shell-fm start

Controlling the player

Install net/nc. Now you can assign to your multimedia keys for example:

echo 'play lastfm://globaltags/rock' | nc localhost 54311

You can find network interface commands and examples of URL format in shell-fm man page.

 

Comments