/[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 1914 by torben, Thu Jan 17 18:44:47 2013 UTC revision 2098 by torben, Sun Jan 5 22:01:35 2014 UTC
# Line 3  Line 3 
3    
4  '''  '''
5      Todic plugin for XBMC      Todic plugin for XBMC
6      Version 0.0.2      Version 0.0.10
7  '''  '''
8    
9  import sys  import sys
# Line 106  def rootMenu(): Line 106  def rootMenu():
106          u = sys.argv[0] + "?mode=10&name="          u = sys.argv[0] + "?mode=10&name="
107          ok = xbmcplugin.addDirectoryItem(handle = int(sys.argv[1]), url = u, listitem = listitem, isFolder = True)          ok = xbmcplugin.addDirectoryItem(handle = int(sys.argv[1]), url = u, listitem = listitem, isFolder = True)
108    
109            #add search series
110            listitem = xbmcgui.ListItem(label = "Søg Serier ...", iconImage = 'DefaultFolder.png', thumbnailImage = 'DefaultFolder.png')
111            listitem.setProperty('Fanart_Image', fanartImage)
112    
113            u = sys.argv[0] + "?mode=11&name="
114            ok = xbmcplugin.addDirectoryItem(handle = int(sys.argv[1]), url = u, listitem = listitem, isFolder = True)
115    
116          xbmcplugin.endOfDirectory(int(sys.argv[1]))          xbmcplugin.endOfDirectory(int(sys.argv[1]))
117    
118    
# Line 139  def buildList(url,title, endlist=True): Line 146  def buildList(url,title, endlist=True):
146                          playcount = '0'                          playcount = '0'
147                  playcount = int(playcount)                  playcount = int(playcount)
148    
                 name = name.encode('latin-1')  
                 description = description.encode('latin-1')  
149    
150  ##              print "name:" + name  ##              print "name:" + name
151  #               print "url:" + url  #               print "url:" + url
# Line 157  def buildList(url,title, endlist=True): Line 162  def buildList(url,title, endlist=True):
162                          infoLabels['playcount'] = playcount                          infoLabels['playcount'] = playcount
163                          listitem.setInfo('video', infoLabels)                          listitem.setInfo('video', infoLabels)
164    
165                    name = name.encode('UTF-8')
166                    description = description.encode('UTF-8')
167    
168    
169                  u = sys.argv[0] + "?mode=" + urllib.quote(mode) + "&name=" + urllib.quote(name) + "&url=" + urllib.quote(url)                  u = sys.argv[0] + "?mode=" + urllib.quote(mode) + "&name=" + urllib.quote(name) + "&url=" + urllib.quote(url)
170                  ok = xbmcplugin.addDirectoryItem(handle = int(sys.argv[1]), url = u, listitem = listitem, isFolder = folder, totalItems = l)                  ok = xbmcplugin.addDirectoryItem(handle = int(sys.argv[1]), url = u, listitem = listitem, isFolder = folder, totalItems = l)
171    
# Line 177  def play_video(url, name): Line 186  def play_video(url, name):
186          subtitleurl = getText( doc.getElementsByTagName("subtitles") )          subtitleurl = getText( doc.getElementsByTagName("subtitles") )
187          subtitlesfile = os.path.join(datapath,'temp.srt')          subtitlesfile = os.path.join(datapath,'temp.srt')
188    
189            #if old srt file exists delete it first
190            if os.path.isfile(subtitlesfile):
191                    os.unlink(subtitlesfile)
192    
193          print '[TODIC] subs: '+str(subtitleurl)          print '[TODIC] subs: '+str(subtitleurl)
194          if len(subtitleurl) > 0:          if len(subtitleurl) > 0:
195                  subtitles = open_url(subtitleurl)                  subtitles = open_url(subtitleurl)
# Line 205  def play_video(url, name): Line 218  def play_video(url, name):
218                  if os.path.isfile(subtitlesfile):                  if os.path.isfile(subtitlesfile):
219                          player.setSubtitles(subtitlesfile)                          player.setSubtitles(subtitlesfile)
220                          print 'TODIC started subtitles'                          print 'TODIC started subtitles'
221                    else:
222                            player.disableSubtitles()
223    
224  #       player.callbackLoop()  #       player.callbackLoop()
225    
# Line 221  def search(): Line 236  def search():
236    
237                  buildList(url, "søgning")                  buildList(url, "søgning")
238    
239    def searchSeries():
240            search = getUserInput("Todic Serie Søgning")
241    
242            if (search != None and search != ""):
243                    url = __backend__ + "&action=searchseries&search=" + urllib.quote_plus(search)
244    
245                    #print "[TODIC] Search start: " + search
246                    #print "[TODIC] Search url: " + url
247    
248                    buildList(url, "serie søgning")
249    
250                    
251    
252    
# Line 287  except: Line 313  except:
313          pass          pass
314    
315  if url == 'refresh':  if url == 'refresh':
316          xbmc.output("[tvserver] Container.Refresh")          #xbmc.output("[tvserver] Container.Refresh") #20130418 xbmc.output virker ikke med XBMC12
317          xbmc.executebuiltin("Container.Refresh")          xbmc.executebuiltin("Container.Refresh")
318                    
319    
# Line 301  elif mode == 1: Line 327  elif mode == 1:
327    
328  elif mode == 10:  elif mode == 10:
329          search()          search()
330    
331    elif mode == 11:
332            searchSeries()
333                    
334    
335  elif mode == 50:  elif mode == 50:

Legend:
Removed from v.1914  
changed lines
  Added in v.2098

  ViewVC Help
Powered by ViewVC 1.1.20