net-misc/gerbera: UPnP Media Server for 2017 (Based on MediaTomb)

Ebuild by me, files borrowed from net-misc/mediatomb.

Package-Manager: Portage-2.3.5, Repoman-2.3.2
This commit is contained in:
Ian Whyman
2017-05-29 17:19:35 +01:00
parent 96e2478c6d
commit 771f83cd68
7 changed files with 417 additions and 0 deletions

View File

@@ -0,0 +1 @@
DIST gerbera-1.0.0.tar.gz 805102 SHA256 297c26e0b4223ea96cc6db403e2a2e8f81c51b64284535f3bc644abf24f66975 SHA512 ddc269ce65ba6cd4778c3a7d7dd7f368d659e2813cee962ed167e1ab5a887d8dae32c0197e95733a799c2bb4835904c94f11e1411d4dfab4ed05f39519d4f42d WHIRLPOOL fc568d3e0c58b415b4cfe45a36418c821afcd3909dfd08a99c4ace1c8995d51ea8f7a8f90e13858d60605d5c8ab6aa08b1cb2a10cb02133cef45bfdc2d320ec0

View File

@@ -0,0 +1,28 @@
# /etc/conf.d/mediatomb: config file for /etc/init.d/mediatomb
# See the mediatomb(1) manpage for more info.
# MediaTomb Web UI port.
# NOTE: The minimum value allowed is 49152
MEDIATOMB_PORT=49152
# Run MediaTomb as this user.
# NOTE: For security reasons do not run MediaTomb as root.
MEDIATOMB_USER="mediatomb"
# Run MediaTomb as this group.
# NOTE: For security reasons do not run MediaTomb as root.
MEDIATOMB_GROUP="mediatomb"
# Path to MediaTomb config file.
MEDIATOMB_CONFIG="/etc/mediatomb/config.xml"
# Path to MediaTomb log file.
MEDIATOMB_LOGFILE="/var/log/mediatomb.log"
# Path to MediaTomb pid file.
MEDIATOMB_PIDFILE="/var/run/mediatomb.pid"
# Other options you want to pass to MediaTomb.
# Add "--interface ${MEDIATOMB_INTERFACE}" to bind to a named interface.
MEDIATOMB_OPTIONS=""

View File

@@ -0,0 +1,144 @@
<?xml version="1.0" encoding="UTF-8"?>
<config version="2" xmlns="http://mediatomb.cc/config/2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://mediatomb.cc/config/2 http://mediatomb.cc/config/2.xsd">
<server>
<ui enabled="yes" show-tooltips="yes">
<accounts enabled="no" session-timeout="30">
<account user="gerbera" password="mediatomb"/>
</accounts>
</ui>
<name>Gerbera</name>
<udn></udn>
<home>/var/lib/gerbera</home>
<webroot>/usr/share/gerbera/web</webroot>
<storage>
<sqlite3 enabled="yes">
<database-file>gerbera.db</database-file>
</sqlite3>
<mysql enabled="no">
<host>host</host>
<database>database</database>
<username>username</username>
<password>password</password>
</mysql>
</storage>
<protocolInfo extend="yes"/>
<pc-directory upnp-hide="no"/>
<extended-runtime-options>
<ffmpegthumbnailer enabled="no">
<thumbnail-size>160</thumbnail-size>
<seek-percentage>10</seek-percentage>
<filmstrip-overlay>no</filmstrip-overlay>
<workaround-bugs>no</workaround-bugs>
<image-quality>8</image-quality>
</ffmpegthumbnailer>
<mark-played-items enabled="no" suppress-cds-updates="yes">
<string mode="prepend">*</string>
<mark>
<content>video</content>
</mark>
</mark-played-items>
<lastfm enabled="no">
<username>username</username>
<password>password</password>
</lastfm>
</extended-runtime-options>
</server>
<import hidden-files="no">
<scripting script-charset="UTF-8">
<common-script>/usr/share/gerbera/js/common.js</common-script>
<playlist-script>/usr/share/gerbera/js/playlists.js</playlist-script>
<virtual-layout type="builtin">
<import-script>/usr/share/gerbera/js/import.js</import-script>
</virtual-layout>
</scripting>
<mappings>
<extension-mimetype ignore-unknown="no">
<map from="mp3" to="audio/mpeg"/>
<map from="ogx" to="application/ogg"/>
<map from="ogv" to="video/ogg"/>
<map from="oga" to="audio/ogg"/>
<map from="ogg" to="audio/ogg"/>
<map from="ogm" to="video/ogg"/>
<map from="asf" to="video/x-ms-asf"/>
<map from="asx" to="video/x-ms-asf"/>
<map from="wma" to="audio/x-ms-wma"/>
<map from="wax" to="audio/x-ms-wax"/>
<map from="wmv" to="video/x-ms-wmv"/>
<map from="wvx" to="video/x-ms-wvx"/>
<map from="wm" to="video/x-ms-wm"/>
<map from="wmx" to="video/x-ms-wmx"/>
<map from="m3u" to="audio/x-mpegurl"/>
<map from="pls" to="audio/x-scpls"/>
<map from="flv" to="video/x-flv"/>
<map from="mkv" to="video/x-matroska"/>
<map from="mka" to="audio/x-matroska"/>
<map from="avi" to="video/divx"/>
<map from="m2ts" to="video/avc"/>
<map from="cr2" to="image/raw"/>
<map from="nef" to="image/raw"/>
</extension-mimetype>
<mimetype-upnpclass>
<map from="audio/*" to="object.item.audioItem.musicTrack"/>
<map from="video/*" to="object.item.videoItem"/>
<map from="image/*" to="object.item.imageItem"/>
</mimetype-upnpclass>
<mimetype-contenttype>
<treat mimetype="audio/mpeg" as="mp3"/>
<treat mimetype="application/ogg" as="ogg"/>
<treat mimetype="video/ogg" as="ogg"/>
<treat mimetype="audio/ogg" as="ogg"/>
<treat mimetype="audio/x-flac" as="flac"/>
<treat mimetype="image/jpeg" as="jpg"/>
<treat mimetype="audio/x-mpegurl" as="playlist"/>
<treat mimetype="audio/x-scpls" as="playlist"/>
<treat mimetype="audio/x-wav" as="pcm"/>
<treat mimetype="audio/L16" as="pcm"/>
<treat mimetype="video/x-msvideo" as="avi"/>
<treat mimetype="video/mp4" as="mp4"/>
<treat mimetype="audio/mp4" as="mp4"/>
<treat mimetype="video/divx" as="avi"/>
</mimetype-contenttype>
</mappings>
<online-content>
<YouTube enabled="no" refresh="28800" update-at-start="yes" purge-after="604800" racy-content="exclude" format="mp4" hd="no">
<favorites user="NationalGeographic"/>
<playlists user="PlayStation"/>
<uploads user="Google"/>
<standardfeed feed="most_viewed" time-range="today"/>
<standardfeed feed="recently_featured" time-range="today"/>
</YouTube>
</online-content>
</import>
<transcoding enabled="no">
<mimetype-profile-mappings>
<transcode mimetype="audio/ogg" using="audio2pcm"/>
<transcode mimetype="audio/x-flac" using="audio2pcm"/>
<transcode mimetype="video/ogg" using="video2mpeg"/>
<transcode mimetype="video/x-flv" using="video2mpeg"/>
</mimetype-profile-mappings>
<profiles>
<profile name="audio2pcm" enabled="yes" type="external">
<mimetype>audio/L16</mimetype>
<accept-url>no</accept-url>
<first-resource>yes</first-resource>
<hide-original-resource>yes</hide-original-resource>
<accept-ogg-theora>no</accept-ogg-theora>
<sample-frequency>44100</sample-frequency>
<audio-channels>2</audio-channels>
<agent command="ffmpeg" arguments="-i %in -acodec pcm_s16be -ab 192k -ar 44100 -ac 2 -f s16be -y %out"/>
<buffer size="1048576" chunk-size="131072" fill-size="262144"/>
</profile>
<profile name="video2mpeg" enabled="yes" type="external">
<mimetype>video/mpeg</mimetype>
<accept-url>no</accept-url>
<first-resource>yes</first-resource>
<hide-original-resource>yes</hide-original-resource>
<accept-ogg-theora>yes</accept-ogg-theora>
<sample-frequency>48000</sample-frequency>
<audio-channels>2</audio-channels>
<agent command="ffmpeg" arguments="-i %in -vcodec mpeg2video -b 4096k -r 25 -acodec mp2 -ab 192k -ar 48000 -ac 2 -async 1 -f dvd -threads 2 -y %out"/>
<buffer size="10485760" chunk-size="262144" fill-size="524288"/>
</profile>
</profiles>
</transcoding>
</config>

View File

@@ -0,0 +1,29 @@
#!/sbin/openrc-run
# Copyright 1999-2017 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Id$
depend() {
need net
# In order to properly support this (need vs use), we would have to
# parse ${MEDIATOMB_CONFIG} and see if mysql is enabled and if it is
# pointing to the local system. #368409
use mysql
}
start() {
ebegin "Starting MediaTomb"
start-stop-daemon --start --quiet --exec /usr/bin/mediatomb \
--pidfile ${MEDIATOMB_PIDFILE} -- --daemon \
--pidfile ${MEDIATOMB_PIDFILE} --user ${MEDIATOMB_USER} \
--group ${MEDIATOMB_GROUP} --logfile ${MEDIATOMB_LOGFILE} \
--config ${MEDIATOMB_CONFIG} --port ${MEDIATOMB_PORT} \
${MEDIATOMB_OPTIONS}
eend $?
}
stop () {
ebegin "Stopping MediaTomb"
start-stop-daemon --stop --retry 10 --quiet --pidfile ${MEDIATOMB_PIDFILE}
eend $?
}

View File

@@ -0,0 +1,98 @@
# Copyright 1999-2017 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
EAPI=6
inherit cmake-utils eutils linux-info systemd user
if [[ ${PV} == 9999 ]]; then
EGIT_REPO_URI="https://github.com/v00d00/${PN}.git"
KEYWORDS=""
SRC_URI=""
inherit git-r3
else
SRC_URI="https://github.com/v00d00/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz"
KEYWORDS="~amd64 ~x86"
S="${WORKDIR}/${P}"
fi
DESCRIPTION="UPnP Media Server (Based on MediaTomb)"
HOMEPAGE="https://github.com/v00d00/gerbera"
LICENSE="GPL-2"
SLOT="0"
IUSE="curl debug +exif +ffmpeg +javascript lastfm libav +magic mysql +taglib"
DEPEND="
!!net-misc/mediatomb
net-libs/libupnp:1.8[reuseaddr]
>=dev-db/sqlite-3
dev-libs/expat
mysql? ( virtual/mysql )
javascript? ( dev-lang/duktape )
taglib? ( >=media-libs/taglib-1.11 )
lastfm? ( >=media-libs/lastfmlib-0.4 )
exif? ( media-libs/libexif )
ffmpeg? (
libav? ( >=media-video/libav-10:0= )
!libav? ( >=media-video/ffmpeg-2.2:0= )
)
curl? ( net-misc/curl net-misc/youtube-dl )
magic? ( sys-apps/file )
sys-apps/util-linux
sys-libs/zlib
virtual/libiconv
"
RDEPEND="${DEPEND}"
CONFIG_CHECK="~INOTIFY_USER"
pkg_setup() {
linux-info_pkg_setup
enewgroup ${PN}
enewuser ${PN} -1 -1 /dev/null ${PN}
}
src_configure() {
local mycmakeargs=(
-DWITH_CURL="$(usex curl)" \
-DWITH_LOGGING=1 \
-DWITH_DEBUG_LOGGING="$(usex debug)" \
-DWITH_EXIF="$(usex exif)" \
-DWITH_AVCODEC="$(usex ffmpeg)" \
-DWITH_JS="$(usex javascript)" \
-DWITH_LASTFM="$(usex lastfm)" \
-DWITH_MAGIC="$(usex magic)" \
-DWITH_MYSQL="$(usex mysql)"
)
cmake-utils_src_configure
}
src_install() {
cmake-utils_src_install
systemd_dounit "${S}/scripts/systemd/${PN}.service"
use mysql && systemd_dounit "${S}/scripts/systemd/${PN}-mysql.service"
newinitd "${FILESDIR}/${PN}-1.0.0.initd" "${PN}"
use mysql || sed -i -e "/use mysql/d" "${ED}/etc/init.d/${PN}"
newconfd "${FILESDIR}/${PN}-1.0.0.confd" "${PN}"
insinto /etc/${PN}
newins "${FILESDIR}/${PN}-1.0.0.config" config.xml
fperms 0600 /etc/${PN}/config.xml
fowners gerbera:gerbera /etc/${PN}/config.xml
keepdir /var/lib/${PN}
fowners ${PN}:${PN} /var/lib/${PN}
}
pkg_postinst() {
if use mysql ; then
elog "Gerbera has been built with MySQL support and needs"
elog "to be configured before being started. By default"
elog "SQLite will be used."
fi
}

View File

@@ -0,0 +1,98 @@
# Copyright 1999-2017 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
EAPI=6
inherit cmake-utils eutils linux-info systemd user
if [[ ${PV} == 9999 ]]; then
EGIT_REPO_URI="https://github.com/v00d00/${PN}.git"
KEYWORDS=""
SRC_URI=""
inherit git-r3
else
SRC_URI="https://github.com/v00d00/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz"
KEYWORDS="~amd64 ~x86"
S="${WORKDIR}/${P}"
fi
DESCRIPTION="UPnP Media Server (Based on MediaTomb)"
HOMEPAGE="https://github.com/v00d00/gerbera"
LICENSE="GPL-2"
SLOT="0"
IUSE="curl debug +exif +ffmpeg +javascript lastfm libav +magic mysql +taglib"
DEPEND="
!!net-misc/mediatomb
net-libs/libupnp:1.8[reuseaddr]
>=dev-db/sqlite-3
dev-libs/expat
mysql? ( virtual/mysql )
javascript? ( dev-lang/duktape )
taglib? ( >=media-libs/taglib-1.11 )
lastfm? ( >=media-libs/lastfmlib-0.4 )
exif? ( media-libs/libexif )
ffmpeg? (
libav? ( >=media-video/libav-10:0= )
!libav? ( >=media-video/ffmpeg-2.2:0= )
)
curl? ( net-misc/curl net-misc/youtube-dl )
magic? ( sys-apps/file )
sys-apps/util-linux
sys-libs/zlib
virtual/libiconv
"
RDEPEND="${DEPEND}"
CONFIG_CHECK="~INOTIFY_USER"
pkg_setup() {
linux-info_pkg_setup
enewgroup ${PN}
enewuser ${PN} -1 -1 /dev/null ${PN}
}
src_configure() {
local mycmakeargs=(
-DWITH_CURL="$(usex curl)" \
-DWITH_LOGGING=1 \
-DWITH_DEBUG_LOGGING="$(usex debug)" \
-DWITH_EXIF="$(usex exif)" \
-DWITH_AVCODEC="$(usex ffmpeg)" \
-DWITH_JS="$(usex javascript)" \
-DWITH_LASTFM="$(usex lastfm)" \
-DWITH_MAGIC="$(usex magic)" \
-DWITH_MYSQL="$(usex mysql)"
)
cmake-utils_src_configure
}
src_install() {
cmake-utils_src_install
systemd_dounit "${S}/scripts/systemd/${PN}.service"
use mysql && systemd_dounit "${S}/scripts/systemd/${PN}-mysql.service"
newinitd "${FILESDIR}/${PN}-1.0.0.initd" "${PN}"
use mysql || sed -i -e "/use mysql/d" "${ED}/etc/init.d/${PN}"
newconfd "${FILESDIR}/${PN}-1.0.0.confd" "${PN}"
insinto /etc/${PN}
newins "${FILESDIR}/${PN}-1.0.0.config" config.xml
fperms 0600 /etc/${PN}/config.xml
fowners gerbera:gerbera /etc/${PN}/config.xml
keepdir /var/lib/${PN}
fowners ${PN}:${PN} /var/lib/${PN}
}
pkg_postinst() {
if use mysql ; then
elog "Gerbera has been built with MySQL support and needs"
elog "to be configured before being started. By default"
elog "SQLite will be used."
fi
}

View File

@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
<pkgmetadata>
<maintainer type="person">
<email>thev00d00@gentoo.org</email>
<name>Ian Whyman</name>
</maintainer>
<longdescription>Gerbera is a UPnP media server which allows you to stream your digital media through your home network and consume it on a variety of UPnP compatible devices.</longdescription>
<use>
<flag name="curl">Support YouTube and external media sources (e.g. internet radio)</flag>
<flag name="lastfm">Enable last.fm support</flag>
<flag name="magic">Use libmagic to determine file types</flag>
<flag name="mysql">Use <pkg>dev-db/mysql</pkg> as backend rather than SQLite3</flag>
<flag name="taglib">Use <pkg>media-libs/taglib</pkg> for reading files' metadata rather than id3lib</flag>
</use>
<upstream>
<remote-id type="github">v00d00/gerbera</remote-id>
</upstream>
</pkgmetadata>