Skip to content

Commit

Permalink
changes to make it work also for python 2
Browse files Browse the repository at this point in the history
  • Loading branch information
TermeHansen committed Mar 6, 2021
1 parent 83ed52e commit ab1a25e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 13 deletions.
6 changes: 3 additions & 3 deletions addon.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<addon id="plugin.video.dr.dk.bonanza" version="3.2.0+matrix.1" name="DR.dk Bonanza" provider-name="termehansen">
<addon id="plugin.video.dr.dk.bonanza" version="3.2.1+matrix.1" name="DR.dk Bonanza" provider-name="termehansen">
<requires>
<import addon="xbmc.python" version="3.0.0"/>
<import addon="script.module.buggalo" version="1.2.0"/>
Expand All @@ -26,10 +26,10 @@
<icon>resources/icon.png</icon>
<fanart>resources/fanart.jpg</fanart>
</assets>
<news>[B]Version 3.2.0 - 2020-11-26[/B]
<news>[B]Version 3.2.1 - 2020-03-06[/B]
- Updated addon to match website changes
- Moving "ownership" of the addon, hence Tommy have stopped developing on the addon.
- re-factor for Matrix
- re-factor for Leia and Matrix
</news>
</extension>
</addon>
22 changes: 12 additions & 10 deletions resources/lib/addon.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,21 @@
import sys
import requests
import requests_cache
from html import unescape
import buggalo

import xbmc
import xbmcgui
import xbmcplugin
import xbmcaddon
import json

try:
if sys.version_info.major == 2:
# python 2
from urlparse import parse_qsl
except:
import HTMLParser
parser = HTMLParser.HTMLParser()
else:
import html.parser
parser = html.parser.HTMLParser()
from urllib.parse import parse_qsl

BASE_URL = 'http://www.dr.dk/bonanza/'
Expand Down Expand Up @@ -78,8 +80,8 @@ def search(self):
for m in re.finditer(pattern, html, re.DOTALL):
url = BASE_URL + m.group(1)
image = 'http:' + m.group(2)
title = unescape(m.group(3))
description = unescape(m.group(4))
title = parser.unescape(m.group(3))
description = parser.unescape(m.group(4))

infoLabels = {
'title': title,
Expand Down Expand Up @@ -141,8 +143,8 @@ def addSubCategories(self, html):
for m in re.finditer(pattern, html, re.DOTALL):
url = BASE_URL + m.group(1)
image = 'http:' + m.group(2)
title = unescape(m.group(3))
description = unescape(m.group(4))
title = parser.unescape(m.group(3))
description = parser.unescape(m.group(4))

item = xbmcgui.ListItem(title, offscreen=True)
item.setArt({'fanart': FANART, 'icon': image})
Expand All @@ -161,9 +163,9 @@ def addContent(self, html):
html = html.split('<div class="list-footer"></div>',1)[0]
for m in re.finditer(pattern, html, re.DOTALL):
url = BASE_URL + m.group(1)
description = unescape(m.group(2))
description = parser.unescape(m.group(2))
image = 'http:' + m.group(3)
title = unescape(m.group(4))
title = parser.unescape(m.group(4))
infoLabels = {
'title': title,
'plot': description,
Expand Down

0 comments on commit ab1a25e

Please sign in to comment.