Update xml_cleaner.sh

update file to match current docker container script
This commit is contained in:
Nicolas 2025-10-21 15:33:14 -04:00
parent 07b238f300
commit c7c1a90800

View File

@ -1,23 +1,29 @@
#!/bin/bash
wget -q --no-check-certificate https://download2.iptvboss.pro/ZNLS-2213-GCPB-A8O7-QDK1-GIXS-4MOI-1NFG/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
wget --no-check-certificate -O CANADA.xml -P /data/temp https://download2.iptvboss.pro/ZNLS-2213-GCPB-A8O7-QDK1-GIXS-4MOI-1NFG/xmlonly/CANADA.xml
wget --no-check-certificate -O USA.xml -P /data/temp https://download2.iptvboss.pro/R5SQ-4GRG-KK00-0XQT-JZ67-7TSA-D5O7-UC1U/xmlonly/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"
raw_can_xml="CANADA.xml"
raw_us_xml="USA.xml"
output="/data/clean_CANADA_USA.xml"
# On crée les filtres pour trouver les channels/programmes qui nous intéressent
rm /data/clean_CANADA_USA.xml
# On cree les filtres pour trouver les channels/programmes qui nous interessent
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 '<?xml version="1.0" encoding="UTF-8"?>'
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"
xmlstarlet sel -t -n -c "//channel[$id_filter]" "$raw_can_xml"
xmlstarlet sel -t -n -c "//channel[$id_filter]" "$raw_us_xml"
xmlstarlet sel -t -n -c "//programme[$prog_filter]" "$raw_can_xml"
xmlstarlet sel -t -n -c "//programme[$prog_filter]" "$raw_us_xml"
echo '</tv>'
} > "$output"
# On format le xml pour un bon indent
xmlstarlet fo -t /data/clean_CANADA_USA.xml > /data/cleanest_CANADA_USA.xml