**------------------------------------------------------------------------------------------------
* @header_start
* WebGrab+Plus ini for grabbing EPG data from TvGuide websites
* @Site: potv.bg
* @MinSWversion:
* @Revision 1 - [17/11/2013] Francis De Paemeleere
* - adjust to site changes
* @Revision 0 - [14/03/2013] Francis De Paemeleere
* - creation
* @Remarks:
* @header_end
**------------------------------------------------------------------------------------------------
site {url=potv.bg|timezone=UTC+02:00|maxdays=7.1|cultureinfo=bg-BG|charset=utf-8|titlematchfactor=90}
site {episodesystem=onscreen}
url_index{url()|http://www.potv.bg/tv-programa/programs/|channel|.xml}
urldate.format {daycounter|1}
index_showsplit.scrub {multi()||||}
index_showsplit.modify {cleanup(scope=splitindex removeduplicates=equal)}
index_start.scrub {single||||}
index_stop.scrub {single||||}
index_temp_1.scrub {single||||}
index_temp_6.scrub {single||||}
index_temp_2.scrub {single||||}
index_urlchannellogo.modify {addstart|http://l.potv.bg/b/'config_site_id'.png}
*
index_start.modify {calculate(format=utcdate,HH:mm)}
index_stop.modify {calculate(format=utcdate,HH:mm)}
scope.range {(indexshowdetails)|end}
index_temp_1.modify {cleanup(tags="<"">")}
index_temp_6.modify {cleanup(tags="<"">")}
* for debugging
index_description.modify {addstart|'index_temp_1'}
* spit index_temp_1 into the correct parts
index_temp_1.modify {replace| - |\|:}
index_title.modify {substring(type=element)|'index_temp_1' 0 1} * the first part is always the title
index_temp_1.modify {remove(type=element)|'index_temp_1' 0 1} * remove it form index_temp_1
index_temp_1.modify {replace|\| - |:}
index_temp_1.modify {replace()|:|\| - }
* step through the split and find the actor part
index_temp_2.modify {calculate(type=element format=F0)|'index_temp_1' #}
loop {('index_temp_2' > "0" max=200)|end}
index_temp_2.modify {calculate(format=F0)|1 -}
index_temp_3.modify {clear}
index_temp_3.modify {substring(type=element)|'index_temp_1' 'index_temp_2' 1}
index_temp_4.modify {addstart('index_temp_3'~"Актьори")|'index_temp_2'} * get the actors
index_temp_5.modify {addstart('index_temp_3'~"Режисьор")|'index_temp_2'} * get the producer
end_loop
* now if "actors:" was seen, index_temp_4 contains the index of that.
index_temp_4.modify {calculate('index_temp_4' not "" format=F0)|'index_temp_4' 1 +}
index_temp_5.modify {calculate('index_temp_5' not "" format=F0)|'index_temp_5' 1 +}
index_actor.modify {substring('index_temp_4' not "" type=element)|'index_temp_1' 'index_temp_4' 1}
index_producer.modify {substring('index_temp_5' not "" type=element)|'index_temp_1' 'index_temp_5' 1}
index_actor.modify {replace|/|\|} * remove any appended parts
index_actor.modify {substring(type=element)|0 1}
index_actor.modify {replace|,|\|} * make multi
index_producer.modify {replace|/|\|} * remove any appended parts
index_producer.modify {substring(type=element)|0 1}
index_producer.modify {replace|,|\|} * make multi
index_producer.modify {remove|Актьори} * remove actor if it was in here
index_temp_1.modify {replace()|\||:}
index_temp_1.modify {remove(separator=",")|Актьори:'index_actor'}
index_temp_1.modify {remove(separator=",")|Режисьор:'index_producer'}
* find the episode info (eg. с. 3, еп. 17, 18)
index_temp_2.modify {clear}
index_temp_2.modify {addstart('index_temp_1'~", с.")|'index_temp_1'}
index_temp_2.modify {replace()|, с.|\|}
index_temp_3.modify {substring(type=element)|'index_temp_2' -1 1}
index_temp_1.modify {remove()|, с.'index_temp_3'}
index_episode.modify {addstart('index_temp_3' not "")|с. 'index_temp_3'}
index_temp_2.modify {clear}
index_temp_2.modify {addstart('index_temp_1'~", еп.")|'index_temp_1'}
index_temp_2.modify {replace()|, еп.|\|}
index_temp_3.modify {substring(type=element)|'index_temp_2' -1 1}
index_temp_1.modify {remove()|, еп.'index_temp_3'}
index_episode.modify {addstart('index_temp_3' not "")|еп. 'index_temp_3'}
* translate types (found in http://www.potv.bg/Settings.xml?ck=1363551947151)
index_category.modify {addstart('index_temp_6' = "N")|Новини}
index_category.modify {addstart('index_temp_6' = "P")|Публицистика}
index_category.modify {addstart('index_temp_6' = "I")|Игри}
index_category.modify {addstart('index_temp_6' = "M")|Музика}
index_category.modify {addstart('index_temp_6' = "S")|Спортно предаване}
index_category.modify {addstart('index_temp_6' = "Q")|Спорт}
index_category.modify {addstart('index_temp_6' = "K")|Детско предаване}
index_category.modify {addstart('index_temp_6' = "F")|Филми}
index_category.modify {addstart('index_temp_6' = "D")|Документално}
index_category.modify {addstart('index_temp_6' = "C")|Комедия}
index_category.modify {addstart('index_temp_6' = "E")|Екшън}
index_category.modify {addstart('index_temp_6' = "H")|Фантастика}
index_category.modify {addstart('index_temp_6' = "W")|Еротика}
index_category.modify {addstart('index_temp_6' = "O")|Кулинарно}
index_category.modify {addstart('index_temp_6' = "Y")|Шоу}
index_category.modify {addstart('index_temp_6' = "J")|Времето}
index_category.modify {addstart('index_temp_6' = "A")|Футбол}
index_subtitle.modify {addstart|'index_temp_1'}
end_scope
** _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
** ##### CHANNEL FILE CREATION (only to create the xxx-channel.xml file)
**
** @auto_xml_channel_start
*url_index{url|http://www.potv.bg/tv-programa/TVchanelsOrder.php}
*index_site_id.scrub {multi()||||}
*index_site_channel.scrub {multi()||||}
*scope.range {(channellist)|end}
*index_site_id.modify {cleanup(removeduplicates=equal,100 link="index_site_channel")}
*end_scope
** @auto_xml_channel_end