From 282b913aefed4599ada598991eae323412373b66 Mon Sep 17 00:00:00 2001 From: Martin Vallevand Date: Thu, 26 Sep 2024 10:36:41 -0400 Subject: [PATCH] [le12] service.nextpvr backport of PR 9323 Also include PR #9507 Please do not merge maintenance release no yet on GitHub --- .../depends/libmediainfo/package.mk | 9 ++++-- packages/addons/service/nextpvr/changelog.txt | 5 ++++ packages/addons/service/nextpvr/package.mk | 15 ++++++++-- .../addons/service/nextpvr/source/addon.py | 2 ++ .../nextpvr/source/bin/nextpvr-downloader | 8 ++++- .../nextpvr/source/sleep.d/nextpvr.power | 29 +++++++++++++++++++ 6 files changed, 61 insertions(+), 7 deletions(-) create mode 100755 packages/addons/service/nextpvr/source/sleep.d/nextpvr.power diff --git a/packages/addons/addon-depends/multimedia-tools-depends/depends/libmediainfo/package.mk b/packages/addons/addon-depends/multimedia-tools-depends/depends/libmediainfo/package.mk index 27e64151933..cd4790dcec2 100644 --- a/packages/addons/addon-depends/multimedia-tools-depends/depends/libmediainfo/package.mk +++ b/packages/addons/addon-depends/multimedia-tools-depends/depends/libmediainfo/package.mk @@ -20,7 +20,7 @@ configure_target() { --host=${TARGET_NAME} \ --build=${HOST_NAME} \ --enable-static \ - --disable-shared \ + --enable-shared \ --prefix=/usr \ --enable-visibility } @@ -36,6 +36,9 @@ makeinstall_target() { mkdir -p ${INSTALL}/usr/include/MediaInfo/${i}/ cp -aP ../../../Source/MediaInfo/${i}/*.h ${INSTALL}/usr/include/MediaInfo/${i}/ done - cp -P .libs/* ${INSTALL}/usr/lib - cp -P libmediainfo.pc ${INSTALL}/usr/lib/pkgconfig + cp -P .libs/libmediainfo.a ${INSTALL}/usr/lib + + # move shared lib so mediainfo will not detect it and perform a static build + mkdir -p ${INSTALL}/shared-lib + cp -P .libs/libmediainfo.so* ${INSTALL}/shared-lib } diff --git a/packages/addons/service/nextpvr/changelog.txt b/packages/addons/service/nextpvr/changelog.txt index 927b2407d45..db6432f4069 100644 --- a/packages/addons/service/nextpvr/changelog.txt +++ b/packages/addons/service/nextpvr/changelog.txt @@ -1 +1,6 @@ +2 +- download NextPVR 7.0.1 +- install and configure, hdhomerun_config, comskip and libmediainfo +- fix manual updates from NPVR.zip + initial release diff --git a/packages/addons/service/nextpvr/package.mk b/packages/addons/service/nextpvr/package.mk index 43e011e3b70..a2ae87c4241 100644 --- a/packages/addons/service/nextpvr/package.mk +++ b/packages/addons/service/nextpvr/package.mk @@ -2,13 +2,13 @@ # Copyright (C) 2021-present Team LibreELEC (https://libreelec.tv) PKG_NAME="nextpvr" -PKG_VERSION="6.1.5~Omega" -PKG_ADDON_VERSION="6.1.5~4" +PKG_VERSION="7.0.1~Omega" +PKG_ADDON_VERSION="7.0.1~2" PKG_REV="0" PKG_ARCH="any" PKG_LICENSE="NextPVR" PKG_SITE="https://nextpvr.com" -PKG_DEPENDS_TARGET="toolchain" +PKG_DEPENDS_TARGET="toolchain libhdhomerun libmediainfo comskip" PKG_SECTION="service" PKG_SHORTDESC="NextPVR Server" PKG_LONGDESC="NextPVR is a personal video recorder application. It allows to watch or record live TV, provides great features like series recordings and web scheduling." @@ -25,4 +25,13 @@ addon() { post_install_addon() { sed -e "s/@NEXTPVR_VERSION@/${PKG_ADDON_VERSION}/g" -i "${INSTALL}/bin/nextpvr-downloader" + + mkdir -p ${INSTALL}/{lbin,lib.private} + cp $(get_build_dir libmediainfo)/Project/GNU/Library/.libs/libmediainfo.so ${INSTALL}/lib.private + cp -P $(get_build_dir libhdhomerun)/hdhomerun_config ${INSTALL}/lbin + cp -P $(get_install_dir comskip)/usr/bin/comskip ${INSTALL}/lbin + if [ "${TARGET_ARCH}" = "x86_64" ]; then + cp -P $(get_install_dir x265)/usr/lib/libx265.so.212 ${INSTALL}/lib.private + patchelf --add-rpath '${ORIGIN}/../lib.private' ${INSTALL}/lbin/comskip + fi } diff --git a/packages/addons/service/nextpvr/source/addon.py b/packages/addons/service/nextpvr/source/addon.py index e2aa59d41df..894d4730259 100644 --- a/packages/addons/service/nextpvr/source/addon.py +++ b/packages/addons/service/nextpvr/source/addon.py @@ -75,6 +75,8 @@ def updateNextPVR(self): xbmc.log('Running: %s' % command, xbmc.LOGDEBUG) os.system(command) os.remove(archive) + command = 'find {0}/DeviceHost -name DeviceHostLinux -exec chmod 755 {{}} \;'.format(dest_folder) + os.system(command) xbmcgui.Dialog().notification(ADDON_NAME, LS(30039), xbmcgui.NOTIFICATION_INFO) xbmc.log('NPVR.zip installed', xbmc.LOGDEBUG) if xbmcgui.Dialog().yesno("NextPVR Server", LS(30020)): diff --git a/packages/addons/service/nextpvr/source/bin/nextpvr-downloader b/packages/addons/service/nextpvr/source/bin/nextpvr-downloader index 64ed30b8597..ded29729c2f 100644 --- a/packages/addons/service/nextpvr/source/bin/nextpvr-downloader +++ b/packages/addons/service/nextpvr/source/bin/nextpvr-downloader @@ -40,7 +40,7 @@ echo "Downloading NextPVR" # download NextPVR rm -f ${CONTROL_FILE} ${DATA_FILE} ( - curl -L -# -O -C - https://github.com/sub3/releases/releases/download/${NEXTPVR_VERSION%~*}/${NEXTPVR_FILE} 2>${DATA_FILE} + curl -L -# -O -C - https://github.com/sub3/releases/releases/download/${NEXTPVR_VERSION%~*}/${NEXTPVR_FILE} 2>${DATA_FILE} touch ${CONTROL_FILE} ) | while [ : ]; do @@ -61,6 +61,12 @@ fi # extract NextPVR kodi-send --action="Notification(Extracting NextPVR,starting,1000,${ICON})" >/dev/null mkdir -p ${ADDON_DIR}/nextpvr-bin + +chmod +x ${ADDON_DIR}/lbin/hdhomerun_config +chmod +x ${ADDON_DIR}/lbin/comskip +ln -s ${ADDON_DIR}/lbin/hdhomerun_config ${ADDON_DIR}/nextpvr-bin +ln -s ${ADDON_DIR}/lib.private/libmediainfo.so ${ADDON_DIR}/nextpvr-bin + unzip ${NEXTPVR_FILE} -d ${ADDON_DIR}/nextpvr-bin >/dev/null if [ "$(uname -m)" != "x86_64" ]; then diff --git a/packages/addons/service/nextpvr/source/sleep.d/nextpvr.power b/packages/addons/service/nextpvr/source/sleep.d/nextpvr.power new file mode 100755 index 00000000000..5f87bde6177 --- /dev/null +++ b/packages/addons/service/nextpvr/source/sleep.d/nextpvr.power @@ -0,0 +1,29 @@ +#!/bin/sh + +# SPDX-License-Identifier: GPL-2.0 +# Copyright (C) 2024-present Team LibreELEC (https://libreelec.tv) + +. /etc/profile + +oe_setup_addon service.nextpvr + +SERVICE="service.nextpvr" + +case "$1" in + pre) + if systemctl is-active "$SERVICE" &>/dev/null ; then + systemctl stop "$SERVICE" + for module in $REMOVE_MODULES ; do + rmmod $module + done + fi + ;; + post) + if systemctl is-enabled "$SERVICE" &>/dev/null ; then + for module in $REMOVE_MODULES ; do + modprobe $module + done + systemctl start "$SERVICE" + fi + ;; +esac