/[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 1630 by torben, Sun Nov 27 11:05:43 2011 UTC revision 1646 by torben, Sat Dec 3 12:01:56 2011 UTC
# Line 32  def rootMenu(): Line 32  def rootMenu():
32                  listitem = xbmcgui.ListItem(label = name, iconImage = 'DefaultFolder.png', thumbnailImage = 'DefaultFolder.png')                  listitem = xbmcgui.ListItem(label = name, iconImage = 'DefaultFolder.png', thumbnailImage = 'DefaultFolder.png')
33                  u = sys.argv[0] + "?mode=1&name=" + urllib.quote_plus(name) + "&url=" + urllib.quote_plus(url)                  u = sys.argv[0] + "?mode=1&name=" + urllib.quote_plus(name) + "&url=" + urllib.quote_plus(url)
34                  ok = xbmcplugin.addDirectoryItem(handle = int(sys.argv[1]), url = u, listitem = listitem, isFolder = True, totalItems = l)                  ok = xbmcplugin.addDirectoryItem(handle = int(sys.argv[1]), url = u, listitem = listitem, isFolder = True, totalItems = l)
35    
36            listitem = xbmcgui.ListItem(label = "Søg film ...", iconImage = 'DefaultFolder.png', thumbnailImage = 'DefaultFolder.png')
37            u = sys.argv[0] + "?mode=10&name=" + urllib.quote_plus(name)
38            ok = xbmcplugin.addDirectoryItem(handle = int(sys.argv[1]), url = u, listitem = listitem, isFolder = True, totalItems = l)
39    
40          xbmcplugin.endOfDirectory(int(sys.argv[1]))          xbmcplugin.endOfDirectory(int(sys.argv[1]))
41    
42    
# Line 39  def buildList(url,title): Line 44  def buildList(url,title):
44          print '[TODIC]:'+str(url)                  print '[TODIC]:'+str(url)        
45          link = open_url(url)          link = open_url(url)
46          ty=re.compile('<meta type=\'(.+?)\'').findall(link)          ty=re.compile('<meta type=\'(.+?)\'').findall(link)
47          print '[TOD]'+str(ty[0])          print '[TODIC]'+str(ty[0])
48    
49            if ty[0] == 'clipList':
50                    mode = '50'
51                    folder = False
52            else:
53                    mode = '1'
54                    folder = True
55    
56          m=re.compile('<title>(.+?)</title><url>(.+?)</url><cover>(.+?)</cover>').findall(link)          m=re.compile('<title>(.+?)</title><url>(.+?)</url><cover>(.+?)</cover>').findall(link)
57          l=len(m)          l=len(m)
58          for name,url,thumb in m:          for name,url,thumb in m:                        
                 if ty[0] == 'clipList':  
                         mode = '50'  
                         folder = False  
                 else:  
                         mode = '2'  
                         folder = True  
                           
59                  listitem = xbmcgui.ListItem(label = name, iconImage = 'DefaultFolder.png', thumbnailImage = thumb)                  listitem = xbmcgui.ListItem(label = name, iconImage = 'DefaultFolder.png', thumbnailImage = thumb)
60                  u = sys.argv[0] + "?mode=" + urllib.quote_plus(mode) + "&name=" + urllib.quote_plus(name) + "&url=" + urllib.quote_plus(url)                  u = sys.argv[0] + "?mode=" + urllib.quote_plus(mode) + "&name=" + urllib.quote_plus(name) + "&url=" + urllib.quote_plus(url)
61                  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)
62          xbmcplugin.endOfDirectory(int(sys.argv[1]))          xbmcplugin.endOfDirectory(int(sys.argv[1]))
63    
 def buildSubList(url,title):  
         print '[TODIC]:'+str(url)  
         link = open_url(url)  
         m=re.compile('<title>(.+?)</title><url>(.+?)</url><cover>(.+?)</cover>').findall(link)  
         l = len(m)  
         for name,url,thumb in m:  
                 listitem = xbmcgui.ListItem(label = name, iconImage = 'DefaultFolder.png', thumbnailImage = thumb)  
                 u = sys.argv[0] + "?mode=50&name=" + urllib.quote_plus(name) + "&url=" + urllib.quote_plus(url)  
                 ok = xbmcplugin.addDirectoryItem(handle = int(sys.argv[1]), url = u, listitem = listitem, isFolder = False, totalItems = l)  
         xbmcplugin.endOfDirectory(int(sys.argv[1]))  
64    
65    
66    
# Line 80  def play_video(url, name): Line 76  def play_video(url, name):
76          xbmc.Player(xbmc.PLAYER_CORE_AUTO).play(str(url), listitem)          xbmc.Player(xbmc.PLAYER_CORE_AUTO).play(str(url), listitem)
77          xbmc.sleep(200)          xbmc.sleep(200)
78    
79    def search():
80            search = getUserInput("Todic Søgning")
81    
82            if (search != None and search != ""):
83                    url = __backend__ + "&action=search&search=" + urllib.quote_plus(search)
84    
85                    #print "[TODIC] Search start: " + search
86                    #print "[TODIC] Search url: " + url
87    
88                    buildList(url, "søgning")
89    
90            
91    
92    
93                    
94    #=================================== Tool Box =======================================
95    # shows a more userfriendly notification
96    def showMessage(heading, message):
97            duration = 15*1000
98            xbmc.executebuiltin('XBMC.Notification("%s", "%s", %s)' % ( heading, message, duration) )
99    
100    
101    # raise a keyboard for user input
102    def getUserInput(title = "Input", default="", hidden=False):
103            result = None
104    
105            # Fix for when this functions is called with default=None
106            if not default:
107                    default = ""
108                            
109            keyboard = xbmc.Keyboard(default, title)
110            keyboard.setHiddenInput(hidden)
111            keyboard.doModal()
112                    
113            if keyboard.isConfirmed():
114                    result = keyboard.getText()
115                    
116            return result
117    
118    
119  def get_params():  def get_params():
120          param=[]          param=[]
# Line 130  elif mode == 1: Line 165  elif mode == 1:
165          #build list of movie starting letters          #build list of movie starting letters
166          buildList(url, name)          buildList(url, name)
167    
168  elif mode == 2:  elif mode == 10:
169          #build list of series                  search()
170          buildSubList(url, name)          
171    
172  elif mode == 50:  elif mode == 50:
173          play_video(url, name)          play_video(url, name)
174    
175    
176    
177  xbmcplugin.endOfDirectory(int(sys.argv[1]))  # xbmcplugin.endOfDirectory(int(sys.argv[1]))
178    

Legend:
Removed from v.1630  
changed lines
  Added in v.1646

  ViewVC Help
Powered by ViewVC 1.1.20