Outils pour utilisateurs

Outils du site


mpd_raspberry_pi

Ceci est une ancienne révision du document !


Installation de MPD sur un raspberry pi !

Nous allons voir comment installer MPD (Music Player Daemon) sur le raspberry pi.
MPD (Music Player Daemon) est un lecteur qui utilise une architecture client/serveur, ce qui permet de le contrôler à distance. De nombreux clients sont disponibles. Il reste néanmoins un lecteur de choix pour une machine de bureau, léger et efficace.

Installation

1. On met à jour la base de packages de raspbian

apt-get update
apt-get upgrade

2. On installe les outils nécéssaires :

apt-get install alsa-utils mpg321 lame

3. On vérifie si le module sonore est chargé, si pas on le charge :

modprobe snd-bcm2835
Pour charger le module au démarrage, on peut l'ajouter dans le fichier /etc/modules

4. On configure la sortie audio : On sélectionne la sortie audio que l'on veut utiliser. Pour cela on modifie le dernier chiffre par ce que l'on veut utiliser (0=auto, 1=analog, 2=HDMI).

amixer cset numid=3 1

4. On installe le serveur mpd :

apt-get install mpd

On change les droits sur le répertoire /var/lib/mpd et /var/rum/mpd

chmod -R g+w /var/lib/mpd
chmod -R g+w /var/run/mpd

5. On édite le fichier de configuration /etc/mpd.conf

# Files and directories #######################################################
#
# This setting controls the top directory which MPD will search to discover the
# available audio files and add them to the daemon's online database. This 
# setting defaults to the XDG directory, otherwise the music directory will be
# be disabled and audio files will only be accepted over ipc socket (using
# file:// protocol) or streaming files over an accepted protocol.
#
music_directory		"/var/lib/mpd/music"
#
# This setting sets the MPD internal playlist directory. The purpose of this
# directory is storage for playlists created by MPD. The server will use 
# playlist files not created by the server but only if they are in the MPD
# format. This setting defaults to playlist saving being disabled.
#
playlist_directory		"/var/lib/mpd/playlists"
#
# This setting sets the location of the MPD database. This file is used to
# load the database at server start up and store the database while the 
# server is not up. This setting defaults to disabled which will allow
# MPD to accept files over ipc socket (using file:// protocol) or streaming
# files over an accepted protocol.
#
db_file			"/var/lib/mpd/tag_cache"
# 
# These settings are the locations for the daemon log files for the daemon.
# These logs are great for troubleshooting, depending on your log_level
# settings.
#
# The special value "syslog" makes MPD use the local syslog daemon. This
# setting defaults to logging to syslog, otherwise logging is disabled.
#
log_file			"/var/log/mpd/mpd.log"
#
# This setting sets the location of the file which stores the process ID
# for use of mpd --kill and some init scripts. This setting is disabled by
# default and the pid file will not be stored.
#
pid_file			"/var/run/mpd/pid"
#
# This setting sets the location of the file which contains information about
# most variables to get MPD back into the same general shape it was in before
# it was brought down. This setting is disabled by default and the server 
# state will be reset on server start up.
#
state_file			"/var/lib/mpd/state"
#
# The location of the sticker database.  This is a database which
# manages dynamic information attached to songs.
#
sticker_file                   "/var/lib/mpd/sticker.sql"
#
###############################################################################
...
#bind_to_address		"localhost"
...
si vous rencontrez des problèmes de connexion au serveur MPD, commentez la ligne bind_to_address

6. On copie nos musiques sur le raspberry pi dans le répertoire /var/lib/mpd/music

7. On crée un fichier radio.m3u avec les radios que l'on veut pouvoir écouter par internet et on le copie dans /var/lib/mpd/playlists

#EXTM3U
#EXTINF:-1,Pure FM
http://broadcast.infomaniak.net:80/purefm-128.mp3

#EXTINF:-1,Classic 21
http://broadcast.infomaniak.net:80/classic21-128.mp3

#EXTINF:-1,Vivacité
http://broadcast.infomaniak.net:80/vivabxl-128.mp3

#EXTINF:-1,Bel RTL
http://audiostream.rtl.be/belrtl128

#EXTINF:-1,Contact FM
http://radio-contact.ice.infomaniak.ch:80/radio-contact-high

#EXTINF:-1,Nostalgie
http://broadcast-adswizz.infomaniak.net:8000/nostalgiepremium-128.mp3

#EXTINF:-1,NRJ
http://broadcast.infomaniak.net:80/nrjbe-high.mp3

#EXTINF:-1,Radio Contact
http://audiostream.rtl.be/contactfr

Pour trouver les adresses de streaming des radios, ce rendre sur le site European radio.

8. On installe un client sur son pc :

apt-get install gmpc

Références :

mpd_raspberry_pi.1383643947.txt.gz · Dernière modification : 2014/12/27 08:14 (modification externe)