You are here

Adding channel number tips

4 posts / 0 new
Last post
st_michael
Offline
st_michael's picture
Joined: 5 years
Last seen: 5 years
Adding channel number tips

Hello, Im' new to the forum and also new to WebGrab+Plus ini programing. 

I wanted to test how I could update an existing INI file to add in the output the Channel Number reported by a website. 
For my test I used the first one I stumble upon: virginmedia.com http://webgrabplus.com/epg-channels#s1B6 (original INI files)

So I modify virginmedia.com.ini file to add a new variable in uncommented @auto_xml_channel_start
index_temp_9.scrub {regex||channel-live\\\"><p>(.*?)<\\/p>||}

to attempt to add it to channel name
index_site_channel.modify {addend| 'index_temp_9'}

so I endup with the following

index_site_id.scrub {regex||"([^\"]*)":\{"trans"||}
index_site_id.modify {addend|##'index_variable_element'}
index_temp_9.scrub {regex||channel-live\\\"><p>(.*?)<\\/p>||}
index_site_channel.scrub {regex||span class=\\"channel-logo.*?title=\\"(.+?)\\">||}
index_site_channel.modify {remove|\}
index_site_channel.modify {addend| 'index_temp_9'}

if it is working for the first channel this is remplacing the name of channel starting the second channel by the channel number.

definitly there is something that I still not understood. Any tips will be welcome :-D

Many thanks.

My WebGrab+Plus version is V1.57

[edit]to add sample output

<site generator-info-name="WebGrab+Plus/w MDB &amp; REX Postprocess -- version  V1.57 -- Jan van Straaten" site="virginmedia.com">
  <channels>
    <channel update="i" site="virginmedia.com" site_id="bbc-one##40979" xmltv_id="BBC ONE 101">BBC ONE 101</channel>
    <channel update="i" site="virginmedia.com" site_id="bbc-two##40979" xmltv_id="102">102</channel>
    <channel update="i" site="virginmedia.com" site_id="itv##40979" xmltv_id="103">103</channel>
    <channel update="i" site="virginmedia.com" site_id="channel-4##40979" xmltv_id="104">104</channel>

...

st_michael
Offline
st_michael's picture
Joined: 5 years
Last seen: 5 years

I see that using 

index_temp_9.scrub {regex||channel-live\\\"><p>(.*?)<\\/p>||}

is not wise since this is not covering the number of channel available (not all are/have "channel-live" option) 

so index_temp_9.scrub {regex(debug)||<p>(.+?)<\\/p>||}  is better

Also I see that there is a sort of double loop and the one from index_temp_9 list is used to fill the entries before the index_site_channel "loop"

I'm could have something like in previous situation... 

<channel update="i" site="virginmedia.com" site_id="bbc-one##40979" xmltv_id="BBC ONE 101">BBC ONE 101</channel>
<channel update="i" site="virginmedia.com" site_id="bbc-two##40979" xmltv_id="102">102</channel>
...
<channel update="i" site="virginmedia.com" site_id="good-food-hd##40979" xmltv_id="BBC TWO 101">BBC TWO 101</channel>
<channel update="i" site="virginmedia.com" site_id="home##40979" xmltv_id="102">102</channel>
<channel update="i" site="virginmedia.com" site_id="home-plus1##40979" xmltv_id="103">103</channel>
<channel update="i" site="virginmedia.com" site_id="home-and-health##40979" xmltv_id="104">104</channel>
<channel update="i" site="virginmedia.com" site_id="discovery-home-health-plus1##40979" xmltv_id="105">105</channel>

 

st_michael
Offline
st_michael's picture
Joined: 5 years
Last seen: 5 years

Ho, Many thanks.  yes

The big key you guive me here and I missed is the way "webgrab stores them like this,its uses | as separator..
index_site_id {bbc-one##40979|bbc-two##40979|ect}
index_site_channel {101 BBC ONE|102 BBC TWO|ect}" 

So when I was doing 
index_site_channel.modify {addend| 'index_temp_9'}
I was adding to each entries of index_site_channel the full list stored in index_temp_9 after each terms... 

ennding to something like

index_site_channel {BBC ONE 101|102|103| .... 804|805|BBC TWO 101|102|103| .... 804|805 ... etc}"    I believe.

I didn't get index_site_channel object was not some sort of magic object that would contains the logic and not really the data (something like functional vs imperative programming) ..   I was confused. 

I now undesrtand the difficulty of putting the channel number after. I was using 'addend' only because I found it more pleasant function to use than 'addstart' blush
but in fact having preset in front or behing the channel name is not important to me, so I guess the first solution is going to be fine.

Thanks for the proposal of the second solution, because that exemple explain me a lot on the WebGrab+Plus ini programing concepts.
I believe the issue with the second solution would be that if the number of "channel name list"'s content and "preset list"'s content are not the same because one of channel would not have for some reason a channel number then presets will not been correctly mapped after some points right? 

Again thanks for this support, will try now to efit some other ini file to see if my understanding is better now cool

st_michael
Offline
st_michael's picture
Joined: 5 years
Last seen: 5 years

Undertsood and I see better now also the link between site_id and site_channel. 

so if some variable like site_preset would exist it would help (simplify) for the situation when we would collect the channel preset number. (I've seen that I'm not the first one interested to collet that data)

Many thanks.

 

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