iptv-xml-cleaner/xml_cleaner.sh
Nicolas 6af77289e5 Modify Dockerfile and xml-cleaner.sh
Updated dockerfile to use cron in order to set up automated script execution once per day, every morning.
2025-06-11 14:41:52 -04:00

24 lines
1.0 KiB
Bash

#!/bin/bash
wget -q --no-check-certificate https://download2.iptvboss.pro/2da279ce-ce9a-4491-8b92-f72c60e92092/xmlonly/CANADA.xml > /data/CANADA.xml
wget -q --no-check-certificate https://download2.iptvboss.pro/R5SQ-4GRG-KK00-0XQT-JZ67-7TSA-D5O7-UC1U/xmlonly/USA.xml > /data/USA.xml
ids="/data/xml_tv_ids.txt"
raw_can_xml="/data/CANADA.xml"
raw_us_xml="/data/USA.xml"
output="/data/clean_CANADA_US.xml"
# On crée les filtres pour trouver les channels/programmes qui nous intéressent
id_filter=$(awk '{printf "@id='\''%s'\'' or ", $0}' "$ids" | sed 's/ or $//')
prog_filter=$(awk '{printf "@channel='\''%s'\'' or ", $0}' "$ids" | sed 's/ or $//')
# On select avec xmlstarlet les channels et progs qu'on veut et on met ca dans un clean XML
{
echo '<tv source-info-name="IPTVBoss">'
xmlstarlet sel -t -c "//channel[$id_filter]" "$raw_can_xml"
xmlstarlet sel -t -c "//channel[$id_filter]" "$raw_us_xml"
xmlstarlet sel -t -c "//programme[$prog_filter]" "$raw_can_xml"
xmlstarlet sel -t -c "//programme[$prog_filter]" "$raw_us_xml"
echo '</tv>'
} > "$output"