**------------------------------------------------------------------------------------------------ * @header_start * WebGrab+Plus ini for grabbing MDB data from TvGuide websites * @MinSWversion : V1.1.1/55.27 * @Site: thetvdb.com * @Revision 1 - [30/09/2015] Jan van Straaten * - added mdb-category * @Revision 0 - [01/02/2015] Jan van Straaten * - creation * @Remarks: - series database * @header_end **------------------------------------------------------------------------------------------------ * * site {url=thetvdb.com|cultureinfo=en-US|charset=UTF-8|matchfactor=70|searchsite=tvdb} * primary search: mdb_variable_element.modify {addstart|'x_title'} url_primarysearch {url|http://thetvdb.com/index.php?seriesname=####&fieldlocation=2&order=translation&searching=Search&tab=advancedsearch} * special case mdb_variable_element.modify {replace(~ "murder she wrote")|'mdb_variable_element'|murder, she wrote} url_primarysearch.modify {replace|####|'mdb_variable_element'} url_primarysearch.modify {replace| |+} * if title or variable_element has spaces * lid = language id , some values: * English = 7 (default), Dutch = 13, Italian = 15, French = 17, German = 14, Danish = 10 * limit show_id to English, German, French and Dutch. show_id.scrub {multi(include="lid=7""lid=14""lid=17""lid=13")|primary|id="listtable">||} * sort show_id in order lid 7, 14, 17, 13 (English, German, French, Dutch) mdb_temp_1.modify {calculate(type=element format=F0)|'show_id' #} mdb_temp_4.modify {addstart|####} * in here English and German mdb_temp_5.modify {addstart|####} * in here French and Dutch loop {('mdb_temp_1' > "0" max=50)|end} mdb_temp_1.modify {calculate(format=F0)|1 -} mdb_temp_2.modify {substring(type=element)|'show_id' 'mdb_temp_1' 1} * the showid to inspect * to change the language order, edit the lid= value for the following 4 lines mdb_temp_4.modify {addstart('mdb_temp_2' ~ "lid=7")|####'mdb_temp_2'} *English mdb_temp_4.modify {addend('mdb_temp_2' ~ "lid=14")|'mdb_temp_2'####} *German mdb_temp_5.modify {addstart('mdb_temp_2' ~ "lid=17")|####'mdb_temp_2'} * French mdb_temp_5.modify {addend('mdb_temp_2' ~ "lid=13")|'mdb_temp_2'####} * Dutch end_loop show_id.modify {clear} show_id.modify {addstart|'mdb_temp_4''mdb_temp_5'} show_id.modify {replace|####|\|} * make multi * next replace the language number with the language string * and add /all/ , like 77811&lid=17 to become 77811/all/fr, as needed in url_mdb_p1 show_id.modify {replace|&lid=7|/all/en} show_id.modify {replace|&lid=14|/all/de} show_id.modify {replace|&lid=17|/all/fr} show_id.modify {replace|&lid=13|/all/nl} * *mdb url's: * apikey=8DAFF524CAF680FA , project name WG++ * http://www.thetvdb.com/api/8DAFF524CAF680FA/series/82654/all/nl url_mdb_p1 {url()|primary|http://thetvdb.com/api/8DAFF524CAF680FA/series/|show_id|.xml} * * the returned page starts with a series data element followed by all the known episodes in a element * following the mdbconfig mustmatch="title,subtitle" the program looks for a match of the title (in the element) * and a match of the subtitle in one of the elements * * mdb elements: * in the top element: mdb_title.scrub {single()|p1||||} mdb_actor.scrub {multi(separator="!?!?!")|p1||||} mdb_actor.modify {cleanup} * * the subtitle is the episode title. The next scrub first results in all the subtitles for this series * but the matching routine will automatically replace it by the one that matches (highest matchfactor ) mdb_subtitle.scrub {multi()|p1||||} * * the next step is to extract the matching element mdb_temp_6.scrub {multi|p1||||} * all episodes mdb_temp_1.modify {calculate('mdb_temp_6' not "" type=element format=F0)|'mdb_temp_6' 'mdb_subtitle' @} * index of the episode mdb_temp_1.modify {substring(type=element)|'mdb_temp_6' 'mdb_temp_1' 1} * the episode in xml format * * the other mdb elements mdb_temp_1.modify {replace|>!?!?!|>} mdb_temp_1.modify {replace|!?!?!<|<} mdb_temp_1.modify {replace|!?!?!|, } mdb_temp_1.modify {replace|\n|\|} * split in individual elements for easy separation * * episodeid * we combine (=episode id) and mdb_temp_2.modify {calculate(type=element format=F0)|'mdb_temp_1' "" @} * index of element mdb_episode_id.modify {substring('mdb_temp_2' not "-1" type=element)|'mdb_temp_1' 'mdb_temp_2' 1} mdb_episode_id.modify {remove|} mdb_episode_id.modify {remove|} mdb_temp_2.modify {calculate(type=element format=F0)|'mdb_temp_1' "" @} * index of element mdb_temp_3.modify {substring('mdb_temp_2' not "-1" type=element)|'mdb_temp_1' 'mdb_temp_2' 1} mdb_temp_3.modify {replace||SeasonId: } mdb_temp_3.modify {remove|} mdb_episode_id.modify {addend|'mdb_temp_3'} mdb_episode_id.modify {cleanup} * * episode-num * we combine and in SxEx mdb_temp_2.modify {calculate(type=element format=F0)|'mdb_temp_1' "" @} * index of element mdb_episode.modify {substring('mdb_temp_2' not "-1" type=element)|'mdb_temp_1' 'mdb_temp_2' 1} mdb_episode.modify {replace||E} mdb_episode.modify {remove|} mdb_temp_2.modify {calculate(type=element format=F0)|'mdb_temp_1' "" @} * index of element mdb_temp_3.modify {substring('mdb_temp_2' not "-1" type=element)|'mdb_temp_1' 'mdb_temp_2' 1} mdb_temp_3.modify {replace||S} mdb_temp_3.modify {remove|} mdb_episode.modify {addstart|'mdb_temp_3'} mdb_episode.modify {cleanup} * * description mdb_temp_2.modify {calculate(type=element format=F0)|'mdb_temp_1' "" @} * index of element mdb_description.modify {substring('mdb_temp_2' not "-1" type=element)|'mdb_temp_1' 'mdb_temp_2' 1} mdb_description.modify {remove|} mdb_description.modify {remove|} mdb_description.modify {cleanup} * * starrating mdb_temp_2.modify {calculate(type=element format=F0)|'mdb_temp_1' "" @} * index of element mdb_starrating.modify {substring('mdb_temp_2' not "-1" type=element)|'mdb_temp_1' 'mdb_temp_2' 1} mdb_starrating.modify {remove|} mdb_starrating.modify {remove|} mdb_starrating.modify {cleanup} * * Director mdb_temp_2.modify {calculate(type=element format=F0)|'mdb_temp_1' "" @} * index of element mdb_director.modify {substring('mdb_temp_2' not "-1" type=element)|'mdb_temp_1' 'mdb_temp_2' 1} mdb_director.modify {remove|} mdb_director.modify {remove|} mdb_director.modify {cleanup} * * Guest stars mdb_temp_2.modify {calculate(type=element format=F0)|'mdb_temp_1' "" @} * index of element mdb_temp_4.modify {clear} mdb_temp_4.modify {substring('mdb_temp_2' not "-1" type=element)|'mdb_temp_1' 'mdb_temp_2' 1} mdb_temp_4.modify {remove|} mdb_temp_4.modify {remove|} mdb_temp_4.modify {replace|, |\|} mdb_temp_4.modify {cleanup} mdb_temp_4.modify {addend(not "")| (guest)} mdb_temp_4.modify {replace|\||####} mdb_actor.modify {replace|\||####} mdb_actor.modify {addend|####'mdb_temp_4'} mdb_actor.modify {replace|####|\|} mdb_actor.modify {cleanup(removeduplicates=name,70)} mdb_actor.modify {cleanup} * * Episode Icon (showicon) mdb_temp_2.modify {calculate(type=element format=F0)|'mdb_temp_1' "" @} * index of element mdb_showicon.modify {substring('mdb_temp_2' not "-1" type=element)|'mdb_temp_1' 'mdb_temp_2' 1} mdb_showicon.modify {remove|} mdb_showicon.modify {remove|} mdb_showicon.modify {cleanup} mdb_showicon.modify {addstart(not "")|http://www.thetvdb.com/banners/} * * Category = Genre * not listed at each episode. Only once for the whole series at the top of p1 mdb_category.scrub {single()|p1||||} mdb_category.modify {replace|!?!?!|\|}