/[projects]/misc/xbmc/plugin.video.todic/default.py
ViewVC logotype

Diff of /misc/xbmc/plugin.video.todic/default.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 3261 by torben, Fri Feb 19 21:39:29 2021 UTC revision 3265 by torben, Sat Mar 20 18:35:52 2021 UTC
# Line 3  Line 3 
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
# Line 18  import xbmcplugin Line 18  import xbmcplugin
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
# Line 198  def SaveFile(path, data): Line 200  def SaveFile(path, data):
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
# Line 222  def rootMenu(): Line 236  def rootMenu():
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    
# Line 328  def play_video(url, name): Line 343  def play_video(url, name):
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                    
# Line 411  def searchSeries(): Line 426  def searchSeries():
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)' %
# Line 478  try: Line 493  try:
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:

Legend:
Removed from v.3261  
changed lines
  Added in v.3265

  ViewVC Help
Powered by ViewVC 1.1.20