Skip to content

Commit a3af2a8

Browse files
authored
Merge pull request #18 from Schmell/patch-5
Nice update - thanks! Is it all working well for you now? Before I go for adding it to the LibreElec repo, I think I may add a comma and slash to the description list options. Anything else you think we should add before putting out a 1.0 release?
2 parents 8a8d2cb + 0994fdc commit a3af2a8

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

zap2xml.py

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,6 @@
2323
import datetime
2424
import ast
2525

26-
sys.path.append('/storage/.kodi/addons/script.module.beautifulsoup/lib')
27-
from BeautifulSoup import BeautifulStoneSoup
28-
2926
"""
3027
import requests
3128
from requests.auth import HTTPBasicAuth
@@ -87,14 +84,22 @@ def pout (self, pstr, log_type='none',printOut = True, func = False):
8784
log.setDebug()
8885
operSys = platform.uname()[0]
8986
log.pout(repr(platform.uname()),'info',printOut = False)
87+
88+
#set paths to import third party libs
9089
kodiPath = '/storage/.kodi/addons/'
9190
mechLib = 'script.module.mechanize/lib'
91+
soupLib = 'script.module.beautifulsoup/lib'
9292
if re.search('openelec', platform.uname()[1], re.IGNORECASE) or os.path.exists(kodiPath):
9393
log.pout("Found openelec node name or " + kodiPath,'info',printOut = False)
9494
if os.path.exists(kodiPath + mechLib):
9595
sys.path.append(kodiPath + mechLib)
9696
else: log.pout("Mechanize addon not installed error",'error')
97+
if os.path.exists(kodiPath + soupLib):
98+
sys.path.append(kodiPath + soupLib)
99+
else: log.pout("BeautifulSoup addon not installed error",'error')
100+
97101
import mechanize
102+
from BeautifulSoup import BeautifulStoneSoup
98103

99104
#log.pout("Test", 'debug', func=True)
100105
# try:
@@ -1231,6 +1236,7 @@ def enc(strng):
12311236
global options
12321237
t = strng
12331238
if "-E" not in options:
1239+
t = unicode(BeautifulStoneSoup(t, convertEntities=BeautifulStoneSoup.ALL_ENTITIES))
12341240
t = re.sub(" \'","\'",t) #needed to fix screener guide listing error - '
12351241
t = re.sub("&","&",t)
12361242
t = re.sub("\"",""",t)
@@ -1571,9 +1577,8 @@ def makeDescsortList(optList):
15711577
epis = enc(program['episode']) + space
15721578
episqts = '\"' + enc(program['episode']) + '\"' + space
15731579
if 'description' in program:
1574-
plot = program['description']
1575-
plot = unicode(BeautifulStoneSoup(plot, convertEntities=BeautifulStoneSoup.ALL_ENTITIES))
1576-
plot = enc(plot) + space
1580+
plot = enc(program['description'])
1581+
15771582
if "-V" in options:
15781583
optList = ast.literal_eval(options["-V"])
15791584
descsort = "".join(makeDescsortList(optList))

0 commit comments

Comments
 (0)