Find file
Fetching contributors…
Cannot retrieve contributors at this time
610 lines (608 sloc) 16.4 KB
.TH "shell-fm" 1
Shell.FM \- Lightweight, console-based player for Last.FM radio streams.
.B shell-fm
[-d] [-i address] [-p port] [-b] [-D device] [-y proxy] [-Y socks-proxy] [-h] lastfm://...
Shell.FM is a lightweight, console-based player for radio streams provided by
.B \-d
Fork to background (requires a socket interface to be set up so it can still be
controlled somehow).
.B \-q
Enable quiet mode, which suppresses startup messages.
.B \-i <address>
Enable the socket interface and bind it to the given host address (should be
the host name or IP address of the host shell-fm is running on).
.B \-p <port>
Make the socket interface listen for incoming connections on the given port.
Default is 54311.
.B \-b
Enable batch mode (some freaky mode that makes shell-fm easier to handle from
inside emacs). This was not my idea.
.B \-D <device>
Use the given device file as audio device. This is only used if libao support
is disabled. Default is /dev/audio.
.B \-y <proxy>
Make shell-fm use the given host as proxy server for HTTP requests.
.B \-Y <SOCKS proxy>
Make shell-fm use the given host as SOCKS proxy server for HTTP requests.
The following command uses OpenSSH to create a port forwarding to a remote
OpenSSH server acting as a SOCKS proxy server:
ssh -Nf -D
.B \-h
Print help text and exit.
.B lastfm://...
URI of a Last.FM radio stream to play after startup.
For example: `shell-fm -d lastfm://artist/The%20Beatles/similarartists'
On startup, shell-fm will ask you for your Last.FM login and password
(if not
provided in your ~/.shell-fm/shell-fm.rc). If you've given a stream URI on the
command line or there is a default radio defined in the configuration file,
shell-fm will now try to play it. When the startup is done, there are lots of
keys to control shell-fm. Here is a alphabetically sorted list.
.B a
Add the currently played track to your Last.FM playlist.
.B A
Ban the artist of the currently played track. Whenever a track of that artist
is played from now on, it is automatically banned.
.B B
Ban the currently played track.
.B d
Enabled/disable discovery mode. I'm not sure if this has any effect, and it
looks like even the Last.FM guys don't really know what it does, but I think it
is meant to ensure that you get only tracks that you don't know yet.
.B f
Jump to the fan radio station of the artist of the currently played track.
.B h
List bookmarks.
.B H
Bookmark the currently played radio station.
.B g [bookmark letter]
Go to bookmarked station.
.B i
Print some more information about the currently played track.
.B l
Love the currently played track.
.B n
Skip the currently played track.
.B p
Pause. If you pause too long, the stream will break, which has the same effect
as stopping the stream (see below).
.B P
Enable/disable reporting played tracks to your Last.FM profile. Enabled by default.
.B Q
.B r
Change radio station. This will prompt you for an Last.FM radio station URI.
The tabulator key helps if you don't know what to type. Arrow-Up and Arrow-Down
allow you to browse your radio history. Enter these without the
"lastfm://" prefix.
For example: `radio url> globaltags/world'
.B R
Recommend the currently played track/artist/album to another Last.FM user.
.B S
Stop playing.
.B s
Jump to the similar artists radio stream of the currently played tracks artist.
.B T
Tag the currently played track/artist/album. Tabulator key completes known
.B U
Unlove the currently played track.
.B u
Print upcoming tracks in playlist.
.B +
Increase volume.
.B -
Decrease volume.
.B m
Before you start, you should have created the directories
.B ~/.shell-fm
.B ~/.shell-fm/cache
or you will get a lot of warnings, the tab-completion will be extremely
slow and you can't make use of some features (auto-ban, history, bookmarks).
You might also want to place a configuration file in
.B ~/.shell-fm
for a faster startup.
This section describes the syntax and options for the shell-fm configuration
file. The file should be placed in
.B ~/.shell-fm/shell-fm.rc
and should consist of simple
.B key = value
See (far) below for a sample configuration. These are the available options.
.B username = your-login
This is your login on Last.FM. If this is provided, shell-fm won't ask you for
it on startup anymore.
.B password = your-password
This is your (clear text) Last.FM password. If this and your login is provided
in the configuration, shell-fm won't ask you on startup.
.B password-md5 = your-password-md5
An MD5 hash of your Last.FM password. This can be used instead of a clear text
password if you're worried about someone reading your shell-fm.rc file.
.B default-radio = lastfm://...
If this is provided (and valid), shell-fm will play this station by default
after startup. If there's another station URI given on the command line, it
will override this setting. If this is set to "last", the last played station
from the history will be started.
.B np-file = path-to-file
If this is defined, shell-fm will print information about the currently played
track into the given file, whenever a new track is played.
.B np-file-format = format-string
This defines how the information written to your now-playing file will look
like. There are several format flags available. Have a look at the
section for the details.
.B preview-format = format-string
Format of the track information in the playlist preview (key 'u').
.B np-cmd = shell command
If this is defined, the given command will be executed whenever a new track
starts. The value may contain format flags.
.B pp-cmd = shell command
If this is defined, the given command will be executed whenever a downloading
track ends. The value will have the path to the file appended.
.B rate-cmd = shell command
If this is defined, the given command will be executed whenever a track is rated.
The value may contain format flags, especially %V to get the actual rating.
.B ?-color = color
This allows you to color format elements. The
.B ?
may be the letter of any format flag (without percent). The color is just a
normal shell color code matching "[01];3[0-7]". Whenever the format element is
printed to the console, it will have the given color. Have a look at the
section for a list.
.B daemon = something
If this is set to something, shell-fm will start in daemon mode by default.
Starting with -d as command line option will disable daemon mode.
.B quiet = something
If this is set to something, shell-fm will start in quiet mode by default.
Starting with -q as command line option will disable quiet mode.
.B key0x?? = shell command
This allows you to bind shell commands to free keys (keys that are not used by
shell-fm, check the
section above for a list).
.B ??
should be the hex code of the ASCII code of the key. The command you assign
will be evaluated (check the
section) and executed then. This "feature" allows you to implement own
features, like fetching and printing the lyrics of the currently played track,
etc. If you have a cool idea or even a working script, I'd be happy if you let
me know.
.B bind = host
This specifies the network interface you want shell-fm to bind to.
.B host
should be the host name or an IP address of host shell-fm is running on.
shell-fm will open a port (see the
.B port
option below) on the specified interface which you can connect to to control
shell-fm remotely (or from local scripts, see
.B key0x??
above). Check the
section below for a list of known commands.
The network interface has no user authentication, so anyone with access to your
network/host can control shell-fm. Use it only if you really need to control
shell-fm over a network. Otherwise use the UNIX socket interface (see below).
.B unix = path
If this is set to a proper path, on that path a UNIX socket will be created for
local "remote" control. This socket interface takes the same commands as the
TCP socket interface (see above).
.B port = port-number
With this option you can change the port shell-fm will listen on (if
.B bind
is specified). Default is 54311.
.B extern = shell command
This allows you to specify an external program or script as player for the
streams. If given, shell-fm will run the command and pipe the MP3 stream into
it, instead of playing the stream itself. For example,
.B extern = madplay -Q -
works very fine. This option is meant as a work-around for architectures that
shell-fm doesn't work completly profectly on.
.B proxy = proxy server
This allows you to specify a proxy server for the HTTP requests.
.B socks-proxy = SOCKS proxy server
This allows you to specify a SOCKS proxy server for the HTTP requests.
.B expiry = some-number
This defines the number of seconds until a cached page expires. The default is
86400 seconds (24 hours). You shouldn't set a very low value here, since the
Last.FM server often are very slow. This mostly affects the prompts (radio
prompt, tag prompt, ...), since shell-fm fetches some feeds to get values for
the tab-completion.
.B device = path
Path to the audio device to use (see
.B -D
command line option).
.B title-format = format-string
This is the format of the track string that is printed to the console for every
track played. Default is 'Now playing "%t" by %a.'.
.B minimum = percentage
With this option you can change the minimum duration a track must have been
played to be scrobbled (in percent, but without the % sign). For example, if
this option is set to 75, the track will not be scrobbled if it has not been
played for at least 75% of its total duration. If you skip or stop the track
before it has been played for 75%, it will not be scrobbled. Default is 50%, as
specified in the scrobbling protocol version 1.2.
.B delay-change = something
If this is set to anything, and you change the station with 'r', 's' or 'f',
the station-change will be delayed until the currently played track finishes or
is skipped. Also they key 'q' will initialize a delayed quit, so after the
currently played track shell-fm will exit. 'Q' (uppercase) still quits
.B screen-format = format-string
If this is set, shell-fm will check if the terminal it's running in is a screen
session ($TERM is "screen") and set the screen windows title to the formatted
string to be seen on $ESCAPE+w or $ESCAPE+".
.B term-format = format-string
Works like screen-format, but sets the x-terminals window title.
.B download = format-string
If this is set to a valid path (may contain format flags), and the played track
is free, it is saved at the given place.
.B gap = seconds
If this is set to a number, shell-fm will wait that amount of seconds between
.B discovery = something
Enable discovery mode by default.
.B stream-timeout = seconds
Users reported that in some regions in the world, Last.FM servers sometimes
pretend to stream a track but then don't send anything, which makes shell-fm
hang forever waiting for the track data. If you have that problem, use this
option to define a stream timeout. When shell-fm is waiting for stream data, it
will wait that many seconds and then skip to the next track.
.B no-rtp = something
Start with RTP disabled.
.B volume-update = format string
If set, prints the formatted message when volume is changed. See format flags below, especially
There are several format flags allowed for some options. Here is the list.
.B %a
Artist name.
.B %t
Track title.
.B %l
Album name.
.B %I
URL of the album image.
.B %d
Track duration in seconds.
.B %f
Track duration formatted as 'min:sec'.
.B %s
Station name.
.B %S
Station URL.
.B %A
URL of the artists page on Last.FM.
.B %L
URL of the albums page on Last.FM.
.B %T
URL of the tracks page on Last.FM.
.B %R
Remaining seconds of the played track.
.B %r
Remaining time of the played track, formatted as 'min:sec'.
.B %v
Volume level, formatted as 'xx%'.
.B %b
Absolute volume (0-64).
.B %V
Rating of the current track
('L' loved, 'B' banned, 'S' skipped or empty).
Is replaced with the player status, PLAYING, PAUSED or STOPPED.
.B %~
Environment variable $HOME.
.B %%
A %.
.B 0;30
Black (not very useful).
.B 1;30
Dark gray.
.B 0;31
.B 1;31
Light red.
.B 0;32
.B 1;32
Light green.
.B 0;33
Dark yellow/brown.
.B 1;33
.B 0;34
.B 1;34
Light blue.
.B 0;35
.B 1;35
.B 0;36
.B 1;36
.B 0;37
.B 1;37
This section describes the commands shell-fm's network interface knows. To use
the interface, you must provide a valid value to the
.B bind
option in your configuration or use the
.B -i
option on the command line. Then you can connect the specified port (54311 by
default) and send one command at a time. This is a list of the known commands.
.B play lastfm://...
Play the given stream.
.B love
Love the currently played track.
.B ban
Ban the currently played track.
.B skip
Skip the currently played track.
.B quit
.B info some-format-string
Evaluate the given format string (check the
section) and return the formatted information.
.B pause
.B discovery
Toggle discovery mode on/off.
.B rtp
Toggle RTP (scrobbling) on/off. Returns "RTP ON" or "RTP OFF" to indicate status.
.B tag-artist some-comma-separated-tags
Tag the artist of the currently played track.
.B tag-album some-comma-separated-tags
Tag the album of the currently played track.
.B tag-track some-comma-separated-tags
Tag the currently played track.
.B artist-tags
Returns the tags of the currently played tracks artist.
.B album-tags
Returns the tags of the currently played tracks album.
.B track-tags
Returns the tags of the currently played track.
.B stop
Stop stream.
.B volume-up
Increment volume by 1.
.B volume-down
Decrement volume by 1.
.B volume 32
Set volume. Volume may be a number between 0 and 64.
.B volume %50
Set percental volume. %50 is 32, %100 is 64 and so on.
.B volume [+-]10
Adjust absolute volume. "volume +1" is the same as "volume-up" and "volume -1"
is the same as "volume-down".
All volumes return the absolute volume (0-64).
Returns the player status, PLAYING, PAUSED or STOPPED.
.B detach
Detaches from the network interface. Use this to cleanly close your session.
This section describes the meanings of the files in $HOME/.shell-fm/. The base
directory can be overriden by setting the environment variable $SHELL_FM_HOME
to another directory.
.B autoban
This file contains the auto-banned artists.
.B bookmarks
This file contains the bookmarked stations in the format "[digit] = [url]".
.B cache/
This directory contains cached sites fetched from Last.FM for faster tab-completion etc.
.B i-template
If this file exists, it will be used as a template for the output of 'i'. It
may contain usual format flags.
.B radio-history
The radio stations you have listened to. The history is used for the radio prompt.
.B scrobble-cache
If Shell.FM can't scrobble the data of a track for any reason before you quit,
it stores the track data in here and it will try to submit the tracks the next
time it is run.
.B shell-fm.rc
Your configuration file as described above.
.B Sample Configuration for shell-fm.rc
# shell-fm.rc example
username = shellfmlover
password = CheckFileIsOnlyReadableByOwner
default-radio = lastfm://user/shellfmlover/playlist
np-file = /home/shellfmlover/.shell-fm/nowplaying
np-file-format = %t:%a:%S:%A
minimum = 80
delay-change = true
.B shell-fm-*.*/scripts/
Includes examples of using the network interface plus a color printing script to help with choosing colors.
Please send bug reports to <>.
Copyright (C) 2006-2010 by Jonas Kramer.
Published under the terms of the GNU General Public License.