Skip to content

Commit

Permalink
Version 2.1.5
Browse files Browse the repository at this point in the history
* Empty programme description fix (#134)
  • Loading branch information
Cigaras committed Jun 26, 2017
1 parent 089a093 commit dca8b6e
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Contents/Code/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.

# Version 2.1.4
# Version 2.1.5

from m3u_parser import LoadPlaylist, PlaylistReloader
from xmltv_parser import LoadGuide, GuideReloader
Expand Down
22 changes: 15 additions & 7 deletions Contents/Code/xmltv_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,13 +79,21 @@ def LoadGuide():
start = StringToLocalDatetime(programme_elem.get('start'))
stop = StringToLocalDatetime(programme_elem.get('stop'))
if stop >= current_datetime:
title = programme_elem.find('title').text
desc_attr = programme_elem.find('desc')
try:
desc = unicode(desc_attr.text, errors = 'replace')
except TypeError:
desc = desc_attr.text.decode('utf-8')
except AttributeError:
title_text = programme_elem.find('title').text
if title_text:
try:
title = unicode(title_text, errors = 'replace')
except TypeError:
title = title_text.decode('utf-8')
else:
title = None
desc_text = programme_elem.find('desc').text
if desc_text:
try:
desc = unicode(desc_text, errors = 'replace')
except TypeError:
desc = desc_text.decode('utf-8')
else:
desc = None
count = count + 1
item = {
Expand Down

0 comments on commit dca8b6e

Please sign in to comment.