3 |
|
|
4 |
''' |
''' |
5 |
Todic plugin for XBMC |
Todic plugin for XBMC |
6 |
Version 1.9.0 |
Version 1.9.4 |
7 |
''' |
''' |
8 |
|
|
9 |
import sys |
import sys |
18 |
import urllib |
import urllib |
19 |
import urllib.request |
import urllib.request |
20 |
|
|
21 |
|
import platform |
22 |
|
|
23 |
# import pprint |
# import pprint |
24 |
|
|
25 |
from xml.dom.minidom import parseString |
from xml.dom.minidom import parseString |
200 |
|
|
201 |
|
|
202 |
def open_url(url): |
def open_url(url): |
203 |
with urllib.request.urlopen(url) as response: |
kodi_ver = xbmc.getInfoLabel('System.BuildVersion') |
204 |
data = response.read() |
reqobj = urllib.request.Request( |
205 |
return data |
url, |
206 |
|
data=None, |
207 |
|
headers={ |
208 |
|
'User-Agent': 'TodicKodi:' + str(__addon__.getAddonInfo('version')) + " Kodi:" + str(kodi_ver) + " Platform:" + str(platform.system()) + " " + str(platform.release()) |
209 |
|
} |
210 |
|
) |
211 |
|
|
212 |
|
with urllib.request.urlopen(reqobj) as req: |
213 |
|
#data = response.read() |
214 |
|
#return data |
215 |
|
charset=req.info().get_content_charset() |
216 |
|
content=req.read().decode(charset) |
217 |
|
return content |
218 |
|
|
219 |
|
|
220 |
# wraps open url in a catch-all exception handler |
# wraps open url in a catch-all exception handler |
236 |
msg = msg.strip() |
msg = msg.strip() |
237 |
|
|
238 |
if msg != "": |
if msg != "": |
239 |
|
print("[Todic] rootMenu Dialog =" + str(msg)) |
240 |
dialog = xbmcgui.Dialog() |
dialog = xbmcgui.Dialog() |
241 |
dialog.ok('XBMC Todic', msg) |
dialog.ok('XBMC Todic', msg) |
242 |
|
|
343 |
if (savedPosition > 0): |
if (savedPosition > 0): |
344 |
dialog = xbmcgui.Dialog() |
dialog = xbmcgui.Dialog() |
345 |
#yes / true -afspil fra position |
#yes / true -afspil fra position |
346 |
answer = dialog.yesno(heading='Todic', line1='Afspil fra sidste position', nolabel='Fra start', yeslabel='Fortsæt') |
answer = dialog.yesno(heading='Todic', message='Afspil fra sidste position', nolabel='Fra start', yeslabel='Fortsæt') |
347 |
if (answer == True): |
if (answer == True): |
348 |
playPosition = savedPosition |
playPosition = savedPosition |
349 |
|
|
426 |
#=================================== Tool Box ======================================= |
#=================================== Tool Box ======================================= |
427 |
# shows a more userfriendly notification |
# shows a more userfriendly notification |
428 |
def showMessage(heading, message): |
def showMessage(heading, message): |
429 |
print( "[Todic::showMessage] " + message) |
print( "[Todic::showMessage] " + str(message) ) |
430 |
print( message ) |
print( message ) |
431 |
duration = 15 * 1000 |
duration = 15 * 1000 |
432 |
xbmc.executebuiltin('XBMC.Notification("%s", "%s", %s)' % |
xbmc.executebuiltin('XBMC.Notification("%s", "%s", %s)' % |
493 |
except: |
except: |
494 |
pass |
pass |
495 |
|
|
496 |
|
print( "[Todic] url=" + str(url)) |
497 |
|
print( "[Todic] name=" + str(name)) |
498 |
|
print( "[Todic] mode=" + str(mode)) |
499 |
|
|
500 |
|
|
501 |
try: |
try: |