Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
freedombone
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Context Sensitive Group
freedombone
Commits
ba5ec52c
Commit
ba5ec52c
authored
6 years ago
by
Bob Mottram
Browse files
Options
Downloads
Patches
Plain Diff
Restore dlna app
parent
e4f61acf
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/freedombone-app-dlna
+49
-46
49 additions, 46 deletions
src/freedombone-app-dlna
with
49 additions
and
46 deletions
src/freedombone-app-dlna
+
49
−
46
View file @
ba5ec52c
...
...
@@ -29,18 +29,22 @@
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
VARIANTS
=
''
VARIANTS
=
'
full full-vim media
'
IN_DEFAULT_INSTALL
=
0
SHOW_ON_ABOUT
=
0
SHOW_CLEARNET_ADDRESS_ON_ABOUT
=
0
SHOW_DOMAIN_IN_WEBADMIN
=
0
DLNA_SHORT_DESCRIPTION
=
$'Streaming media'
DLNA_DESCRIPTION
=
$'Streaming media'
DLNA_MOBILE_APP_URL
=
DLNA_PORT
=
1900
DLNA_PRESENTATION_PORT
=
8200
USB_MOUNT_DLNA
=
/mnt/dlna
DLNA_SHORT_DESCRIPTION
=
$'Play media from any UPNP/DLNA device on your local network'
DLNA_DESCRIPTION
=
$'Play media from any UPNP/DLNA device on your local network'
DLNA_MOBILE_APP_URL
=
https://f-droid.org/packages/de.yaacc/
dlna_variables
=(
SYSTEM_TYPE
USB_MOUNT_DLNA
INSTALLED_WITHIN_DOCKER
MY_USERNAME
)
function
logging_on_dlna
{
...
...
@@ -65,8 +69,8 @@ function configure_interactive_dlna {
fi
case
$selection
in
1
)
attach-
music
;;
2
)
remove-music
;;
1
)
attach-
dlna
;;
2
)
unmount-dlna
;;
esac
done
}
...
...
@@ -88,25 +92,16 @@ function configure_firewall_for_dlna {
if
[[
$(
is_completed
"
${
FUNCNAME
[0]
}
"
)
==
"1"
]]
;
then
return
fi
if
[[
$INSTALLED_WITHIN_DOCKER
==
"yes"
]]
;
then
# docker does its own firewalling
return
fi
firewall_add DLNA 1900 udp
firewall_add DLNA 8200 tcp
firewall_add DLNA
$DLNA_PORT
udp
{
echo
'<?xml version="1.0" standalone="no"?><!--*-nxml-*-->'
;
echo
'<!DOCTYPE service-group SYSTEM "avahi-service.dtd">'
;
echo
'<service-group>'
;
echo
' <name replace-wildcards="yes">%h DLNA</name>'
;
echo
' <service>'
;
echo
' <type>_dlna._tcp</type>'
;
echo
" <port>8200</port>"
;
echo
' </service>'
;
echo
' <service>'
;
echo
' <type>_dlna._udp</type>'
;
echo
" <port>
1900
</port>"
;
echo
" <port>
$DLNA_PORT
</port>"
;
echo
' </service>'
;
echo
'</service-group>'
;
}
>
/etc/avahi/services/dlna.service
...
...
@@ -164,11 +159,10 @@ function remove_dlna {
if
[
-f
/etc/minidlna.conf
]
;
then
rm
/etc/minidlna.conf
fi
rm
/usr/bin/attach-
music
rm
/usr/bin/
remove-music
rm
/usr/bin/attach-
dlna
rm
/usr/bin/
unmount-dlna
remove_completion_param install_dlna
firewall_remove 1900 udp
firewall_remove 8200 tcp
firewall_remove
$DLNA_PORT
udp
rm
/etc/avahi/services/dlna.service
systemctl restart avahi-daemon
...
...
@@ -179,26 +173,29 @@ function install_dlna_main {
return
fi
$INSTALL_PACKAGES
minidlna
$INSTALL_PACKAGES
_BACKPORTS
minidlna
if
[
!
-f
/etc/minidlna.conf
]
;
then
echo
$"ERROR: minidlna does not appear to have installed.
$CHECK_MESSAGE
"
exit
55
fi
if
[
!
"
$USB_MOUNT_DLNA
"
]
;
then
USB_MOUNT_DLNA
=
/mnt/dlna
if
[
!
-d
/music
]
;
then
mkdir
/music
fi
if
[
!
-d
/pictures
]
;
then
mkdir
/pictures
fi
if
[
${#
USB_MOUNT_DLNA
}
-eq
0
]
;
then
USB_MOUNT_DLNA
=
/mnt/dlna
if
[
!
-d
/videos
]
;
then
mkdir
/videos
fi
sed
-i
"s|media_dir=
/var/lib/minidlna|media_dir=A,/home/
$MY_USERNAME
/M
usic|g"
/etc/minidlna.conf
if
!
grep
-q
"
/home/
$MY_USERNAME
/P
ictures"
/etc/minidlna.conf
;
then
echo
"media_dir=P,/
home/
$MY_USERNAME
/P
ictures"
>>
/etc/minidlna.conf
sed
-i
"s|media_dir=
.*|media_dir=A,/m
usic|g"
/etc/minidlna.conf
if
!
grep
-q
"
=P,/p
ictures"
/etc/minidlna.conf
;
then
echo
"media_dir=P,/
p
ictures"
>>
/etc/minidlna.conf
fi
if
!
grep
-q
"
/home/
$MY_USERNAME
/V
ideos"
/etc/minidlna.conf
;
then
echo
"media_dir=V,/
home/
$MY_USERNAME
/V
ideos"
>>
/etc/minidlna.conf
if
!
grep
-q
"
=V,/v
ideos"
/etc/minidlna.conf
;
then
echo
"media_dir=V,/
v
ideos"
>>
/etc/minidlna.conf
fi
if
!
grep
-q
"
$USB_MOUNT_DLNA
/Music"
/etc/minidlna.conf
;
then
echo
"media_dir=A,
$USB_MOUNT_DLNA
/Music"
>>
/etc/minidlna.conf
...
...
@@ -219,11 +216,11 @@ function install_dlna_main {
else
sed
-i
"s/#network_interface=/network_interface=
$WIFI_INTERFACE
/g"
/etc/minidlna.conf
fi
sed
-i
"s/#friendly_name=/friendly_name=
\"
${
PROJECT_NAME
}
Media
\"
/g"
/etc/minidlna.conf
sed
-i
's|#db_dir=
/var/cache/minidlna
|db_dir=/var/cache/minidlna|g'
/etc/minidlna.conf
sed
-i
's/#inotify=
yes
/inotify=yes/g'
/etc/minidlna.conf
sed
-i
's/#notify_interval=
895
/notify_interval=300/g'
/etc/minidlna.conf
sed
-i
"s|#presentation_url=/|presentation_url=http://localhost:
8200
|g"
/etc/minidlna.conf
sed
-i
"s/#friendly_name=
.*
/friendly_name=
\"
${
PROJECT_NAME
}
Media
\"
/g"
/etc/minidlna.conf
sed
-i
's|#db_dir=
.*
|db_dir=/var/cache/minidlna|g'
/etc/minidlna.conf
sed
-i
's/#inotify=
.*
/inotify=yes/g'
/etc/minidlna.conf
sed
-i
's/#notify_interval=
.*
/notify_interval=300/g'
/etc/minidlna.conf
sed
-i
"s|#presentation_url=
.*
/|presentation_url=http://localhost:
$DLNA_PRESENTATION_PORT
|g"
/etc/minidlna.conf
systemctl reload minidlna
sed
-i
's/fs.inotify.max_user_watches*/fs.inotify.max_user_watches=65536/g'
/etc/sysctl.conf
...
...
@@ -251,27 +248,33 @@ function script_for_attaching_usb_drive {
echo
'done'
;
echo
''
;
echo
"USB_DRIVE=
\$
(detect_connected_drives)"
;
echo
"if [[
\"\$
USB_DRIVE
\"
!= 'sd'* ]]; then"
;
echo
' exit 1'
;
echo
'fi'
;
echo
''
;
echo
"if [ -d
$USB_MOUNT_DLNA
]; then"
;
echo
" umount
$USB_MOUNT_DLNA
"
;
echo
" rm -rf
$USB_MOUNT_DLNA
"
;
echo
'fi'
;
echo
''
;
echo
'remove-music'
;
echo
"if [ ! -d
$USB_MOUNT_DLNA
]; then"
;
echo
"
mkdir
$USB_MOUNT_DLNA
"
;
echo
" mkdir
$USB_MOUNT_DLNA
"
;
echo
'fi'
;
echo
-n
"mount
\$
USB_DRIVE "
;
echo
"
$USB_MOUNT_DLNA
"
;
echo
"mount
\$
USB_DRIVE
$USB_MOUNT_DLNA
"
;
echo
"chown root:root
$USB_MOUNT_DLNA
"
;
echo
"chown -R minidlna:minidlna
$USB_MOUNT_DLNA
/*"
;
echo
'systemctl restart minidlna'
;
echo
'minidlnad -R'
;
echo
'exit 0'
;
}
>
/usr/bin/attach-
music
chmod
+x /usr/bin/attach-
music
echo
'exit 0'
;
}
>
/usr/bin/attach-
dlna
chmod
+x /usr/bin/attach-
dlna
{
echo
'#!/bin/bash'
;
echo
"if [ -d
$USB_MOUNT_DLNA
]; then"
;
echo
" umount
$USB_MOUNT_DLNA
"
;
echo
" rm -rf
$USB_MOUNT_DLNA
"
;
echo
'fi'
;
echo
'exit 0'
;
}
>
/usr/bin/
remove-music
chmod
+x /usr/bin/
remove-music
echo
'exit 0'
;
}
>
/usr/bin/
unmount-dlna
chmod
+x /usr/bin/
unmount-dlna
mark_completed
"
${
FUNCNAME
[0]
}
"
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment