Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhance WG++ Integration #295

Merged
merged 2 commits into from
Nov 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ This add-on has the following additional software preinstalled:
- [Comskip][comskip]: A tool to mark commercials in recordings (autoskipped in Kodi)
- [Comchap & Comcut][comchap]: Utilities to add chapters or cut commercials based on detected commercials from Comskip
- [StreamLink][streamlink]
- [WebGrab++][wg++]: A XMLTV EPG grabber for many sites. Useful in case OTA EPG is not sufficient.

[:books: Read the full add-on documentation][docs]

Expand Down Expand Up @@ -100,6 +101,7 @@ SOFTWARE.
[comskip]: https://github.com/erikkaashoek/Comskip
[comchap]: https://github.com/BrettSheleski/comchap
[streamlink]: https://streamlink.github.io/
[wg++]: http://www.webgrabplus.com/
[forum]: https://community.home-assistant.io/
[gautham]: https://github.com/GauthamVarmaK
[dfigus]: https://github.com/dfigus
Expand Down
Binary file added images/tvh_wg++.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions tvheadend/.README.j2
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,13 @@ This add-on has the following additional software preinstalled:
- [Comskip][comskip]: A tool to mark commercials in recordings (autoskipped in Kodi)
- [Comchap & Comcut][comchap]: Utilities to add chapters or cut commercials based on detected commercials from Comskip
- [StreamLink][streamlink]
- [WebGrab++][wg++]: A XMLTV EPG grabber for many sites. Useful in case OTA EPG is not sufficient.

[picons]: https://github.com/picons/picons
[comskip]: https://github.com/erikkaashoek/Comskip
[comchap]: https://github.com/BrettSheleski/comchap
[streamlink]: https://streamlink.github.io/
[wg++]: http://www.webgrabplus.com/
[forum-shield]: https://img.shields.io/badge/community-forum-brightgreen.svg
[maintenance-shield]: https://img.shields.io/maintenance/yes/2024.svg
[project-stage-shield]: https://img.shields.io/badge/project%20stage-production%20ready-brightgreen.svg
Expand Down
31 changes: 31 additions & 0 deletions tvheadend/DOCS.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ This add-on has the following additional software preinstalled:
- [Comskip][comskip]: A tool to mark commercials in recordings (autoskipped in Kodi)
- [Comchap & Comcut][comchap]: Utilities to add chapters or cut commercials based on detected commercials from Comskip
- [StreamLink][streamlink]
- [WebGrab++][wg++]: A XMLTV EPG grabber for many sites. Useful in case OTA EPG is not sufficient.

In order to use them, additional TVHeadend configuration need to be done, which are
outlined in here.
Expand Down Expand Up @@ -83,6 +84,26 @@ Content that should be used for the `comskip.ini`, which will be stored at `/con
The `comskip.ini` is required to tell Comskip how to detect commercials in the recording. See also the [Comskip section](Comskip).
It is recommended to edit it in YAML and use the [YAML literal style][yaml-literal] to preserve newline.

### Option: WebGrab+Plus Channels `wg_channels`

A list of channels that shall be used by WebGrab+Plus. Example:

```
wg_channels:
- country: "Germany"
site: "tvtoday.de"
channel: "ard"
- country: "Germany"
site: "tvtoday.de"
channel: "zdf"
```

This will add two channels from the `siteini.pack` folder to the WebGrab+Plus XML config file. The country is translated to the folder name `Germany`, the site is used to find the `tvtoday.de.channels.xml` file and the `channel` is used to find the `<channel site_id="ard">` and `<channel site_id="zdf">` entries. All names are _case-sensitive_. The matching channels are copied over to the default WebGrab+Plus configuration XML (with the dummy channel removed).

### Option: WebGrab+Plus Configuration XML `wg_config`

As a more advanced user you might want to fully customize the WebGrab+Plus configuration file. This allows you to enter your WebGrab+Plus license or use decrypt keys. Do not use this configuration together with the simple `wg_channel` configuration.

## Additional Configuration

### Picons
Expand Down Expand Up @@ -124,6 +145,15 @@ them entirely (Comcut) from the recording. The scripts are located in `/usr/bin/

Further information how to use them can be found [here][comchap].

### WebGrab+Plus

This addon comes with preinstalled WebGrab+Plus, a XMLTV EPG grabber. The TVHeadend integration is already done and the grabber runs every night at 0:00.
In order to enable the WebGrab+Plus grabber, you need to enable it in TVHeadend Configuration -> Channel / EPG -> EPG Grabber Modules:

![tvh_wg++][https://github.com/dfigus/addon-tvheadend/raw/main/images/tvh_wg++.png]

Further information can be found [here][wg++]

### Additional Details

- Config files are stored in `/config/tvheadend/` and will be backed up with the addon-on
Expand Down Expand Up @@ -191,6 +221,7 @@ SOFTWARE.
[comchap]: https://github.com/BrettSheleski/comchap
[comskip-forum]: https://www.kaashoek.com/comskip/
[streamlink]: https://streamlink.github.io/
[wg++]: http://www.webgrabplus.com/
[tvheadend]: https://tvheadend.org/
[alpine-packages]: https://pkgs.alpinelinux.org/packages
[dockerfile]: https://github.com/dfigus/addon-tvheadend/blob/main/tvheadend/Dockerfile#L172-L206
Expand Down
12 changes: 12 additions & 0 deletions tvheadend/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@
####### runtime ###########

# hadolint ignore=DL3006
FROM ${BUILD_FROM}

Check warning on line 160 in tvheadend/Dockerfile

View workflow job for this annotation

GitHub Actions / workflows / Build aarch64

Default value for global ARG results in an empty or invalid base image name

InvalidDefaultArgInFrom: Default value for ARG ${BUILD_FROM} results in empty or invalid base image name More info: https://docs.docker.com/go/dockerfile/rule/invalid-default-arg-in-from/

Check warning on line 160 in tvheadend/Dockerfile

View workflow job for this annotation

GitHub Actions / workflows / Build amd64

Default value for global ARG results in an empty or invalid base image name

InvalidDefaultArgInFrom: Default value for ARG ${BUILD_FROM} results in empty or invalid base image name More info: https://docs.docker.com/go/dockerfile/rule/invalid-default-arg-in-from/

Check warning on line 160 in tvheadend/Dockerfile

View workflow job for this annotation

GitHub Actions / workflows / Build armv7

Default value for global ARG results in an empty or invalid base image name

InvalidDefaultArgInFrom: Default value for ARG ${BUILD_FROM} results in empty or invalid base image name More info: https://docs.docker.com/go/dockerfile/rule/invalid-default-arg-in-from/

Check warning on line 160 in tvheadend/Dockerfile

View workflow job for this annotation

GitHub Actions / workflows / Build aarch64

Default value for global ARG results in an empty or invalid base image name

InvalidDefaultArgInFrom: Default value for ARG ${BUILD_FROM} results in empty or invalid base image name More info: https://docs.docker.com/go/dockerfile/rule/invalid-default-arg-in-from/

Check warning on line 160 in tvheadend/Dockerfile

View workflow job for this annotation

GitHub Actions / workflows / Build amd64

Default value for global ARG results in an empty or invalid base image name

InvalidDefaultArgInFrom: Default value for ARG ${BUILD_FROM} results in empty or invalid base image name More info: https://docs.docker.com/go/dockerfile/rule/invalid-default-arg-in-from/

Check warning on line 160 in tvheadend/Dockerfile

View workflow job for this annotation

GitHub Actions / workflows / Build armv7

Default value for global ARG results in an empty or invalid base image name

InvalidDefaultArgInFrom: Default value for ARG ${BUILD_FROM} results in empty or invalid base image name More info: https://docs.docker.com/go/dockerfile/rule/invalid-default-arg-in-from/

ARG PICONS_RELEASE="2024-11-14--16-55-04"

Expand Down Expand Up @@ -251,6 +251,18 @@
&& sed -i 's|~/.wg++/guide.xml|/config/tvheadend/wg++/guide.xml|g' /usr/bin/tv_grab_wg++ \
&& chmod +x /usr/bin/tv_grab_wg++

# install WebGrab+
RUN \
mkdir -p /wg/tmp \
&& curl -o /wg/tmp/wg.tar.gz http://www.webgrabplus.com/sites/default/files/download/SW/V5.3.0/WebGrabPlus_V5.3_install.tar.gz \
&& tar -zxvf /wg/tmp/wg.tar.gz -C /wg \
&& /wg/.wg++/install.sh \
&& sed -i "s|<filename>guide.xml</filename>|<filename>/config/tvheadend/wg++/guide.xml</filename>|g" /wg/.wg++/WebGrab++.config.xml \
&& rm -rf /wg/tmp \
&& curl -o /usr/bin/tv_grab_wg++ http://www.webgrabplus.com/sites/default/files/tv_grab_wg.txt \
&& sed -i 's|~/.wg++/guide.xml|/config/tvheadend/wg++/guide.xml|g' /usr/bin/tv_grab_wg++ \
&& chmod +x /usr/bin/tv_grab_wg++

# Copy root filesystem
COPY rootfs /

Expand Down
1 change: 1 addition & 0 deletions tvheadend/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -82,3 +82,4 @@ schema:
- country: str?
site: str?
channel: str?
wg_config: str?
19 changes: 18 additions & 1 deletion tvheadend/rootfs/etc/s6-overlay/s6-rc.d/init-wg++/run
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ declare country
declare site
declare channel
declare filename
declare wg_config

bashio::log.info "Init WG++..."
# create WG++ guide folder in addon config folder
Expand Down Expand Up @@ -37,15 +38,31 @@ function verifySiteFile() {
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::log.fatal
bashio::exit.nok
fi
echo "$fullpath"
}

if bashio::config.has_value 'wg_config' && bashio::config.has_value 'wg_channels'; then
bashio::log.fatal
bashio::log.fatal "Both WG++ channels and a WG++ config xml are set. Only one can be set"
bashio::log.fatal
bashio::exit.nok
fi

# remove dummy channel from initial config xml
xmlstarlet ed -L -d "/settings/channel" /wg/.wg++/WebGrab++.config.xml

if bashio::config.has_value 'wg_config'; then
bashio::log.info "Using supplied WG++ config..."
# Overwrite config file from addon config
wg_config=$(bashio::config 'wg_config')
echo "${wg_config}" > /wg/.wg++/WebGrab++.config.xml
xmlstarlet val -q /wg/.wg++/WebGrab++.config.xml || bashio::exit.nok "Invalid WG++ config supplied"
xmlstarlet fo /wg/.wg++/WebGrab++.config.xml > /wg/.wg++/tmp.xml && mv /wg/.wg++/tmp.xml /wg/.wg++/WebGrab++.config.xml
fi

# Add Channels into WG++ ini
if bashio::config.has_value 'wg_channels'; then
bashio::log.info "Updating WG++ Channels..."
Expand Down
9 changes: 9 additions & 0 deletions tvheadend/translations/en.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,12 @@ configuration:
name: Comskip ini
description: >-
Content that shall be stored as comskip.ini.
wg_config:
name: WebGrab+Plus Configuration XML
description: >-
A full WebGrab+Plus configuration XML that shall be used unaltered. Do not use this option if you want to use
the WebGrab+Plus Channels option.
wg_channels:
name: WebGrab+Plus Channels
description: >-
A list of channels that shall be copied from the siteini.pack into the WebGrab+Plus configuration