Grabbing listings from a locally hosted php script (1 Viewer)

Alphathon

Portal Pro
July 15, 2010
64
8
Home Country
Scotland Scotland
I imagine this scenario isn't all that common so I understand if no-one has an answer to this. Regardless, here goes.

As good as WebEPG is, it is a tad limited, and doesn't seem to handle multiple variations within a listings page very well. As such, I thought I'd try to pre-process listings using a php script. This also has the advantage that I can reformat parts of the listing to my preference, combine parts from multiple parts of the listing into one field (e.g. combining information on cast, video format etc into the description field where available. So far I have successfully created one such script, as much as a test/experiments as anything else, which takes information from zdf.de and formats it in nice clean HTML tables as shown below:

Basic format:
HTML:
<table border="1">
<tr><th>#TITLE</th></tr>
<tr><td>#SUBTITLE</td></tr>
<tr><td>#EPISODE</td></tr>
<tr><td>#START</td></tr>
<tr><td>#DESCRIPTION</td></tr>
<tr><td>#GENRE</td></tr>
</table>
Example:
HTML:
<table border="1">
<tr><th>Zwei Männer am Herd</th></tr>
<tr><td>Wie Pfeffer und Salz</td></tr>
<tr><td></td></tr>
<tr><td>06:15</td></tr>
<tr><td>Die Liebeswelt hat ihn endlich wieder. Walter hat sich entschlossen, Giulietta zu erobern, bewaffnet mit einem Italienischsprachkurs, einem Riesenblumenstrauß und einer nächtlich romantischen Einladung zum Hamburger Dom. Von seiner guten Laune profitiert auch Hilmar, der Walter um Wiederaufnahme ins Conrad's bittet und von ihm zu Moritz' Verwunderung prompt eine Zusage erhält.
 
Nicht weniger erstaunt ist Moritz, als in der folgenden Nacht Walter bei ihm mit wenigen Habseligkeiten vor der Wohnung steht. Sein Hausboot ist aus unerklärlichen Gründen auf Grund gelaufen. Ob Conrads Rachefeldzug dahintersteckt? Auf jeden Fall ist ihm die miese Kritik im örtlichen Restaurantführer zuzuschreiben.
 
Land: Deutschland
Jahr: 2000
Bildformat: 16:9</td></tr>
<tr><td>Serie</td></tr>
</table>

So far so good, the php script works; now for the grabber. I have tried out the script in WebEPG designer and it finds all the listings using the following text along with the "T" tag:

Code:
&lt;table border="1"&gt;
&lt;tr&gt;&lt;th&gt;&lt;#TITLE&gt;&lt;/th&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;#SUBTITLE&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;#EPISODE&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;#START&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;#DESCRIPTION&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;#GENRE&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;

The address used to test it in this case was -ttp://localhost/public_HTML/ZDFlistings.php?id=ZDF.kultur&y=2012&m=10&d=16 where ZDF.kultur is the channel and the date is 2012-10-16 (and -ttp = http so as to avoid making it a link). Again, so far so good.

So, then I make up a grabber file, which is shown below:

HTML:
<?xml version="1.0" encoding="utf-8"?>
<Grabber>
    <Info language="de" availableDays="14" timezone="W. Europe Standard Time" version="2.0" />
    <Channels>
        <Channel id="ZDF" siteId="ZDF"/>
        <Channel id="ZDF_neo" siteId="ZDFneo"/>
        <Channel id="ZDFinfo" siteId="ZDFinfo"/>
        <Channel id="ZDF.kultur" siteId="ZDF.kultur"/>
        <Channel id="3sat" siteId="3sat"/>
        <Channel id="Phoenix" siteId="phoenix"/>
        <Channel id="arte" siteId="arte"/>
        <Channel id="KiKA" siteId="KI.KA"/>
    </Channels>
    <Listing type="Html">
        <Site url="http://localhost/public_HTML/ZDFlistings.php?id=[ID]&amp;y=[YYYY]&amp;m=[MM]&amp;d=[DD]" external="false" encoding="utf-8"/>
        <Html>
            <Template name="default">
                <SectionTemplate tags="T">
                    <TemplateText>
                        &lt;table border="1"&gt;
                            &lt;tr&gt;&lt;th&gt;&lt;#TITLE&gt;&lt;/th&gt;&lt;/tr&gt;
                            &lt;tr&gt;&lt;td&gt;&lt;#SUBTITLE&gt;&lt;/td&gt;&lt;/tr&gt;
                            &lt;tr&gt;&lt;td&gt;&lt;#EPISODE&gt;&lt;/td&gt;&lt;/tr&gt;
                            &lt;tr&gt;&lt;td&gt;&lt;#START&gt;&lt;/td&gt;&lt;/tr&gt;
                            &lt;tr&gt;&lt;td&gt;&lt;#DESCRIPTION&gt;&lt;/td&gt;&lt;/tr&gt;
                            &lt;tr&gt;&lt;td&gt;&lt;#GENRE&gt;&lt;/td&gt;&lt;/tr&gt;
                        &lt;/table&gt;
                    </TemplateText>
                </SectionTemplate>
            </Template>
        </Html>
    </Listing>
</Grabber>

Unfortunately, when WebEPG tries to grab the data, it finds no listings, with the following recorded in tv.log (in this case when grabbing info for ZDFinfo for 2012-10-16):

Code:
2012-10-16 17:13:00.981506 [WebEPGImporter(9)]: WebEPG: Getting Channel ID: ZDFinfo
2012-10-16 17:13:00.985507 [WebEPGImporter(9)]:        [10 of 46]
2012-10-16 17:13:00.988507 [WebEPGImporter(9)]: WebEPG: ChannelId: ZDFinfo
2012-10-16 17:13:00.991507 [WebEPGImporter(9)]: WebEPG: Grab Start 17:13 16/10/2012
2012-10-16 17:13:01.114514 [WebEPGImporter(9)]: WebEPG: Reading http://localhost/public_HTML/ZDFlistings.php?id=ZDFinfo&y=2012&m=10&d=16 POST:  - Delay: 500ms
2012-10-16 17:13:56.703694 [WebEPGImporter(9)]: HTMLPage: GetInternal encoding: Forced: utf-8
2012-10-16 17:13:56.707694 [WebEPGImporter(9)]: WebEPG: No Listings Found
2012-10-16 17:13:56.730695 [WebEPGImporter(9)]: WebEPG: Writing Channel: ZDFinfo

Have I made some stupid error with the grabber, or does this have something to do with it being hosted on localhost? Could it even be some kind of timeout issue (each page can take quite a while to load)?
 
Last edited:

vuego

Documentation Group
  • Team MediaPortal
  • August 5, 2006
    1,637
    764
    Göteborg
    Home Country
    Sweden Sweden
    Not sure why but WebEPG Designer crash for me when I use your template text. However if I remove the last &lt;/table&gt; it seems to work. Did you try this?
    &lt;table&gt;
    &lt;tr&gt;&lt;th&gt;&lt;#TITLE&gt;&lt;/th&gt;&lt;/tr&gt;
    &lt;tr&gt;&lt;td&gt;&lt;#SUBTITLE&gt;&lt;/td&gt;&lt;/tr&gt;
    &lt;tr&gt;&lt;td&gt;&lt;#EPISODE&gt;&lt;/td&gt;&lt;/tr&gt;
    &lt;tr&gt;&lt;td&gt;&lt;#START&gt;&lt;/td&gt;&lt;/tr&gt;
    &lt;tr&gt;&lt;td&gt;&lt;#DESCRIPTION&gt;&lt;/td&gt;&lt;/tr&gt;
    &lt;tr&gt;&lt;td&gt;&lt;#GENRE&gt;&lt;/td&gt;&lt;/tr&gt;
     

    Alphathon

    Portal Pro
    July 15, 2010
    64
    8
    Home Country
    Scotland Scotland
    No I didn't - I'll try it later and see if it works (worth a try eh?). Mind you, when I did it in WebEPG Designer it worked, so that may well be unrelated.
     

    vuego

    Documentation Group
  • Team MediaPortal
  • August 5, 2006
    1,637
    764
    Göteborg
    Home Country
    Sweden Sweden
    WebEPG Designer is not really a good design tool since its output isn't the same as in WebEPG itself. Your template might still work if you get no hits in WebEPG Designer and the other way around.
     

    Users who are viewing this thread

    Top Bottom