home
products
contribute
download
documentation
forum
Home
Forums
New posts
Search forums
What's new
New posts
All posts
Latest activity
Members
Registered members
Current visitors
Donate
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Search titles only
By:
Menu
Log in
Register
Navigation
Install the app
Install
More options
Contact us
Close Menu
Forums
MediaPortal 1
MediaPortal 1 Plugins
MyTVSeries - Plugin that organizes TV Video Files
Contact us
RSS
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="zeflash" data-source="post: 80354" data-attributes="member: 13641"><p>I digged a bit more into the HTML parsing. It uses the sgmlreader dll from microsoft and some complex code (sgmlparser) in order to match the template file to the actual html code.</p><p></p><p>After some debugging, I now understand why Fifth gear isn't added properly;</p><p>The template *needs* a matching description, an IMDB url and a tv.com url.</p><p>Trouble is for fifth gear there isn't a tv.com url. So even though the other fields are there, it fails to parse properly.</p><p>Furthermore, the way the parser works means that it will always end up the description on the first BR tag.</p><p>On Fifth gear, the plot outline of the series uses <BR /> to indent the description => I'm only getting the first line.</p><p></p><p>So, I ask you this question (since I'm new to this project):</p><p>What is the need for sgmlparser, when one could use regular expressions to properly parse pieces of the page?</p><p>For instance, here is the description parsing using sgml:</p><p>[CODE]<body>Plot Outline:<br>{show_description}<br>[/CODE]</p><p>that only extracts the text up to the first BR tag.</p><p></p><p>Using Regex, it looks like this one works better:</p><p>[CODE]Plot Outline:.*?<br>(?<description>.*?)<br><br>[/CODE]</p><p></p><p>Doesn't look more difficult to understand to me - and it gets the whole thing.</p><p>And with a little change to the way the template is read by the plugin, some values could just be optional (tv.com or IMDB) so it wouldn't break the whole import process.</p><p></p><p></p><p>In the end, my belief is that the SGMLParser.cs file adds rigidity and more complexity to the process for the only upside of being able to write more natural (in a sense) templates.</p><p>Given that those templates are rarely modified and that regexp, once understood, are pretty easy to write too, it looks like an unnecessary layer to me.</p><p></p><p>For those still reading this thread, what do you think? Do you know of any parsing case that would not work with regexp and would need the SGML parser to work?</p><p></p><p>Edit: </p><p>Well, or course, it makes it easier to list multiple episodes. Hmm. I'll keep thinking about this. It would really help to know what this sgmlparse class is able to do!</p><p>I can retrieve the episodelisting info with this:</p><p>[code]</p><p><tr bgcolor=".*?td.*?>(?<production_number>.*?)</td>.*?<a href="/episode/(?<episode_id>.*?)">(?<episode_season_and_number>.*?)</td>.*?<a.*?>(?<episode_title>.*?)</a>.*?<td.*?>(?<production_id>.*?)</td>.*?</span>.*?<a.*?td nowrap.*?>(?<broadcast_date>.*?)</td></p><p>[/code]</p><p>And then cycling through all the different regex matches. That's an alternative to the episodelist[] search tag in the SGMLParser template.</p><p>I'll try to have an equivalent regexp for all the templates. If I'm able to do that, then I just might change the whole parsing to use those instead of sgmlreader.</p></blockquote><p></p>
[QUOTE="zeflash, post: 80354, member: 13641"] I digged a bit more into the HTML parsing. It uses the sgmlreader dll from microsoft and some complex code (sgmlparser) in order to match the template file to the actual html code. After some debugging, I now understand why Fifth gear isn't added properly; The template *needs* a matching description, an IMDB url and a tv.com url. Trouble is for fifth gear there isn't a tv.com url. So even though the other fields are there, it fails to parse properly. Furthermore, the way the parser works means that it will always end up the description on the first BR tag. On Fifth gear, the plot outline of the series uses <BR /> to indent the description => I'm only getting the first line. So, I ask you this question (since I'm new to this project): What is the need for sgmlparser, when one could use regular expressions to properly parse pieces of the page? For instance, here is the description parsing using sgml: [CODE]<body>Plot Outline:<br>{show_description}<br>[/CODE] that only extracts the text up to the first BR tag. Using Regex, it looks like this one works better: [CODE]Plot Outline:.*?<br>(?<description>.*?)<br><br>[/CODE] Doesn't look more difficult to understand to me - and it gets the whole thing. And with a little change to the way the template is read by the plugin, some values could just be optional (tv.com or IMDB) so it wouldn't break the whole import process. In the end, my belief is that the SGMLParser.cs file adds rigidity and more complexity to the process for the only upside of being able to write more natural (in a sense) templates. Given that those templates are rarely modified and that regexp, once understood, are pretty easy to write too, it looks like an unnecessary layer to me. For those still reading this thread, what do you think? Do you know of any parsing case that would not work with regexp and would need the SGML parser to work? Edit: Well, or course, it makes it easier to list multiple episodes. Hmm. I'll keep thinking about this. It would really help to know what this sgmlparse class is able to do! I can retrieve the episodelisting info with this: [code] <tr bgcolor=".*?td.*?>(?<production_number>.*?)</td>.*?<a href="/episode/(?<episode_id>.*?)">(?<episode_season_and_number>.*?)</td>.*?<a.*?>(?<episode_title>.*?)</a>.*?<td.*?>(?<production_id>.*?)</td>.*?</span>.*?<a.*?td nowrap.*?>(?<broadcast_date>.*?)</td> [/code] And then cycling through all the different regex matches. That's an alternative to the episodelist[] search tag in the SGMLParser template. I'll try to have an equivalent regexp for all the templates. If I'm able to do that, then I just might change the whole parsing to use those instead of sgmlreader. [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
MediaPortal 1
MediaPortal 1 Plugins
MyTVSeries - Plugin that organizes TV Video Files
Contact us
RSS
Top
Bottom