diff --git a/packages/addons/service/minidlna/changelog.txt b/packages/addons/service/minidlna/changelog.txt new file mode 100644 index 0000000000..939a143a03 --- /dev/null +++ b/packages/addons/service/minidlna/changelog.txt @@ -0,0 +1,2 @@ +100 +- initial LibreELEC version diff --git a/packages/addons/service/minidlna/icon/icon.png b/packages/addons/service/minidlna/icon/icon.png new file mode 100755 index 0000000000..d3cfd67d43 Binary files /dev/null and b/packages/addons/service/minidlna/icon/icon.png differ diff --git a/packages/addons/service/minidlna/package.mk b/packages/addons/service/minidlna/package.mk new file mode 100644 index 0000000000..61d0d5ae74 --- /dev/null +++ b/packages/addons/service/minidlna/package.mk @@ -0,0 +1,56 @@ +################################################################################ +# This file is part of LibreELEC - https://libreelec.tv +# Copyright (C) 2018-present Team LibreELEC +# +# LibreELEC 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 2 of the License, or +# (at your option) any later version. +# +# LibreELEC 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 LibreELEC. If not, see . +################################################################################ + +PKG_NAME="minidlna" +PKG_VERSION="138d03d" +PKG_SHA256="efd780aa7c7e076dee273694b73d2f03598b0201ca79335b2975779c24469f97" +PKG_REV="100" +PKG_ARCH="any" +PKG_LICENSE="BSD-3c/GPLv2" +PKG_SITE="https://sourceforge.net/projects/minidlna/" +PKG_URL="http://repo.or.cz/minidlna.git/snapshot/$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain libiconv libid3tag libexif libjpeg-turbo libogg libvorbis ffmpeg flac sqlite" +PKG_SECTION="service" +PKG_SHORTDESC="MiniDLNA (ReadyMedia): a fully compliant DLNA/UPnP-AV server" +PKG_LONGDESC="MiniDLNA ($PKG_VERSION) (ReadyMedia) is a media server, with the aim of being fully compliant with DLNA/UPnP-AV clients." +PKG_TOOLCHAIN="autotools" + +PKG_IS_ADDON="yes" +PKG_ADDON_NAME="MiniDLNA (ReadyMedia)" +PKG_ADDON_TYPE="xbmc.service" + +PKG_CONFIGURE_OPTS_TARGET="--disable-static \ + --disable-nls \ + --without-libiconv-prefix \ + --without-libintl-prefix \ + --with-os-name="$DISTRONAME" \ + --with-db-path="/storage/.kodi/userdata/addon_data/service.minidlna/db" \ + --with-os-url="https://libreelec.tv"" + +pre_configure_target() { + export LDFLAGS="$LDFLAGS -L$(get_build_dir ffmpeg)/.install_pkg/usr/lib" + export LIBS="$LIBS -lid3tag -lFLAC -logg -lz -lpthread -ldl -lm" +} + +addon() { + mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/bin + cp -P $PKG_BUILD/.install_pkg/usr/sbin/minidlnad $ADDON_BUILD/$PKG_ADDON_ID/bin + + mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/lib + cp -p $(get_build_dir libexif)/.install_pkg/usr/lib/libexif.so.12 $ADDON_BUILD/$PKG_ADDON_ID/lib +} diff --git a/packages/addons/service/minidlna/patches/minidlna-01-fix-config.patch b/packages/addons/service/minidlna/patches/minidlna-01-fix-config.patch new file mode 100644 index 0000000000..7880b27f91 --- /dev/null +++ b/packages/addons/service/minidlna/patches/minidlna-01-fix-config.patch @@ -0,0 +1,23 @@ +disabling editing of the configfiles at buildtime +--- a/Makefile.am ++++ b/Makefile.am +@@ -73,19 +73,6 @@ testupnpdescgen_LDADD = \ + @LIBEXIF_LIBS@ \ + -lFLAC $(flacogglibs) $(vorbislibs) $(avahilibs) + +-SUFFIXES = .tmpl . +- +-.tmpl: +- sed -e s@:SBINDIR:@${sbindir}@ <$< >$@ +- +-GENERATED_FILES = \ +- linux/minidlna.init.d.script +- +-TEMPLATES = \ +- linux/minidlna.init.d.script.tmpl +- +-CLEANFILES = $(GENERATED_FILES) +- + ACLOCAL_AMFLAGS = -I m4 + + EXTRA_DIST = m4/ChangeLog $(TEMPLATES) diff --git a/packages/addons/service/minidlna/source/bin/minidlna.start b/packages/addons/service/minidlna/source/bin/minidlna.start new file mode 100755 index 0000000000..01318689d1 --- /dev/null +++ b/packages/addons/service/minidlna/source/bin/minidlna.start @@ -0,0 +1,36 @@ +#!/bin/sh + +################################################################################ +# This file is part of LibreELEC - https://libreelec.tv +# Copyright (C) 2018-present Team LibreELEC +# +# LibreELEC 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 2 of the License, or +# (at your option) any later version. +# +# LibreELEC 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 LibreELEC. If not, see . +################################################################################ + +. /etc/profile + +oe_setup_addon service.minidlna + +if [ ! -f "$ADDON_HOME/config/minidlna.conf" ]; then + mkdir -p $ADDON_HOME/config + cp $ADDON_DIR/config/minidlna.conf $ADDON_HOME/config +fi + +if [ ! -d "$ADDON_HOME/db" ]; then + mkdir -p $ADDON_HOME/db +fi + +chmod a+x $ADDON_DIR/bin/* + +exec $ADDON_DIR/bin/minidlnad -S -f $ADDON_HOME/config/minidlna.conf -p $minidlna_port &>$ADDON_HOME/service.log diff --git a/packages/addons/service/minidlna/source/config/minidlna.conf b/packages/addons/service/minidlna/source/config/minidlna.conf new file mode 100644 index 0000000000..8cb4a4d8e2 --- /dev/null +++ b/packages/addons/service/minidlna/source/config/minidlna.conf @@ -0,0 +1,79 @@ +# set this to the directory you want scanned +# + "A" for audio (eg. media_dir=A,/storage/music) +# + "V" for video (eg. media_dir=V,/storage/videos) +# + "P" for images (eg. media_dir=P,/storage/pictures) +# + "PV" for pictures and video (eg. media_dir=PV,/storage/digital_camera) +media_dir=V,/storage/videos +media_dir=V,/storage/tvshows +media_dir=P,/storage/pictures +media_dir=A,/storage/music + +# set this if you want to customize the name that shows up on your clients +friendly_name=DLNA Server + +# network interfaces to serve, comma delimited (8 interfaces max) +#network_interface=eth0 + +# set this to merge all media_dir base contents into the root container +# note: the default is no +#merge_media_dirs=no + +# set this to change the verbosity of the information that is logged +# each section can use a different level: off, fatal, error, warn, info, or debug +#log_level=general,artwork,database,inotify,scanner,metadata,http,ssdp,tivo=warn + +# this should be a list of file names to check for when searching for album art +# note: names should be delimited with a forward slash ("/") +album_art_names=Cover.jpg/cover.jpg/AlbumArtSmall.jpg/albumartsmall.jpg/AlbumArt.jpg/albumart.jpg/Album.jpg/album.jpg/Folder.jpg/folder.jpg/Thumb.jpg/thumb.jpg + +# set this to no to disable inotify monitoring to automatically discover new files +# note: the default is yes +inotify=yes + +# set this to yes to enable support for streaming .jpg and .mp3 files to a TiVo supporting HMO +enable_tivo=no + +# set this to beacon to use legacy broadcast discovery method +# defauts to bonjour if avahi is available +tivo_discovery=bonjour + +# set this to strictly adhere to DLNA standards. +# * This will allow server-side downscaling of very large JPEG images, +# which may hurt JPEG serving performance on (at least) Sony DLNA products. +strict_dlna=no + +# default presentation url is http address on port 80 +#presentation_url=http://www.mylan/index.php + +# notify interval in seconds. default is 895 seconds. +notify_interval=1800 + +# serial and model number the daemon will report to clients +# in its XML description +serial=12345678 +model_number=1 + +# use different container as root of the tree +# possible values: +# + "." - use standard container (this is the default) +# + "B" - "Browse Directory" +# + "M" - "Music" +# + "V" - "Video" +# + "P" - "Pictures" +# + Or, you can specify the ObjectID of your desired root container (eg. 1$F for Music/Playlists) +# if you specify "B" and client device is audio-only then "Music/Folders" will be used as root +#root_container=. + +# always force SortCriteria to this value, regardless of the SortCriteria passed by the client +# note: you can prepend the sort criteria with "!" to alter the titles of the objects so that they +# will be alphanumerically sorted in the order you specify here, to work around clients that do their +# own alphanumeric sorting. +#force_sort_criteria=+upnp:class,+upnp:originalTrackNumber,+dc:title + +# maximum number of simultaneous connections +# note: many clients open several simultaneous connections while streaming +#max_connections=50 + +# enable subtitle support by default on unknown clients. +# note: the default is yes +#enable_subtitles=yes diff --git a/packages/addons/service/minidlna/source/default.py b/packages/addons/service/minidlna/source/default.py new file mode 100644 index 0000000000..a75b598442 --- /dev/null +++ b/packages/addons/service/minidlna/source/default.py @@ -0,0 +1,35 @@ +################################################################################ +# This file is part of LibreELEC - https://libreelec.tv +# Copyright (C) 2018-present Team LibreELEC +# +# LibreELEC 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 2 of the License, or +# (at your option) any later version. +# +# LibreELEC 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 LibreELEC. If not, see . +################################################################################ + +import subprocess +import xbmc +import xbmcaddon + + +class Monitor(xbmc.Monitor): + + def __init__(self, *args, **kwargs): + xbmc.Monitor.__init__(self) + self.id = xbmcaddon.Addon().getAddonInfo('id') + + def onSettingsChanged(self): + subprocess.call(['systemctl', 'restart', self.id]) + + +if __name__ == "__main__": + Monitor().waitForAbort() diff --git a/packages/addons/service/minidlna/source/resources/language/English/strings.po b/packages/addons/service/minidlna/source/resources/language/English/strings.po new file mode 100644 index 0000000000..7f9ba3813d --- /dev/null +++ b/packages/addons/service/minidlna/source/resources/language/English/strings.po @@ -0,0 +1,14 @@ +# Kodi Media Center language file +# Addon Name: minidlna +# Addon id: service.minidlna +# Addon Provider: Team LibreELEC +msgid "" +msgstr "" + +msgctxt "#30000" +msgid "Configuration" +msgstr "" + +msgctxt "#30001" +msgid "Port" +msgstr "" diff --git a/packages/addons/service/minidlna/source/resources/settings.xml b/packages/addons/service/minidlna/source/resources/settings.xml new file mode 100644 index 0000000000..5dc0437e50 --- /dev/null +++ b/packages/addons/service/minidlna/source/resources/settings.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/packages/addons/service/minidlna/source/settings-default.xml b/packages/addons/service/minidlna/source/settings-default.xml new file mode 100644 index 0000000000..02b57fb1f8 --- /dev/null +++ b/packages/addons/service/minidlna/source/settings-default.xml @@ -0,0 +1,3 @@ + + + diff --git a/packages/addons/service/minidlna/source/sleep.d/minidlna.power b/packages/addons/service/minidlna/source/sleep.d/minidlna.power new file mode 100644 index 0000000000..0bc5fe9ca6 --- /dev/null +++ b/packages/addons/service/minidlna/source/sleep.d/minidlna.power @@ -0,0 +1,40 @@ +#!/bin/sh + +################################################################################ +# This file is part of LibreELEC - https://libreelec.tv +# Copyright (C) 2018-present Team LibreELEC +# +# LibreELEC 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 2 of the License, or +# (at your option) any later version. +# +# LibreELEC 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 LibreELEC. If not, see . +################################################################################ + +. /etc/profile + +oe_setup_addon service.minidlna + +SERVICE="service.minidlna" + +if [ "$RESTART_ON_RESUME" == "true" ] ; then + case "$1" in + pre) + if systemctl is-active "$SERVICE" &>/dev/null ; then + systemctl stop "$SERVICE" + fi + ;; + post) + if systemctl is-enabled "$SERVICE" &>/dev/null ; then + systemctl start "$SERVICE" + fi + ;; + esac +fi diff --git a/packages/addons/service/minidlna/source/system.d/service.minidlna.service b/packages/addons/service/minidlna/source/system.d/service.minidlna.service new file mode 100644 index 0000000000..fad4788058 --- /dev/null +++ b/packages/addons/service/minidlna/source/system.d/service.minidlna.service @@ -0,0 +1,13 @@ +[Unit] +Description=minidlna +After=graphical.target + +[Service] +ExecStart=/bin/sh -c "exec sh /storage/.kodi/addons/service.minidlna/bin/minidlna.start" +TimeoutStopSec=1 +Restart=always +RestartSec=2 +StartLimitInterval=0 + +[Install] +WantedBy=kodi.target