]> git.nbdom.net Git - plugin.video.news.nbdom.net.git/commitdiff
addon.py
authorNicolas Boisselier <nicolas.boisselier@gmail.com>
Wed, 10 Jul 2019 05:01:10 +0000 (06:01 +0100)
committerNicolas Boisselier <nicolas.boisselier@gmail.com>
Wed, 10 Jul 2019 05:01:10 +0000 (06:01 +0100)
addon.py

index 5abd6a801bcee353ed8471c2ddacbe08642743df..d0adf4f7bfd538a6cf2bc0d259325190a9f3d4cc 100644 (file)
--- a/addon.py
+++ b/addon.py
@@ -119,11 +119,12 @@ def index():
        # NB 22.04.19   __fanart__ = addon.getAddonInfo('fanart')
                fanart = addon.getAddonInfo('fanart')
                addon_handle = int(sys.argv[1])
-               xbmcplugin.setContent(addon_handle, 'movies')
                sys.stderr = open(os.devnull, "w")
 
        content = getUrl('https://news.nbdom.net/videos/kodi/')
+       defaultImage = 'DefaultVideo.png'
        list = []
+       #list.append(['url',xbmcgui.ListItem('Hello'),True])
        for row in json.loads(content):
                #row['link'] = ytUrl(row['id'])
                #row['link'] = resolve_url(row['link'])
@@ -147,25 +148,10 @@ def index():
 
                if 'id' in row:
                        info['link'] = 'plugin://plugin.video.youtube/play/?video_id='+row['id']
-                       #row['premiered']
-
-               if TEST:
-                       print(info)
-# NB 03.07.19                  print('\t'.join([
-# NB 03.07.19                          row['lang'],
-# NB 03.07.19                          row['title'],
-# NB 03.07.19                          row['description'],
-# NB 03.07.19                          row['id'],
-# NB 03.07.19                          row['link'],
-# NB 03.07.19                  ]))
-# NB 03.07.19                  break
-               else:
                        # * default
                        # * mqdefault
                        # * hqdefault
                        # * sddefault
-
-                       defaultImage = 'DefaultVideo.png'
                        iconurl = 'https://i1.ytimg.com/vi/' + row['id']
                        size1Image = iconurl + '/default.jpg'
                        size21Image = iconurl + '/mqdefault.jpg'
@@ -174,6 +160,17 @@ def index():
                        thumbnailImage = iconurl + '/mqdefault.jpg'
                        label = row['title'] +' - ' + row['description']
 
+               if TEST:
+                       print(info)
+               else:
+
+# NB 10.07.19                  info['thumb'] = size3Image
+# NB 10.07.19                  info['poster'] = size3Image
+# NB 10.07.19                  info['banner'] = size21Image
+# NB 10.07.19                  info['fanart'] = size4Image
+# NB 10.07.19                  info['clearart'] = fanart
+# NB 10.07.19                  info['clearlogo'] = fanart
+# NB 10.07.19                  info['landscape'] = fanart
                        if 0:
                                info['plot'] = 'plot: '+info['plot']
                                info['tvshowtitle'] = 'tvshowtitle: '+info['title']
@@ -183,32 +180,34 @@ def index():
                                info['plotoutline'] = 'plotoutline: '+info['plotoutline']
                                label = 'label: '+label
 
-                       li = xbmcgui.ListItem(label, iconImage=defaultImage)#, thumbnailImage=size1Image)
-                       #row['link'] = build_url({'mode' :'play', 'playlink' : row['link']})
+                       li = xbmcgui.ListItem(label,
+                               iconImage=size4Image,
+                               thumbnailImage=size3Image,
+                       )
                        #li.setProperty('IsPlayable' , 'true')
                        li.setInfo('video', infoLabels=info)
-                       li.setArt({
-                               'thumb': size3Image,
-                               'poster': size3Image,
-                               'banner': size21Image,
-                               'fanart': size4Image,
-                               'clearart': fanart,
-                               'clearlogo': fanart,
-                               'landscape': fanart,
-                       })
+# NB 10.07.19                  li.setArt({
+# NB 10.07.19                          'thumb': size3Image,
+# NB 10.07.19                          'poster': size3Image,
+# NB 10.07.19                          'banner': size21Image,
+# NB 10.07.19                          'fanart': size4Image,
+# NB 10.07.19                          'clearart': fanart,
+# NB 10.07.19                          'clearlogo': fanart,
+# NB 10.07.19                          'landscape': fanart,
+# NB 10.07.19                  })
                        #li.setLabel('setLabel')
                        #li.setLabel2('setLabel2')
-                       #li.setThumbnailImage(thumbnailImage)
+                       #li.setThumbnailImage(size4Image)
+                       #li.setProperty('fanart_image',size4Image)
 
+                       #li.addContextMenuItems([('Context', 'XBMC.RunScript()',),])
                        list.append([info['link'],li])
                        # NB 04.07.19: Use xbmcplugin.addDirectoryItems, suppose to be faster 
                        #xbmcplugin.addDirectoryItem(handle=addon_handle,url=info['link'],listitem=li)
 
-       # NB 17.04.19 url = 'https://nbdom.net/data/en/911-experiments-The_Force_Behind_the_Motion.mp4'
-       # NB 17.04.19 li = xbmcgui.ListItem('My First Video!', iconImage='DefaultVideo.png')
-       # NB 17.04.19 xbmcplugin.addDirectoryItem(handle=addon_handle, url=url, listitem=li)
-
        if not TEST:
+               xbmcplugin.setContent(addon_handle, 'movies')
+               #xbmcplugin.addDirectoryItem(addon_handle,'',xbmcgui.ListItem('Hello', defaultImage),True)
                xbmcplugin.addDirectoryItems(addon_handle,list,len(list))
                xbmcplugin.endOfDirectory(addon_handle)