Recent changes Random page
GAMING
Technology
 
Gaming
Entertainment
Science Fiction
Biggest wikis
Hobbies
Music
See more...

Music Player Daemon Browser Stream Setup

From Music Player Daemon Community Wiki

Jump to: navigation, search

Contents

[edit] Overview

Opening a link to a playlist (.pls or .m3u) file in your browser requires a helper script. The following scripts use the mpc program so mpc must be installed on your system for it to work. The mpc client sends the parsed playlist (.pls or .m3u) in appropriate format to mpd (specifically, adding it to the currently active mpd playlist).

  • MPD provides native support for http based (mp3 or ogg) streams, but this example provides an easy way to add the http stream urls to your playlist using a standard web browser and mime-types/helper application script.
  • Check your mpd.conf file if you use a proxy.

[edit] Setting the MPD host

This step is unnecessary if the MPD host is on the computer you're on (localhost), and is probably a little beyond the scope of this documentation.

You must have your MPD_HOST set to your MPD host. The way to accomplish this is different on most distributions, so seek your distributions instructions on how to set an environment variable globally.

[edit] Prepare the scripts

Only one of the following is necessary, If the scripts are not available in your /usr/doc/mpc/doc or /usr/local/doc/mpc/doc, then skip the first step and create them from scratch.

[edit] Create the scripts

This is unnecessary now, you should have a copy of both files in your /usr/doc/mpc or possibly the /usr/local/doc/mpc or the /usr/share/doc/mpc/examples directories, or it should be in the tarball in the docs/ directory, skip this step for further instruction. Copy the files to the location best to suit you ; consider /usr/bin/ or /usr/local/bin/

[edit] Create the pls-handler.sh script

$cd ~
$[your favorite editor] ~/pls-handler.sh

then edit...

#!/usr/bin/env sh
mpc clear
grep '^File[0-9]*' $1 | sed -e 's/^File[0-9]*=//' | mpc add
mpc play

[edit] Create the m3u-handler.sh script

$[your favorite editor] ~/m3u-handler.sh

then

#!/usr/bin/env sh
mpc clear
cat $1 | mpc add
mpc play

[edit] Copy them to your path

Optional, but remember the path they're in, you'll need it later

$cp -av m3u-handler.sh /to/your/path
$cp -av pls-handler.sh /to/your/path

[edit] Set the executable bit

$chmod u+x m3u-handler.sh
$chmod u+x pls-handler.sh

[edit] Testing the scripts

$./pls-handler /home/user/path/to/saved.pls

[edit] Configure your browser

[edit] Konqueror

  1. Open your browser and go to settings->Configure Konqueror.
  2. File Associations.
  3. Goto audio->x-scpls
  4. Under Application Preference Order click Add...
  5. Put the pls-handler path and filename in.
  6. Goto audio->mpegurl
  7. Under Application Preference Order click Add...
  8. Put the m3u-handler.sh path and filename in.

[edit] Mozilla Firefox / Mozilla Suite / Netscape 7

  1. Open your browser and go to edit->preferences->downloads in the "file types" area remove the pls or m3u entry if they exist.
  2. Go to your favorite streaming website.
  3. Open the pls or m3u link, your browser will open a dialog box asking what to do with this file, choose "open with" and "other".
  4. Find the script pls-handler.sh and/or m3u-handler.sh, respectively, which should be in your /usr/doc/mpc directory.
  5. Check the box "do this automatically...from now on".

[edit] Opera

  1. Click on a pls file, for instance on the shoutcast page.
  2. To the right of Opens with click the box marked Change...
  3. Click the Open with other application radio button, and then click the Choose button to the right.
  4. Fill in the path and filename for pls-handler.sh, click OK and the stream should start.
  5. Click on a m3u file, for instance on the icecast page.
  6. To the right of Opens with click the box marked Change...
  7. Click the Open with other application radio button, and then click the Choose button to the right.
  8. Fill in the path and filename for m3u-handler.sh, click OK and the stream should start.
Rate this article:
Share this article: