[mythtvnz] Bug in mhegepgsnoop-0.5.1.py

Robin Gilks g8ecj at gilks.org
Sun Mar 24 04:44:46 GMT 2013


> On 24/03/13 11:50, Robin Gilks wrote:
>> Just when I thought it was all working!!
>>
>> I've discovered that the 'midnight corrections' in mhegepgsnoop are not
>> working as expected.
>>
>> If a program starts at 23:00 for 2 hours then it will appear in the
>> schedule at 23:00 for 1 hour and then again at 00:00 for the second
>> hour.
>>
>> This example actually starts at a quarter to midnight...
>>
>>
>>    <programme start="20130324234500 +1300" stop="20130325000000 +1300"
>> channel="tv1.freeviewnz.tv">
>>      <title>Q+A</title>
>>      <desc>Q+A presents hard-hitting political news and commentary. Keep
>> in
>> touch with what is truly going on in New Zealand.</desc>
>>      <episode-num system="dd_progid">10322125</episode-num>
>>    </programme>
>>    <programme start="20130325000000 +1300" stop="20130325005500 +1300"
>> channel="tv1.freeviewnz.tv">
>>      <title>Q+A</title>
>>      <desc>Q+A presents hard-hitting political news and commentary. Keep
>> in
>> touch with what is truly going on in New Zealand.</desc>
>>      <episode-num system="dd_progid">10322125</episode-num>
>>    </programme>
>>
>>
>> As I say, my python skills are not up to sorting this (if it was written
>> in C or assembler...)
>>
>> Cheers
>>
> That's odd. I just ran: ./mhegepgsnoop-0.5.1.py -z -o testz.xml
>
> and I got one entry for the show correctly crossing midnight:
>
>          <programme channel="FV-tvone" start="20130324234500 +1300"
> stop="20130325005500 +1300">
>
>                  <title>Q+A</title>
>
>                  <desc>Q+A presents hard-hitting political news and
> commentary. Keep in touch with what is truly going on in
> New Zealand.</desc>
>
>                  <episode-num system="dd_progid">10322125</episode-num>
>
>          </programme>
>

Sorry for the noise but it appears to be my fault - playing with the time
encoding sections of code having *not* seen the -z switch.

I still get a problem when merging with epgsnoop output (used to get the
Freeview DVB-S channels) in that the tv_cat program from the xmltv package
barfs on the upper/lower case description of the coding standard. This is
the error message from tv_cat:

/tmp/listings-dvbt-11788.xml: this file's encoding UTF-8 differs from
others' utf-8 - aborting

I've fixed it with the following one-liner:

--- mhegepgsnoop-0.5.1.py       2012-07-11 21:16:42.000000000 +1200
+++ /usr/local/bin/mhegepgsnoop-0.5.1.py        2013-03-24
17:34:10.000000000 +1300
@@ -1500,7 +1500,7 @@
        # Write the xml doc to disk
        outfile = open(OUT_FILE, "w")
        # Add manual declaration and doctype headers because it's tedious
to do any other way
-       outfile.write('<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE tv
SYSTEM "xmltv.dtd">')
+       outfile.write('<?xml version="1.0" encoding="utf-8"?><!DOCTYPE tv
SYSTEM "xmltv.dtd">')
        ET.ElementTree(root_element).write(outfile, encoding="utf-8")
        outfile.close()

Cheers

-- 
Robin Gilks






More information about the mythtvnz mailing list