-
Notifications
You must be signed in to change notification settings - Fork 0
/
minidlna.txt
45 lines (37 loc) · 1.92 KB
/
minidlna.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
FILE="/etc/minidlna.conf"
sudo apt -y install minidlna
sudo systemctl stop minidlna
#sudo mkdir /media/{music,video}; sudo chown pi:pi /media/{music,video}; sudo chmod 775 /media/{music,video}
sudo mount --bind /var/lib/mpd/music /media/music
ls -al /media/music
sudo umount /media/music
echo "/var/lib/mpd/music /media/music none bind 0 0" | sudo tee -a /etc/fstab
sudo systemctl daemon-reload
sudo mount -a
ls -al /media/music
sudo cp -p ${FILE} ${FILE}.orig
sudo sed -i '/inotify=yes/s/^#//g; /friendly_name/s/^#//g; /friendly_name/ s/=/=malinka: pi/' ${FILE}
sudo sed -i '/^media_dir=/s/^/#/; /#media_dir/a media_dir=A,\/media\/music\nmedia_dir=V,\/media\/video' ${FILE}
sudo sed -i '/merge_media_dirs/s/^#//g; /merge_media_dirs/ s/no/yes/' ${FILE}
sudo sed -i '/#root_container/a root_container=.' ${FILE}
sysctl fs.inotify.max_user_watches | grep --color {[0-9],}
echo fs.inotify.max_user_watches=200000 | sudo tee /etc/sysctl.d/90-minidlna.conf ; sudo sysctl --system
sysctl fs.inotify.max_user_watches | grep --color {[0-9],}
sudo systemctl start minidlna
#add minidlna user to group debian-transmission
#only if user debian-transmission exists
id -u debian-transmission > /dev/null 2>&1 && sudo usermod -aG debian-transmission minidlna
#add minidlna user to group pi
sudo usermod -aG pi minidlna
cd ~
#optional rebuild database
crontab -l > mycron
echo -e "\n#rebuild database" >> mycron
echo '01 05 * * 5 sudo systemctl stop minidlna; sudo systemctl stop minidlna ; sudo kill `cat /run/minidlna/minidlna.pid` ; sudo rm -rf /var/cache/minidlna/files.db ; sudo systemctl start minidlna ;' >> mycron
crontab mycron
rm mycron
crontab -l
#add to /etc/local manual rebuild script
[ -d /etc/local ] || sudo mkdir /etc/local && sudo chown pi.pi /etc/local
echo 'sudo systemctl stop minidlna ; sudo systemctl stop minidlna ; sudo rm -rf /var/cache/minidlna/files.db ; sudo systemctl start minidlna ;' > /etc/local/mdr.sh
chmod +x /etc/local/mdr.sh