Menu

#20 grabber does not deal with nbsp

operation
open
jsharpe
nz_xtra (6)
5
2005-02-01
2005-02-01
John Blance
No

The xtramsn html currently uses a non-breaking space to
placehold when the previous program continues into this
timeslot [blank table cell in viewed html]

The non-breaking space is not recognised by
htmlentities, and generates errors of the type:
WARNING:   is not mapped! Please check the code!
ERROR: You have encountered a bug!
list index out of range

a hacked fix could be something like:
diff -U 2 tv_grab_nz_xtra /usr/bin/tv_grab_nz_xtra
--- tv_grab_nz_xtra 2005-02-01 14:14:45.000000000 +1300
+++ /usr/bin/tv_grab_nz_xtra 2005-02-02
10:46:09.305626056 +1300
@@ -1,3 +1,3 @@
-#!/usr/bin/env python
+#!/usr/bin/python
#
-----------------------------------------------------------------------
# Copyright (C) 2004 allblackwonder
@@ -132,10 +132,13 @@
( re.compile( "(\x96)" ), "-" ),
( re.compile( "(\x92)" ), "'" ),
+ #   -> nbsp
+ ( re.compile( " " ), "nbsp" ),
# & -> &
( re.compile(
"&(?P<char>[^;&]*)(?P<space>[\s])" ),
"&amp;\g<char>\g<space>" ),
- ( re.compile( "&(?P<char>[^;&]*)$" ),
"&amp;\g<char>" ),
+ ( re.compile( "&(?P<char>[^;&]*)$" ),
"&amp;\g<char>" )
]

+

############################################################################

############################################################################
@@ -156,4 +159,6 @@
valid_channels = copy(self.conf['Channels'])

+ re_titlecheck = re.compile(".*nbsp.*", re.I)
+
table = html_structure
tablerows = table.children
@@ -171,4 +176,8 @@
if channel in valid_channels:
td = tr.children[index]
+ #if td is nbsp then doesn't need
processing??
+ if re_titlecheck.search(td.cdata):
+ pass
+ else:
self.process_program_entry(
td.cdata, grab_day, defaultstarttime, channel )
for hr in td.children:

Discussion


Log in to post a comment.