# Audio players

On BSD/Linux systems there are a plethora of audio players. In streamtuner2 you can configure most of them as target application. Mostly it makes sense to use a single application for all audio formats. But at least the */* media type should be handled by a generic player, like vlc.

A few common applications and invocation strings to use are:

audio/* | audacious
audio/* | xmms2 %m3u
audio/* | amarok -l %pls
audio/* | exaile
video/* | mplayer %srv
video/* | totem %u
*/* | vlc %u

Some audio players open a second instance when you actually want to switch radios. In this case it's a common workaround to write pkill vlc ; vlc %u instead, which ends the previous player process and starts it anew. For VLC there's however also the --one-instance option, which sometimes works better. (And sometimes not.)

Some applications, like Rhythmbox or Banshee, are primarily playlist managers, not players, and cannot be invoked with a station URL. This makes them less suitable for use with streamtuner2. (Same goes for streamtuner2 itself. It's not a player, but just a playlist browser.)

## URL placeholders

Listed audio players get run with a streaming server address (URL). These can either be direct MP3/Ogg servers (http://example.org:7843/) and sometimes playlist files (http://example.org/listen.pls) - depending on the channel directory.

Most audio players automatically handle any station URLs. Some however support just a few formats, or can't handle modern XSPF playlists for instance. Which is why you can control this by adding a placeholder after the configured application name:

Placeholder | Alternatives | URL/Filename type
%pls | %url %u %r | Either a remote .pls resource (fastest), or a local .pls file (if converted)
%m3u | %f %g %m | Provides a local .m3u file for the streaming station
%srv | %d %s | Direct link to first streaming address, e.g. http://72.5.9.33:7500
%xspf | %x | Xiph.org shareable playlist format (for modern players)
%jspf | %j | JSON playlist format (widely unsupported)
%asx |  | Some obscure Windows playlist format (don't use that)
%smil |  | Standardized multimedia sequencing lists (which nobody uses either)

Preferrably use the long %abbr names for configuration. The default is %pls if you leave it out. (Most directories already provide PLS files, which avoids any extra conversion by ST2 which sometimes delay playback.)

A few channels (like Jamendo) send custom JSON playlist snippets, which no audio player would understand. Which is why they're always pre-converted.

Most audio players like %pls, yet sometimes the older %m3u format more. Streamripper requires %srv for recording.

Use the newer %xspf format if your player supports it. This format retains the maximum of station infos (such as homepages etc.), and thus often makes for better bookmarking directly in your player.

## Other placeholders

In addition to stream URL + type placeholders (%r, %x, %pls, %m3u, etc), you can also pass station info placeholders. These contain the stream information like title or bitrate, or any other internal field:

Placeholder | As variable | Field content
%title | $title | Station title
%genre | $genre | Stream category or genre list
%playing | $playing | Currently playing song, or geographic location
- | $url | Unfiltered stream url (may contain internal urn:xx:id)
%format | $format | The MIME type ("audio/mpeg")
%bitrate | $bitrate | Known stream bitrate, if any
%extra | $extra | Comments or timer settings
%favourite | $favourite | If bookmarked

Not all fields are used in all channels. Sometimes they're repurposed (like playing often doubles as Location: field). And some channels may even use custom internal names.

You often want to use such placeholders if you have a player or recording shell script, such as contrib/cmdline/streamripper_addgenre to handle them. Or if you define a mini-toolbar specbutton with custom commands.

## Other players

Here a few other configuration examples for other players/backends.

MPD

  Rocus van Oosten recommends following wrapper script to start playing radio streams via MPD right away:

      MPD_HOST='10.0.0.222' # or your MPD host
      export MPD_HOST
      mpc clear
      mpc load $1
      mpc play

  Save it as mpc-pls script and configure it in streamtuner as mpc-pls %pls for example. You can find an extended version in the contrib/cmdline/ directory.

## Windows config

There's a few things you have to take care of when configuring players and recording apps on Windows. Common applications and settings would be:

Player config
audio/mpeg | wmplayer.exe %asx | Windows media player doesn't understand PLS or M3U files.
video/* | C:\Programs\VLC\vlc.exe %srv | VLC pretty much works alike on Windows.
url/http | "C:/Program Files/Mozilla Firefox/firefox.exe" %url | It's best to enclose paths with spaces in quotes.
url/http | iexplore.exe %url | IE is not recommended, of course.
Recording apps
audio/* | /D "C:\Programs\Streamripper" streamripper.exe %srv | Command line programs need the /D switch first, then its path enclosed in quotes and a space before the program.

You can avoid a few issues: if you put your executables in paths without spaces, or set the system $PATH variable accordingly.

As reported by Oliver in the sourceforge Discussion board.