Add DLNA
This commit is contained in:
@@ -50,6 +50,8 @@ The exact steps depend on the backup mode.
|
|||||||
1. Point the browser to *http://127.0.0.1:8000* (replace *127.0.0.1* with the actual IP address of the Raspberry Pi).
|
1. Point the browser to *http://127.0.0.1:8000* (replace *127.0.0.1* with the actual IP address of the Raspberry Pi).
|
||||||
2. Start the desired action by pressing the appropriate button.
|
2. Start the desired action by pressing the appropriate button.
|
||||||
|
|
||||||
|
The access the contents of the storage device, plug it into the Raspberry Pi and press the **DLNA SERVER** button. You can then use a uPnP application on any device on the same network to browse and view the contents of the storage device.
|
||||||
|
|
||||||
<img src="img/rc.png" alt="" />
|
<img src="img/rc.png" alt="" />
|
||||||
|
|
||||||
## Problems?
|
## Problems?
|
||||||
|
|||||||
BIN
img/rc.png
BIN
img/rc.png
Binary file not shown.
|
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 23 KiB |
@@ -33,6 +33,12 @@
|
|||||||
<button name="camerabackup">Camera backup</button>
|
<button name="camerabackup">Camera backup</button>
|
||||||
</form>
|
</form>
|
||||||
</p>
|
</p>
|
||||||
|
<p>Activate the DLNA server</p>
|
||||||
|
<p>
|
||||||
|
<form method="post">
|
||||||
|
<button name="minidlna">DLNA server</button>
|
||||||
|
</form>
|
||||||
|
</p>
|
||||||
<p class="left">Shut down the Little Backup Box</p>
|
<p class="left">Shut down the Little Backup Box</p>
|
||||||
<p>
|
<p>
|
||||||
<form method="post">
|
<form method="post">
|
||||||
@@ -53,6 +59,10 @@ if (isset($_POST['camerabackup']))
|
|||||||
{
|
{
|
||||||
shell_exec('sudo ./camera-backup.sh 2>&1 & echo $!');
|
shell_exec('sudo ./camera-backup.sh 2>&1 & echo $!');
|
||||||
}
|
}
|
||||||
|
if (isset($_POST['minidlna']))
|
||||||
|
{
|
||||||
|
shell_exec('sudo ./minidlna.sh 2>&1 & echo $!');
|
||||||
|
}
|
||||||
if (isset($_POST['shutdown']))
|
if (isset($_POST['shutdown']))
|
||||||
{
|
{
|
||||||
shell_exec('sudo shutdown -h now 2>&1 & echo $!');
|
shell_exec('sudo shutdown -h now 2>&1 & echo $!');
|
||||||
|
|||||||
44
scripts/minidlna.sh
Executable file
44
scripts/minidlna.sh
Executable file
@@ -0,0 +1,44 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# This program is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
# IMPORTANT:
|
||||||
|
# Run the install-little-backup-box.sh script first
|
||||||
|
# to install the required packages and configure the system.
|
||||||
|
|
||||||
|
# Specify devices and their their mount points
|
||||||
|
# as well as other settings
|
||||||
|
STORAGE_DEV="sda1" # Name of the storage device
|
||||||
|
STORAGE_MOUNT_POINT="/media/storage" # Mount point of the storage device
|
||||||
|
|
||||||
|
# Wait for a USB storage device (e.g., a USB flash drive)
|
||||||
|
STORAGE=$(ls /dev/* | grep "$STORAGE_DEV" | cut -d"/" -f3)
|
||||||
|
#STORAGE=$(lsblk -x SIZE | grep sd[a-z]1 | awk '{print $1}' | sort | head -n 1)
|
||||||
|
while [ -z "${STORAGE}" ]
|
||||||
|
do
|
||||||
|
sleep 1
|
||||||
|
STORAGE=$(ls /dev/* | grep "$STORAGE_DEV" | cut -d"/" -f3)
|
||||||
|
done
|
||||||
|
|
||||||
|
# When the USB storage device is detected, mount it
|
||||||
|
mount /dev/"$STORAGE_DEV" "$STORAGE_MOUNT_POINT"
|
||||||
|
|
||||||
|
# Set the ACT LED to blink at 1000ms to indicate that the storage device has been mounted
|
||||||
|
sudo sh -c "echo timer > /sys/class/leds/led0/trigger"
|
||||||
|
sudo sh -c "echo 1000 > /sys/class/leds/led0/delay_on"
|
||||||
|
|
||||||
|
# Reload minidlna
|
||||||
|
|
||||||
|
sudo minidlnad -R
|
||||||
|
sudo service minidlna restart
|
||||||
Reference in New Issue
Block a user