Listen to your music and play video from your RaspberryPi NAS using DLNA

Note: DLNA will give access to your files on RaspberryPi through your local wireless network. Be careful choosing directories to expose.

Supposing you’ve already a RaspberryPi NAS:

sudo apt get install minidlna
sudo nano /etc/minidlna.conf

Change media dir to:

media_dir=A,/media/MYDRIVE/music/

where /media/MYDRIVE is the mount point and music is your music directory and A is the flag for Audio (leave unchanged for music, for pictures use P, for video use V).

Change db_dir (preview, database and cache directory) in:

db_dir=/media/MYDRIVE/cache/minidlna

Look for “friendly_name” and change it into something like:

friendly_name=RaspberryPiMusic

Then Ctrl+O to save.

Create the cache directory (as pi user, not superuser):

mkdir /media/MYDRIVE/cache
mkdir /media/MYDRIVE/cache/minidlna

Then use pi user for minidlna service (read previous howto for details about permissions and external drives).

sudo nano /etc/init.d/minidlna

And add USER=pi under the DEFAULT line:

PIDFILE=$PIDDIR/$NAME.pid
SCRIPTNAME=/etc/init.d/$NAME
DEFAULT=/etc/default/$NAME
USER=pi

Then force reload the service, regenerating the cache and db:

sudo service minidlna force-reload

Now indexing is in progress: if you use a DLNA enabled device, like an Android phone (e.g. via DLNA application) or a Samsung Internet TV, you’ll got the list of files growing in number under the rasperrypi:RaspberryPiMusic server.

If you want to add new media directories, you have to add another media_dir to the list, specifying the media flag. I want to add my anime folder:

And then my anime folder:

media_dir=A,/media/MYDRIVE/music/
media_dir=/media/MYDRIVE/anime/

This time I omit the flag to play all contents, there are some mp3 too there and I want to play those!

Every time you add a new directory to watch, rebuild the database with force-reload, but if you want only to restart service use stop, start and restart instead of force-reload.

For a more detailed howto and the use of BubbleUPnP (shared playlist among devices) read this blog post by Stephen C Phillips, source of many info here.

Note: this post originated from this question by Fanie.

Netgear WG111 on Debian Lenny with ndiswrapper

Tested on: Debian Etch, Lenny/Sid (Testing), kernel 2.6

  1. Plug WG111 and type lsusb to verify hardware is plugged. You should get something like:
    Bus 003 Device 002: ID 0000:0000 NetGear, Inc. WG111 WiFi (v2)
    Bus 003 Device 001: ID 0000:0000
    Bus 001 Device 001: ID 0000:0000
    Bus 002 Device 001: ID 0000:0000
  2. On root shell, type:
    apt-get install module-assistant
    m-a prepare
    m-a a-i ndiswrapper
    modprobe ndiswrapper

    Now ndiswrapper module is loaded. (if you got a FATAL: Module ndiswrapper not found fatal error, repeat these steps)
  3. If interface is successfully modprobed, then type
    update-modules
    To create ndiswrapper module config files.
  4. Add
    ndiswrapper
    to /etc/modules to load this module on boot.

  5. apt-get install wlassistant ndisgtk ndiswrapper-utils
    Install some utilities to configure wireless interface.
  6. Run ndisgtk (or type ndiswrapper -i /media/cdrom0/ndis5/netwg111.inf, where cdrom0 is Netgear driver disc)
  7. Select Netgear driver from CD-ROM (netwg111.inf): it’ll be copied automatically to /etc/ndiswrapper
  8. Copy other files under /media/cdrom0/ndis5 in /etc/ndiswrapper/netwg111/
  9. If interface is not detected, type ndiswrapper -m to write modprobe config files for it.
  10. Use gksu network-admin or gksu wlassistant to configure your wireless connection.

Tip: If after system upgrading you cannot access to wireless network, repeat step (2).

See also: