mirror of
https://github.com/libretro/Lakka-LibreELEC.git
synced 2025-01-08 11:58:19 +00:00
188 lines
5.3 KiB
Bash
188 lines
5.3 KiB
Bash
#!/bin/sh
|
|
|
|
# SPDX-License-Identifier: GPL-2.0-or-later
|
|
# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv)
|
|
# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv)
|
|
|
|
. /etc/profile
|
|
|
|
oe_setup_addon service.multimedia.vdr-addon
|
|
|
|
fix_config() {
|
|
if [ -f "$ADDON_CONFIG_DIR/setup.conf" ]; then
|
|
sed -i -e '/^$/d' $ADDON_CONFIG_DIR/setup.conf
|
|
sed -i -e '/^AlwaysSortFoldersFirst.*$/d' $ADDON_CONFIG_DIR/setup.conf
|
|
sed -i -e '/^SetSystemTime.*$/d' $ADDON_CONFIG_DIR/setup.conf
|
|
sed -i -e '/^epgsearch.SVDRPPort.*$/d' $ADDON_CONFIG_DIR/setup.conf
|
|
sed -i -e '/^OSD.*$/d' $ADDON_CONFIG_DIR/setup.conf
|
|
sed -i -e '/^Font.*$/d' $ADDON_CONFIG_DIR/setup.conf
|
|
fi
|
|
cat >>$ADDON_CONFIG_DIR/setup.conf << MYDATA
|
|
AlwaysSortFoldersFirst = 1
|
|
SetSystemTime = 0
|
|
epgsearch.SVDRPPort = 6419
|
|
OSDSkin = sttng
|
|
MYDATA
|
|
}
|
|
|
|
ADDON_CONFIG_DIR="$ADDON_HOME/config"
|
|
ADDON_PLUGIN_DIR="$ADDON_DIR/plugin"
|
|
|
|
chmod a+x $ADDON_DIR/bin/*
|
|
|
|
ADDON_CACHE_DIR="$ADDON_HOME/cache"
|
|
mkdir -p $ADDON_CACHE_DIR
|
|
|
|
VDR_ARG="-g /tmp --no-kbd"
|
|
if [ "$DEBUG" = "yes" -o "$ENABLE_VDR_DEBUG" == "true" ]; then
|
|
VDR_ARG="$VDR_ARG --log=3"
|
|
else
|
|
VDR_ARG="$VDR_ARG --log=1"
|
|
fi
|
|
|
|
SVDRP_PORT=0
|
|
|
|
# epgsearch needs svdrp
|
|
if [ "$ENABLE_EPGSEARCH" == "true" ] ; then
|
|
SVDRP_PORT=6419
|
|
fi
|
|
VDR_ARG="$VDR_ARG --port=$SVDRP_PORT"
|
|
|
|
VDR_ARG="$VDR_ARG --dirnames=,,1"
|
|
|
|
VDR_ARG="$VDR_ARG --config=$ADDON_CONFIG_DIR"
|
|
VDR_ARG="$VDR_ARG --resdir=$ADDON_DIR/res"
|
|
VDR_ARG="$VDR_ARG --cachedir=$ADDON_CACHE_DIR"
|
|
VDR_ARG="$VDR_ARG --lib=$ADDON_PLUGIN_DIR"
|
|
VDR_ARG="$VDR_ARG --video=\"$VDR_VIDEO_DIR\""
|
|
VDR_ARG="$VDR_ARG --localedir=$ADDON_DIR/locale"
|
|
|
|
if [ "$ENABLE_EXTERNAL_RECCMD" == "true" ] ; then
|
|
if [ ! -z "$EXTERNAL_RECCMD_PATH" -a -x "$EXTERNAL_RECCMD_PATH" ] ; then
|
|
VDR_ARG="$VDR_ARG -r \"$EXTERNAL_RECCMD_PATH\""
|
|
fi
|
|
fi
|
|
|
|
if [ "$ENABLE_CHARSET_OVERRIDE" == "true" ] ; then
|
|
if [ ! -z "$CHARSET_OVERRIDE_STR" ] ; then
|
|
VDR_ARG="$VDR_ARG --chartab=$CHARSET_OVERRIDE_STR"
|
|
fi
|
|
fi
|
|
|
|
# keep softcam first
|
|
if [ "$ENABLE_SOFTCAM" == "true" ] ; then
|
|
VDR_ARG="$VDR_ARG -P dvbapi"
|
|
fi
|
|
VDR_ARG="$VDR_ARG -P wirbelscan -P wirbelscancontrol"
|
|
if [ "$ENABLE_IPTV" == "true" ] ; then
|
|
VDR_ARG="$VDR_ARG -P 'iptv -d $IPTV_NUM_DEVICES'"
|
|
fi
|
|
if [ "$ENABLE_STREAMDEV_SERVER" == "true" ] ; then
|
|
VDR_ARG="$VDR_ARG -P streamdev-server"
|
|
fi
|
|
if [ "$ENABLE_STREAMDEV_CLIENT" == "true" ] ; then
|
|
VDR_ARG="$VDR_ARG -P streamdev-client"
|
|
fi
|
|
if [ "$ENABLE_LIVE" == "true" ] ; then
|
|
VDR_ARG="$VDR_ARG -P 'live -i $LIVE_IP -p $LIVE_PORT'"
|
|
fi
|
|
if [ "$ENABLE_EEPG" == "true" ] ; then
|
|
VDR_ARG="$VDR_ARG -P eepg"
|
|
fi
|
|
if [ "$ENABLE_EPGFIXER" == "true" ] ; then
|
|
VDR_ARG="$VDR_ARG -P epgfixer"
|
|
fi
|
|
if [ "$ENABLE_EPGSEARCH" == "true" ] ; then
|
|
VDR_ARG="$VDR_ARG -P epgsearch"
|
|
fi
|
|
if [ "$ENABLE_DUMMYDEVICE" == "true" \
|
|
-o ! \( -d /dev/dvb/adapter0 -o "$WAIT_FOR_FEINIT" == "true" \
|
|
-o "$ENABLE_SATIP" == "true" \
|
|
-o "$ENABLE_STREAMDEV_CLIENT" == "true" \) ] ; then
|
|
VDR_ARG="$VDR_ARG -P dummydevice"
|
|
else
|
|
VNSI_ARG=" -d"
|
|
fi
|
|
if [ "$ENABLE_SATIP" == "true" ] ; then
|
|
VDR_ARG="$VDR_ARG -P 'satip -d $SATIP_NUM_DEVICES'"
|
|
fi
|
|
if [ "$ENABLE_XMLTV2VDR" == "true" ] ; then
|
|
VDR_ARG="$VDR_ARG -P 'xmltv2vdr --epgfile=$ADDON_CACHE_DIR/epg.db'"
|
|
# xmltv2vdr needs /var/run/vdr
|
|
grep -q " /var/run/vdr " /proc/mounts || ( mkdir -p /var/run/vdr && mount -t tmpfs -o size=10% tmpfs /var/run/vdr )
|
|
#handle epgsources
|
|
mkdir -p /var/lib/epgsources
|
|
mkdir -p $ADDON_HOME/config/epgsources
|
|
for source in `find $ADDON_DIR/config/epgsources -type f`; do
|
|
if [ ! -e $ADDON_HOME/config/epgsources/`basename $source` ] ; then
|
|
cp $source $ADDON_HOME/config/epgsources/
|
|
fi
|
|
done
|
|
for source in `find $ADDON_HOME/config/epgsources -type f`; do
|
|
cp $source /var/lib/epgsources
|
|
done
|
|
fi
|
|
if [ "$ENABLE_ROBOTV" == "true" ] ; then
|
|
VDR_ARG="$VDR_ARG -P robotv"
|
|
fi
|
|
if [ "$ENABLE_DDCI2" == "true" ] ; then
|
|
VDR_ARG="$VDR_ARG -P ddci2"
|
|
fi
|
|
|
|
if [ ! -d "$ADDON_HOME/epgimages" ]; then
|
|
mkdir -p "$ADDON_HOME/epgimages"
|
|
fi
|
|
if [ ! -z "$ADDON_HOME/channellogos" ]; then
|
|
mkdir -p "$ADDON_HOME/channellogos"
|
|
fi
|
|
|
|
RESTFULAPI_ARGS="--ip $RESTFULAPI_IP --port $RESTFULAPI_PORT"
|
|
RESTFULAPI_ARGS="$RESTFULAPI_ARGS --epgimages=\"$ADDON_HOME/epgimages\""
|
|
RESTFULAPI_ARGS="$RESTFULAPI_ARGS --channellogos=\"$ADDON_HOME/channellogos\""
|
|
VDR_ARG="$VDR_ARG -P 'restfulapi $RESTFULAPI_ARGS'"
|
|
|
|
# vnsi last
|
|
VDR_ARG="$VDR_ARG -P 'vnsiserver$VNSI_ARG'"
|
|
|
|
cd $ADDON_DIR/config
|
|
mkdir -p $ADDON_CONFIG_DIR
|
|
mkdir -p "$VDR_VIDEO_DIR"
|
|
|
|
for dir in `find . -type d`; do
|
|
mkdir -p $ADDON_CONFIG_DIR/$dir
|
|
done
|
|
|
|
for config in `find . -type f`; do
|
|
if [ ! -f $ADDON_CONFIG_DIR/$config ]; then
|
|
cp $config $ADDON_CONFIG_DIR/$config
|
|
fi
|
|
done
|
|
|
|
# start userspace DVB driver/addon
|
|
for driver_dvb in $(find /storage/.kodi/addons/driver.dvb.*/bin/userspace-driver.sh -type f 2>/dev/null); do
|
|
driver_dvb_name=$(echo $driver_dvb | awk 'BEGIN {FS="/"} {printf("%s", $5)}')
|
|
logger -t VDR "### Loading userspace DVB driver: $driver_dvb_name ###"
|
|
# use ". " because of variable export
|
|
. $driver_dvb
|
|
done
|
|
|
|
if [ "$WAIT_FOR_FEINIT" == "true" ] ; then
|
|
while [ true ] ; do
|
|
if [ -e /dev/dvb/adapter$((NUM_ADAPTERS-1))/frontend0 ] ; then
|
|
break
|
|
fi
|
|
sleep 1
|
|
done
|
|
fi
|
|
|
|
fix_config
|
|
|
|
if [ "$ENABLE_VDR_DEBUG" == "true" ] ; then
|
|
/usr/bin/journalctl -b -0 -f -u service.multimedia.vdr-addon > $ADDON_LOG_FILE &
|
|
sleep 1
|
|
fi
|
|
|
|
[ -z "$LANG" ] && export LANG=en_US.UTF-8
|
|
|
|
eval exec vdr.bin $VDR_ARG
|