-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove support of armhf and i386 architecture as dotnet8 is not available there which is required for WG++
- Loading branch information
Showing
15 changed files
with
125 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
0 0 * * * /wg/.wg++/run.net.sh |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#!/usr/bin/with-contenv bashio | ||
# shellcheck shell=bash | ||
# ============================================================================== | ||
# Home Assistant Community Add-on: TVHeadend | ||
# Start cron | ||
# ============================================================================== | ||
|
||
bashio::log.info "Starting cron..." | ||
|
||
exec crond -f -l 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
longrun |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/etc/s6-overlay/s6-rc.d/cron/run |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
#!/usr/bin/with-contenv bashio | ||
# shellcheck shell=bash | ||
# ============================================================================== | ||
# Home Assistant Community Add-on: TVHeadend | ||
# Updates WG++ channels in WG++ ini | ||
# ============================================================================== | ||
declare wg_channel | ||
declare country | ||
declare site | ||
declare channel | ||
declare filename | ||
|
||
bashio::log.info "Init WG++..." | ||
# create WG++ guide folder in addon config folder | ||
if ! bashio::fs.directory_exists "/config/tvheadend/wg++"; then | ||
bashio::log.info "Creating WG++ folder in config folder..." | ||
mkdir -p /config/tvheadend/wg++ | ||
fi | ||
|
||
expectedParentDir="/wg/.wg++/siteini.pack" | ||
|
||
function verifySiteFile() { | ||
local fullpath | ||
|
||
fullpath="$expectedParentDir"/"$1"/"$2".channels.xml | ||
if ! bashio::fs.file_exists "$fullpath"; then | ||
bashio::log.fatal | ||
bashio::log.fatal "WG Channel Configuration is incorrect for country $1 site $2" | ||
bashio::log.fatal "File $1/$2.channels.xml does not exist. Only use contries and sites" | ||
bashio::log.fatal "(case-sensitive) from the WG++ siteini.pack folder" | ||
bashio::exit.nok | ||
fi | ||
|
||
rpath=$(realpath "$fullpath") | ||
if [[ $rpath != ${expectedParentDir}* ]]; then | ||
bashio::log.fatal | ||
bashio::log.fatal "WG Channel Configuration is incorrect for country $1 site $2" | ||
bashio::log.fatal "File $1/$2.channels.xml is traversing paths. Only use contries and sites" | ||
bashio::log.fatal "(case-sensitive) from the WG++ siteini.pack folder" | ||
bashio::exit.nok | ||
bashio::exit.nok | ||
fi | ||
echo "$fullpath" | ||
} | ||
|
||
# remove dummy channel from initial config xml | ||
xmlstarlet ed -L -d "/settings/channel" /wg/.wg++/WebGrab++.config.xml | ||
|
||
# Add Channels into WG++ ini | ||
if bashio::config.has_value 'wg_channels'; then | ||
bashio::log.info "Updating WG++ Channels..." | ||
for wg_channel in $(bashio::config 'wg_channels'); do | ||
country=$(bashio::jq "$wg_channel" '.country') | ||
site=$(bashio::jq "$wg_channel" '.site') | ||
channel=$(bashio::jq "$wg_channel" '.channel') | ||
bashio::log.info "Adding channel country: ${country} site: ${site} channel: ${channel} to wg++ config" | ||
|
||
filename=$(verifySiteFile "$country" "$site") | ||
if [[ ! $(xmlstarlet sel -t -v "//channel[@site_id='$channel']" "$filename") ]]; then | ||
bashio::log.fatal "Channel $channel does not exist in channel file of $site" | ||
bashio::exit.nok | ||
fi | ||
|
||
# run XSLT to copy over channel | ||
xmlstarlet tr /wg/tr.xsl -s filename="$filename" -s channel="$channel" /wg/.wg++/WebGrab++.config.xml | xmlstarlet fo >/wg/.wg++/tmp.xml && | ||
mv /wg/.wg++/tmp.xml /wg/.wg++/WebGrab++.config.xml | ||
|
||
done | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
oneshot |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/etc/s6-overlay/s6-rc.d/init-wg++/run |
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> | ||
<xsl:param name="filename"/> | ||
<xsl:param name="channel"/> | ||
<!-- Identity template to copy everything by default --> | ||
<xsl:template match="@*|node()"> | ||
<xsl:copy> | ||
<xsl:apply-templates select="@*|node()"/> | ||
</xsl:copy> | ||
</xsl:template> | ||
|
||
<!-- Template to match the section where items will be added --> | ||
<xsl:template match="/settings"> | ||
<xsl:copy> | ||
<xsl:apply-templates select="@*|node()"/> | ||
<!-- Add items from the source XML here --> | ||
<xsl:for-each select="document($filename)//channel[@site_id=$channel]"> | ||
<xsl:copy-of select="."/> | ||
</xsl:for-each> | ||
</xsl:copy> | ||
</xsl:template> | ||
</xsl:stylesheet> |