Skip to content

Instantly share code, notes, and snippets.

@bspavel
Last active September 19, 2020 18:48
Show Gist options
  • Save bspavel/009fc69a59b840b5369d9128f412c6f8 to your computer and use it in GitHub Desktop.
Save bspavel/009fc69a59b840b5369d9128f412c6f8 to your computer and use it in GitHub Desktop.
the installer of minidlna on the raspberry pi
#!/bin/bash
#https://superuser.com/questions/871532/mount-external-hard-drive-with-r-w-permissions-for-minidlna
#https://www.codingcookie.com/raspberry-pi-minidlna/
#@TODO:
#Automaticaly spin down the hard drive
if [ "$(whoami)" != "root" ]; then
echo "Run script as ROOT please. (sudo !!!)"
exit
fi
sudo apt-get update
sudo apt-get -y upgrade
sudo rpi-update
sudo apt-get -y install minidlna
sudo cat > /etc/minidlna.conf << "EOF"
user=pi
media_dir=/media/pi/minidlna
db_dir=/media/pi/minidlna/cache
log_dir=/var/log
log_level=debug
network_interface=lo,eth0
port=8200
presentation_url=/
friendly_name=MiniDLNA
# Serial number the server reports to clients.
# Defaults to the MAC address of nework interface.
#serial=
inotify=yes
album_art_names=Cover.jpg/cover.jpg/AlbumArtSmall.jpg/albumartsmall.jpg
album_art_names=AlbumArt.jpg/albumart.jpg/Album.jpg/album.jpg
album_art_names=Folder.jpg/folder.jpg/Thumb.jpg/thumb.jpg
# SSDP notify interval, in seconds.
#notify_interval=895
wide_links=yes
EOF
sudo mkdir -p /media/pi/minidlna/cache/
sudo chown -R pi:pi /media/pi/minidlna/cache/
sudo chown -R pi:pi /media/pi/minidlna/
sudo mount -t ntfs-3g /dev/sda1 /media/pi/minidlna -o uid=1000,gid=1000
#Restart the minidlna
sudo /etc/init.d/minidlna restart
sudo service minidlna restart
sudo service minidlna force-reload
echo "http://raspberrypi:8200"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment