|
23 | 23 | import datetime
|
24 | 24 | import ast
|
25 | 25 |
|
26 |
| -sys.path.append('/storage/.kodi/addons/script.module.beautifulsoup/lib') |
27 |
| -from BeautifulSoup import BeautifulStoneSoup |
28 |
| - |
29 | 26 | """
|
30 | 27 | import requests
|
31 | 28 | from requests.auth import HTTPBasicAuth
|
@@ -87,14 +84,22 @@ def pout (self, pstr, log_type='none',printOut = True, func = False):
|
87 | 84 | log.setDebug()
|
88 | 85 | operSys = platform.uname()[0]
|
89 | 86 | log.pout(repr(platform.uname()),'info',printOut = False)
|
| 87 | + |
| 88 | +#set paths to import third party libs |
90 | 89 | kodiPath = '/storage/.kodi/addons/'
|
91 | 90 | mechLib = 'script.module.mechanize/lib'
|
| 91 | +soupLib = 'script.module.beautifulsoup/lib' |
92 | 92 | if re.search('openelec', platform.uname()[1], re.IGNORECASE) or os.path.exists(kodiPath):
|
93 | 93 | log.pout("Found openelec node name or " + kodiPath,'info',printOut = False)
|
94 | 94 | if os.path.exists(kodiPath + mechLib):
|
95 | 95 | sys.path.append(kodiPath + mechLib)
|
96 | 96 | 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 | + |
97 | 101 | import mechanize
|
| 102 | +from BeautifulSoup import BeautifulStoneSoup |
98 | 103 |
|
99 | 104 | #log.pout("Test", 'debug', func=True)
|
100 | 105 | # try:
|
@@ -1231,6 +1236,7 @@ def enc(strng):
|
1231 | 1236 | global options
|
1232 | 1237 | t = strng
|
1233 | 1238 | if "-E" not in options:
|
| 1239 | + t = unicode(BeautifulStoneSoup(t, convertEntities=BeautifulStoneSoup.ALL_ENTITIES)) |
1234 | 1240 | t = re.sub(" \'","\'",t) #needed to fix screener guide listing error - '
|
1235 | 1241 | t = re.sub("&","&",t)
|
1236 | 1242 | t = re.sub("\"",""",t)
|
@@ -1571,9 +1577,8 @@ def makeDescsortList(optList):
|
1571 | 1577 | epis = enc(program['episode']) + space
|
1572 | 1578 | episqts = '\"' + enc(program['episode']) + '\"' + space
|
1573 | 1579 | 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 | + |
1577 | 1582 | if "-V" in options:
|
1578 | 1583 | optList = ast.literal_eval(options["-V"])
|
1579 | 1584 | descsort = "".join(makeDescsortList(optList))
|
|
0 commit comments