You are here

xml output for every channel

5 posts / 0 new
Last post
Nexus_beacon
Offline
Joined: 8 years
Last seen: 3 years
xml output for every channel

Hi everyone,

is it possible for WebGrab to create output xml file for each channel that grabs from sites?

Until now, it exports everything in one file configured like this for me:

<filename>C:\Users\NOC2\Desktop\xml\xmltv.xml</filename>

But I would like to have them all separated by channel names.

 

Any suggestion?

 

Thanks,

 

1NSdbZVbpZDX
Offline
Joined: 10 years
Last seen: 7 years

xmlstarlet does the job

http://xmlstar.sourceforge.net/

Nexus_beacon
Offline
Joined: 8 years
Last seen: 3 years
Blackbear199 wrote:

another way you could do it is create a folder with webgrab.exe and webgrab++.config.xml for each channel.

add 1 channel to each webgrab++.config.xml

use a script to execute each webgrab.exe in each folder.

this would be by far the easiest and quieckest way.

Thanks for advice. I need these files separated because I'm currently testing Teleste Broadcast manager for Operator purposes. It has xmltv plugin. I can put joined xmltv, but it's not easy to say afterwards if one of the channels has no events. Broadcast mgm pooling is very strange. In this manner, I can see for each channel date and time of creation, and pooling troubleshooting is much easier.

 

Thanks

1NSdbZVbpZDX
Offline
Joined: 10 years
Last seen: 7 years

a litle script sample for what xmlstarlet can do (run in terminal):

#!/bin/bash

#xml_channel_separator.sh
#script by 1NSdbZVbpZDX
#created on 10/04/2016
#a linux-bash solution for creating xml files from each channel grabbed in an xmltv file
#install xmlstarlet from http://xmlstar.sourceforge.net/

xpath="/tv/programme"
source=TVGuide.xml
count=1
sep_chnn=Isolated_Channels

cd $HOME/.xmltv
mkdir -p "$sep_chnn"
dispname=$(xml sel -t -m  "/tv/channel" -m @id -v . -n "$source" | xml unesc)

function cleanup () {
sed -i '1i<tv>' "$prgsrtd"
sed -i '1i<!DOCTYPE tv SYSTEM "xmltv.dtd">' "$prgsrtd"
sed -i '1i<?xml version="1.0" encoding="UTF-8"?>' "$prgsrtd"
echo "</tv>" >> "$prgsrtd"
}

while read -r line
do
    cont="$(printf "%03d" $count)"
    echo "Processing: "$cont"_$line"
    prgsrtd=$cont"_"$line.xml
    xml sel -t -m "//channel[@id='$line']" -c . -n "$source" > "$prgsrtd"
    xml sel -t -m "$xpath[@channel='$line']" -c . -n "$source" >> "$prgsrtd"
    cleanup
    mv -f "$prgsrtd" $HOME/.xmltv/"$sep_chnn"/"$prgsrtd"
    let count=$count+1
done <<<"$dispname"

Nexus_beacon
Offline
Joined: 8 years
Last seen: 3 years
1NSdbZVbpZDX wrote:

a litle script sample for what xmlstarlet can do (run in terminal):

#!/bin/bash

#xml_channel_separator.sh
#script by 1NSdbZVbpZDX
#created on 10/04/2016
#a linux-bash solution for creating xml files from each channel grabbed in an xmltv file
#install xmlstarlet from http://xmlstar.sourceforge.net/

xpath="/tv/programme"
source=TVGuide.xml
count=1
sep_chnn=Isolated_Channels

cd $HOME/.xmltv
mkdir -p "$sep_chnn"
dispname=$(xml sel -t -m  "/tv/channel" -m @id -v . -n "$source" | xml unesc)

function cleanup () {
sed -i '1i<tv>' "$prgsrtd"
sed -i '1i<!DOCTYPE tv SYSTEM "xmltv.dtd">' "$prgsrtd"
sed -i '1i<?xml version="1.0" encoding="UTF-8"?>' "$prgsrtd"
echo "</tv>" >> "$prgsrtd"
}

while read -r line
do
    cont="$(printf "%03d" $count)"
    echo "Processing: "$cont"_$line"
    prgsrtd=$cont"_"$line.xml
    xml sel -t -m "//channel[@id='$line']" -c . -n "$source" > "$prgsrtd"
    xml sel -t -m "$xpath[@channel='$line']" -c . -n "$source" >> "$prgsrtd"
    cleanup
    mv -f "$prgsrtd" $HOME/.xmltv/"$sep_chnn"/"$prgsrtd"
    let count=$count+1
done <<<"$dispname"

Thank you and sorry for late reply. This can do a thing well!

 

 

Log in or register to post comments

Brought to you by Jan van Straaten

Program Development - Jan van Straaten ------- Web design - Francis De Paemeleere
Supported by: servercare.nl