mirror of
https://github.com/LibreELEC/LibreELEC.tv.git
synced 2025-07-24 11:16:51 +00:00
Merge pull request #8311 from CvH/12.0/tvh_scan_tables
Tvheadend: change scan_table location
This commit is contained in:
commit
f23d90313a
17
packages/addons/addon-depends/dtv-scan-tables/package.mk
Normal file
17
packages/addons/addon-depends/dtv-scan-tables/package.mk
Normal file
@ -0,0 +1,17 @@
|
||||
# SPDX-License-Identifier: GPL-2.0-only
|
||||
# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv)
|
||||
|
||||
PKG_NAME="dtv-scan-tables"
|
||||
PKG_VERSION="2022-04-30-57ed29822750"
|
||||
PKG_SHA256="6a6268aa392459378fa3a13922fc015a3fa63ff822f4b0d64d33d71350a6ec9e"
|
||||
PKG_LICENSE="GPL"
|
||||
PKG_SITE="https://git.linuxtv.org/dtv-scan-tables.git"
|
||||
PKG_URL="https://linuxtv.org/downloads/dtv-scan-tables/dtv-scan-tables-${PKG_VERSION}.tar.bz2"
|
||||
PKG_DEPENDS_TARGET="toolchain"
|
||||
PKG_LONGDESC="Digital TV scan tables."
|
||||
PKG_TOOLCHAIN="manual"
|
||||
PKG_BUILD_FLAGS="-sysroot"
|
||||
|
||||
makeinstall_target() {
|
||||
make -C share/dvb install DATADIR=${INSTALL}/usr/share
|
||||
}
|
@ -1,17 +0,0 @@
|
||||
# SPDX-License-Identifier: GPL-2.0
|
||||
# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv)
|
||||
|
||||
PKG_NAME="tvh-dtv-scan-tables"
|
||||
PKG_VERSION="6bb0a70a0dcb97d5457c1ef4a7ccce634ea419b0"
|
||||
PKG_SHA256="a5f375d28e52ff3f527fecb7968f3ede6bc2e128d1ad78537ab4f0f7844edb45"
|
||||
PKG_LICENSE="GPL"
|
||||
PKG_SITE="https://github.com/tvheadend"
|
||||
PKG_URL="https://github.com/tvheadend/dtv-scan-tables/archive/${PKG_VERSION}.tar.gz"
|
||||
PKG_DEPENDS_TARGET="toolchain"
|
||||
PKG_LONGDESC="Digital TV scan tables, a fork from Tvh to support more recent tables."
|
||||
PKG_TOOLCHAIN="manual"
|
||||
PKG_BUILD_FLAGS="-sysroot"
|
||||
|
||||
makeinstall_target() {
|
||||
make install DATADIR=${INSTALL}/usr/share
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
# SPDX-License-Identifier: GPL-2.0
|
||||
# SPDX-License-Identifier: GPL-2.0-only
|
||||
# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv)
|
||||
|
||||
PKG_NAME="tvheadend42"
|
||||
@ -11,7 +11,7 @@ PKG_LICENSE="GPL"
|
||||
PKG_SITE="http://www.tvheadend.org"
|
||||
PKG_URL="https://github.com/tvheadend/tvheadend/archive/${PKG_VERSION}.tar.gz"
|
||||
PKG_DEPENDS_TARGET="toolchain avahi comskip curl dvb-apps ffmpegx libdvbcsa libhdhomerun \
|
||||
libiconv openssl pngquant:host Python3:host tvh-dtv-scan-tables"
|
||||
libiconv openssl pngquant:host Python3:host dtv-scan-tables"
|
||||
PKG_DEPENDS_CONFIG="ffmpegx"
|
||||
PKG_SECTION="service"
|
||||
PKG_SHORTDESC="Tvheadend: a TV streaming server for Linux"
|
||||
@ -129,6 +129,6 @@ addon() {
|
||||
|
||||
# dvb-scan files
|
||||
mkdir -p ${ADDON_BUILD}/${PKG_ADDON_ID}/dvb-scan
|
||||
cp -r $(get_install_dir tvh-dtv-scan-tables)/usr/share/dvbv5/* \
|
||||
cp -r $(get_install_dir dtv-scan-tables)/usr/share/dvbv5/* \
|
||||
${ADDON_BUILD}/${PKG_ADDON_ID}/dvb-scan
|
||||
}
|
||||
|
@ -1,67 +1,56 @@
|
||||
# SPDX-License-Identifier: GPL-2.0
|
||||
# SPDX-License-Identifier: GPL-2.0-only
|
||||
# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv)
|
||||
|
||||
import urllib.request, urllib.parse, urllib.error, os, zipfile
|
||||
from urllib.error import URLError
|
||||
import xbmc, xbmcvfs, xbmcgui, xbmcaddon
|
||||
import os
|
||||
import shutil
|
||||
import sys
|
||||
import urllib.request
|
||||
import subprocess
|
||||
import re
|
||||
import xbmc, xbmcvfs, xbmcgui, xbmcaddon
|
||||
|
||||
url = 'https://github.com/tvheadend/dtv-scan-tables/archive/tvheadend.zip'
|
||||
temp = xbmcvfs.translatePath('special://temp')
|
||||
temp_folder = os.path.join(temp, 'dtv-scan-tables-tvheadend')
|
||||
dest_folder = os.path.join(xbmcvfs.translatePath(xbmcaddon.Addon().getAddonInfo('path')), 'dvb-scan')
|
||||
archive = os.path.join(temp, 'dtv_scantables.zip')
|
||||
|
||||
ADDON_NAME = xbmcaddon.Addon().getAddonInfo('name')
|
||||
ADDON_NAME = xbmcaddon.Addon().getAddonInfo("name")
|
||||
LS = xbmcaddon.Addon().getLocalizedString
|
||||
SCANTABLES = ['atsc', 'channels-conf', 'dvb-c', 'dvb-s', 'dvb-t', 'isdb-t']
|
||||
|
||||
class DownLoader():
|
||||
|
||||
def __init__(self):
|
||||
self.dp = xbmcgui.DialogProgressBG()
|
||||
|
||||
def download(self, url, dest):
|
||||
try:
|
||||
self.dp.create(ADDON_NAME, LS(30042))
|
||||
urllib.request.urlretrieve(url, dest, reporthook=self._pbhook)
|
||||
self.dp.close()
|
||||
zip = zipfile.ZipFile(archive)
|
||||
if zip.testzip() is not None: raise zipfile.BadZipfile
|
||||
|
||||
if os.path.exists(temp_folder): shutil.rmtree(temp_folder)
|
||||
if os.path.exists(dest_folder): shutil.rmtree(dest_folder)
|
||||
|
||||
self.dp.create(ADDON_NAME, LS(30043))
|
||||
for idx, folder in enumerate(SCANTABLES):
|
||||
self._pbhook(idx, 1, len(SCANTABLES) - 1)
|
||||
for z in zip.filelist:
|
||||
if folder in z.filename: zip.extract(z.filename, temp)
|
||||
|
||||
self.dp.close()
|
||||
for folder in SCANTABLES:
|
||||
shutil.copytree(os.path.join(temp_folder, folder), os.path.join(dest_folder, folder))
|
||||
|
||||
xbmcgui.Dialog().notification(ADDON_NAME, LS(30039), xbmcgui.NOTIFICATION_INFO)
|
||||
except URLError as e:
|
||||
xbmc.log('Could not download file: %s' % e.reason, xbmc.LOGERROR)
|
||||
self.dp.close()
|
||||
xbmcgui.Dialog().notification(ADDON_NAME, LS(30040), xbmcgui.NOTIFICATION_ERROR)
|
||||
except zipfile.BadZipfile:
|
||||
xbmc.log('Could not extract files from zip, bad zipfile', xbmc.LOGERROR)
|
||||
xbmcgui.Dialog().notification(ADDON_NAME, LS(30041), xbmcgui.NOTIFICATION_ERROR)
|
||||
|
||||
def _pbhook(self, numblocks, blocksize, filesize):
|
||||
percent = int((numblocks * blocksize * 100) / filesize)
|
||||
self.dp.update(percent)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
def clear_directory(directory):
|
||||
try:
|
||||
if sys.argv[1] == 'getscantables':
|
||||
dl = DownLoader()
|
||||
dl.download(url, archive)
|
||||
except IndexError:
|
||||
pass
|
||||
for file_name in os.listdir(directory):
|
||||
file_path = os.path.join(directory, file_name)
|
||||
if os.path.isfile(file_path):
|
||||
os.unlink(file_path)
|
||||
elif os.path.isdir(file_path):
|
||||
shutil.rmtree(file_path)
|
||||
except Exception as e:
|
||||
xbmcgui.Dialog().notification(ADDON_NAME, LS(30041), xbmcgui.NOTIFICATION_INFO)
|
||||
exit(1)
|
||||
|
||||
|
||||
def download_and_extract(url, destination, extract_path):
|
||||
try:
|
||||
# Download the file
|
||||
urllib.request.urlretrieve(url, destination)
|
||||
|
||||
# Extract the file to the specified directory, ignoring the root path
|
||||
subprocess.run(["tar", "xf", destination, "--strip-components=3", "-C", extract_path])
|
||||
|
||||
except Exception as e:
|
||||
xbmcgui.Dialog().notification(ADDON_NAME, LS(30040), xbmcgui.NOTIFICATION_INFO)
|
||||
exit(1)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
scan_tables_path = os.path.join(xbmcvfs.translatePath(xbmcaddon.Addon().getAddonInfo("path")), "dvb-scan")
|
||||
download_url = "https://linuxtv.org/downloads/dtv-scan-tables/dtv-scan-tables-LATEST.tar.bz2"
|
||||
downloaded_file_path = "/tmp/dtv-scan-tables-LATEST.tar.bz2"
|
||||
|
||||
# Clear the contents of the dvb_scan directory
|
||||
clear_directory(scan_tables_path)
|
||||
|
||||
# Download and extract the file using subprocess
|
||||
download_and_extract(download_url, downloaded_file_path, scan_tables_path)
|
||||
|
||||
# Clean up the downloaded file
|
||||
os.remove(downloaded_file_path)
|
||||
|
||||
# Notify download complete
|
||||
xbmcgui.Dialog().notification(ADDON_NAME, LS(30039), xbmcgui.NOTIFICATION_INFO)
|
||||
|
@ -172,11 +172,3 @@ msgstr ""
|
||||
msgctxt "#30041"
|
||||
msgid "Could not extract zip files"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "#30042"
|
||||
msgid "Download Scan-Tables"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "#30043"
|
||||
msgid "Extract Scan-Tables"
|
||||
msgstr ""
|
||||
|
@ -50,6 +50,6 @@
|
||||
</category>
|
||||
<category label="30036">
|
||||
<setting label="30037" type="lsep"/>
|
||||
<setting id="DOWNLOAD_SCAN_TABLES" type="action" label="30038" option="close" action="RunScript(service.tvheadend42,getscantables)"/>
|
||||
<setting id="DOWNLOAD_SCAN_TABLES" type="action" label="30038" option="close" action="RunScript(service.tvheadend42,download.py)"/>
|
||||
</category>
|
||||
</settings>
|
||||
|
@ -1,4 +1,4 @@
|
||||
# SPDX-License-Identifier: GPL-2.0
|
||||
# SPDX-License-Identifier: GPL-2.0-only
|
||||
# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv)
|
||||
|
||||
PKG_NAME="tvheadend43"
|
||||
@ -11,7 +11,7 @@ PKG_LICENSE="GPL"
|
||||
PKG_SITE="http://www.tvheadend.org"
|
||||
PKG_URL="https://github.com/tvheadend/tvheadend/archive/${PKG_VERSION}.tar.gz"
|
||||
PKG_DEPENDS_TARGET="toolchain avahi comskip curl dvb-apps ffmpegx libdvbcsa libhdhomerun \
|
||||
libiconv openssl pcre2 pngquant:host Python3:host tvh-dtv-scan-tables"
|
||||
libiconv openssl pcre2 pngquant:host Python3:host dtv-scan-tables"
|
||||
PKG_DEPENDS_CONFIG="ffmpegx"
|
||||
PKG_SECTION="service"
|
||||
PKG_SHORTDESC="Tvheadend: a TV streaming server for Linux"
|
||||
@ -129,6 +129,6 @@ addon() {
|
||||
|
||||
# dvb-scan files
|
||||
mkdir -p ${ADDON_BUILD}/${PKG_ADDON_ID}/dvb-scan
|
||||
cp -r $(get_install_dir tvh-dtv-scan-tables)/usr/share/dvbv5/* \
|
||||
cp -r $(get_install_dir dtv-scan-tables)/usr/share/dvbv5/* \
|
||||
${ADDON_BUILD}/${PKG_ADDON_ID}/dvb-scan
|
||||
}
|
||||
|
@ -1,67 +1,56 @@
|
||||
# SPDX-License-Identifier: GPL-2.0
|
||||
# SPDX-License-Identifier: GPL-2.0-only
|
||||
# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv)
|
||||
|
||||
import urllib.request, urllib.parse, urllib.error, os, zipfile
|
||||
from urllib.error import URLError
|
||||
import xbmc, xbmcvfs, xbmcgui, xbmcaddon
|
||||
import os
|
||||
import shutil
|
||||
import sys
|
||||
import urllib.request
|
||||
import subprocess
|
||||
import re
|
||||
import xbmc, xbmcvfs, xbmcgui, xbmcaddon
|
||||
|
||||
url = 'https://github.com/tvheadend/dtv-scan-tables/archive/tvheadend.zip'
|
||||
temp = xbmcvfs.translatePath('special://temp')
|
||||
temp_folder = os.path.join(temp, 'dtv-scan-tables-tvheadend')
|
||||
dest_folder = os.path.join(xbmcvfs.translatePath(xbmcaddon.Addon().getAddonInfo('path')), 'dvb-scan')
|
||||
archive = os.path.join(temp, 'dtv_scantables.zip')
|
||||
|
||||
ADDON_NAME = xbmcaddon.Addon().getAddonInfo('name')
|
||||
ADDON_NAME = xbmcaddon.Addon().getAddonInfo("name")
|
||||
LS = xbmcaddon.Addon().getLocalizedString
|
||||
SCANTABLES = ['atsc', 'channels-conf', 'dvb-c', 'dvb-s', 'dvb-t', 'isdb-t']
|
||||
|
||||
class DownLoader():
|
||||
|
||||
def __init__(self):
|
||||
self.dp = xbmcgui.DialogProgressBG()
|
||||
|
||||
def download(self, url, dest):
|
||||
try:
|
||||
self.dp.create(ADDON_NAME, LS(30042))
|
||||
urllib.request.urlretrieve(url, dest, reporthook=self._pbhook)
|
||||
self.dp.close()
|
||||
zip = zipfile.ZipFile(archive)
|
||||
if zip.testzip() is not None: raise zipfile.BadZipfile
|
||||
|
||||
if os.path.exists(temp_folder): shutil.rmtree(temp_folder)
|
||||
if os.path.exists(dest_folder): shutil.rmtree(dest_folder)
|
||||
|
||||
self.dp.create(ADDON_NAME, LS(30043))
|
||||
for idx, folder in enumerate(SCANTABLES):
|
||||
self._pbhook(idx, 1, len(SCANTABLES) - 1)
|
||||
for z in zip.filelist:
|
||||
if folder in z.filename: zip.extract(z.filename, temp)
|
||||
|
||||
self.dp.close()
|
||||
for folder in SCANTABLES:
|
||||
shutil.copytree(os.path.join(temp_folder, folder), os.path.join(dest_folder, folder))
|
||||
|
||||
xbmcgui.Dialog().notification(ADDON_NAME, LS(30039), xbmcgui.NOTIFICATION_INFO)
|
||||
except URLError as e:
|
||||
xbmc.log('Could not download file: %s' % e.reason, xbmc.LOGERROR)
|
||||
self.dp.close()
|
||||
xbmcgui.Dialog().notification(ADDON_NAME, LS(30040), xbmcgui.NOTIFICATION_ERROR)
|
||||
except zipfile.BadZipfile:
|
||||
xbmc.log('Could not extract files from zip, bad zipfile', xbmc.LOGERROR)
|
||||
xbmcgui.Dialog().notification(ADDON_NAME, LS(30041), xbmcgui.NOTIFICATION_ERROR)
|
||||
|
||||
def _pbhook(self, numblocks, blocksize, filesize):
|
||||
percent = int((numblocks * blocksize * 100) / filesize)
|
||||
self.dp.update(percent)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
def clear_directory(directory):
|
||||
try:
|
||||
if sys.argv[1] == 'getscantables':
|
||||
dl = DownLoader()
|
||||
dl.download(url, archive)
|
||||
except IndexError:
|
||||
pass
|
||||
for file_name in os.listdir(directory):
|
||||
file_path = os.path.join(directory, file_name)
|
||||
if os.path.isfile(file_path):
|
||||
os.unlink(file_path)
|
||||
elif os.path.isdir(file_path):
|
||||
shutil.rmtree(file_path)
|
||||
except Exception as e:
|
||||
xbmcgui.Dialog().notification(ADDON_NAME, LS(30041), xbmcgui.NOTIFICATION_INFO)
|
||||
exit(1)
|
||||
|
||||
|
||||
def download_and_extract(url, destination, extract_path):
|
||||
try:
|
||||
# Download the file
|
||||
urllib.request.urlretrieve(url, destination)
|
||||
|
||||
# Extract the file to the specified directory, ignoring the root path
|
||||
subprocess.run(["tar", "xf", destination, "--strip-components=3", "-C", extract_path])
|
||||
|
||||
except Exception as e:
|
||||
xbmcgui.Dialog().notification(ADDON_NAME, LS(30040), xbmcgui.NOTIFICATION_INFO)
|
||||
exit(1)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
scan_tables_path = os.path.join(xbmcvfs.translatePath(xbmcaddon.Addon().getAddonInfo("path")), "dvb-scan")
|
||||
download_url = "https://linuxtv.org/downloads/dtv-scan-tables/dtv-scan-tables-LATEST.tar.bz2"
|
||||
downloaded_file_path = "/tmp/dtv-scan-tables-LATEST.tar.bz2"
|
||||
|
||||
# Clear the contents of the dvb_scan directory
|
||||
clear_directory(scan_tables_path)
|
||||
|
||||
# Download and extract the file using subprocess
|
||||
download_and_extract(download_url, downloaded_file_path, scan_tables_path)
|
||||
|
||||
# Clean up the downloaded file
|
||||
os.remove(downloaded_file_path)
|
||||
|
||||
# Notify download complete
|
||||
xbmcgui.Dialog().notification(ADDON_NAME, LS(30039), xbmcgui.NOTIFICATION_INFO)
|
||||
|
@ -172,11 +172,3 @@ msgstr ""
|
||||
msgctxt "#30041"
|
||||
msgid "Could not extract zip files"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "#30042"
|
||||
msgid "Download Scan-Tables"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "#30043"
|
||||
msgid "Extract Scan-Tables"
|
||||
msgstr ""
|
||||
|
@ -50,6 +50,6 @@
|
||||
</category>
|
||||
<category label="30036">
|
||||
<setting label="30037" type="lsep"/>
|
||||
<setting id="DOWNLOAD_SCAN_TABLES" type="action" label="30038" option="close" action="RunScript(service.tvheadend43,getscantables)"/>
|
||||
<setting id="DOWNLOAD_SCAN_TABLES" type="action" label="30038" option="close" action="RunScript(service.tvheadend43,download.py)"/>
|
||||
</category>
|
||||
</settings>
|
||||
|
Loading…
x
Reference in New Issue
Block a user