コード例 #1
0
ファイル: addon.py プロジェクト: hestan/plugin.video.mytv_bg
    def add_items(self, iterable, is_update=False, sort_method_ids=[],
                  override_view_mode=False):
        items = []
        urls = []
        for i, li_info in enumerate(iterable):
            
            items.append( 
                self._make_listitem(**li_info)
            )

            if self._mode in ['crawl', 'interactive']:
                print '[%d] %s%s%s (%s)' % (i + 1, '', li_info.get('label'),
                                            '', li_info.get('url'))
                urls.append(li_info.get('url'))

        if self._mode is 'xbmc':
            if override_view_mode:
                skin = xbmc.getSkinDir()
                thumbnail_view = THUMBNAIL_VIEW_IDS.get(skin)
                if thumbnail_view:
                    cmd = 'Container.SetViewMode(%s)' % thumbnail_view
                    xbmc.executebuiltin(cmd)
            xbmcplugin.addDirectoryItems(self.handle, items, len(items))
            for id in sort_method_ids:
                xbmcplugin.addSortMethod(self.handle, id)
            xbmcplugin.endOfDirectory(self.handle, updateListing=is_update)

        return urls
コード例 #2
0
ファイル: addon.py プロジェクト: svn2github/xbmc4xbox_addons
 def add_items(self,
               iterable,
               is_update=False,
               sort_method_ids=[],
               override_view_mode=False):
     items = []
     urls = []
     for i, li_info in enumerate(iterable):
         items.append(self._make_listitem(**li_info))
         if self._mode in ['crawl', 'interactive', 'test']:
             print '[%d] %s%s%s (%s)' % (i + 1, '', li_info.get('label'),
                                         '', li_info.get('url'))
             urls.append(li_info.get('url'))
     if self._mode is 'xbmc':
         if override_view_mode:
             skin = xbmc.getSkinDir()
             thumbnail_view = THUMBNAIL_VIEW_IDS.get(skin)
             if thumbnail_view:
                 cmd = 'Container.SetViewMode(%s)' % thumbnail_view
                 xbmc.executebuiltin(cmd)
         xbmcplugin.addDirectoryItems(self.handle, items, len(items))
         for id in sort_method_ids:
             xbmcplugin.addSortMethod(self.handle, id)
         xbmcplugin.endOfDirectory(self.handle, updateListing=is_update)
     return urls
コード例 #3
0
ファイル: addon.py プロジェクト: vladas/plugin.video.wimp
 def add_items(self, iterable, sort_method_ids=[]):
     items = []
     urls = []
     for i, li_info in enumerate(iterable):
         items.append(self._make_listitem(**li_info))
         if self._mode in ['crawl', 'interactive', 'test']:
             print '[%d] %s%s%s (%s)' % (i + 1, '', li_info.get('label'),
                                         '', li_info.get('url'))
             urls.append(li_info.get('url'))
     if self._mode is 'xbmc':
         xbmcplugin.addDirectoryItems(self.handle, items, len(items))
         for id in sort_method_ids:
             xbmcplugin.addSortMethod(self.handle, id)
         xbmcplugin.endOfDirectory(self.handle, cacheToDisc=False)
     return urls
コード例 #4
0
ファイル: addon.py プロジェクト: svn2github/xbmc4xbox_addons
 def add_items(self, iterable, sort_method_ids=[]):
     items = []
     urls = []
     for i, li_info in enumerate(iterable):
         items.append(self._make_listitem(**li_info))
         if self._mode in ['crawl', 'interactive', 'test']:
             print '[%d] %s%s%s (%s)' % (i + 1, '', li_info.get('label'),
                                         '', li_info.get('url'))
             urls.append(li_info.get('url'))
     if self._mode is 'xbmc':
         xbmcplugin.addDirectoryItems(self.handle, items, len(items))
         for id in sort_method_ids:
             xbmcplugin.addSortMethod(self.handle, id)
         xbmcplugin.endOfDirectory(self.handle, cacheToDisc=False)
     return urls
コード例 #5
0
ファイル: plugin.py プロジェクト: jbeluch/xbmcswift
    def add_items(self, iterable, view_mode=None):
        # If we are in debug mode, do not make the call to xbmc
        # for each item
        #   if in debug mode, print it to command line
        #   make a list item
        #   if, set is_playable
        #   if, set context_menu
        #   append to new list
        #
        #   add the items
        #   call end of directory
        #   return the urls of each of the items

        #items = [self._make_list_item(**li_info) for li_info in iterable]

        items = [] # Keeps track of the list of tuples (url, list_item, is_folder) to pass to xbmcplugin.addDirectoryItems
        urls = [] # Keeps track of the XBMC urls for all of the list items
        for i, li_info in enumerate(iterable):
            items.append(self._make_listitem(**li_info))
            if self._mode in ['crawl', 'interactive', 'test']:
                #print '[%d] %s%s%s (%s)' % (i + 1, C.blue, li_info.get('label'), C.end, li_info.get('url'))
                print '[%d] %s%s%s (%s)' % (i + 1, '', li_info.get('label'), '', li_info.get('url'))
                urls.append(li_info.get('url'))

        if self._mode is 'xbmc':
            if not xbmcplugin.addDirectoryItems(self.handle, items, len(items)):
                raise Exception, 'problem?'
            if view_mode:
                xbmc.executebuiltin('Container.SetViewMode(%s)' % view_mode)
            xbmcplugin.endOfDirectory(self.handle)

        return urls
コード例 #6
0
ファイル: plugin.py プロジェクト: jbeluch/xbmcswift
    def add_items(self, iterable, view_mode=None):
        # If we are in debug mode, do not make the call to xbmc
        # for each item
        #   if in debug mode, print it to command line
        #   make a list item
        #   if, set is_playable
        #   if, set context_menu
        #   append to new list
        #
        #   add the items
        #   call end of directory
        #   return the urls of each of the items

        #items = [self._make_list_item(**li_info) for li_info in iterable]

        items = [
        ]  # Keeps track of the list of tuples (url, list_item, is_folder) to pass to xbmcplugin.addDirectoryItems
        urls = []  # Keeps track of the XBMC urls for all of the list items
        for i, li_info in enumerate(iterable):
            items.append(self._make_listitem(**li_info))
            if self._mode in ['crawl', 'interactive', 'test']:
                #print '[%d] %s%s%s (%s)' % (i + 1, C.blue, li_info.get('label'), C.end, li_info.get('url'))
                print '[%d] %s%s%s (%s)' % (i + 1, '', li_info.get('label'),
                                            '', li_info.get('url'))
                urls.append(li_info.get('url'))

        if self._mode is 'xbmc':
            if not xbmcplugin.addDirectoryItems(self.handle, items,
                                                len(items)):
                raise Exception, 'problem?'
            if view_mode:
                xbmc.executebuiltin('Container.SetViewMode(%s)' % view_mode)
            xbmcplugin.endOfDirectory(self.handle)

        return urls
コード例 #7
0
 def add_items(self, iterable, view_mode=None, is_update=False,
               sort_method_ids=[]):
     items = []
     urls = []
     for i, li_info in enumerate(iterable):
         items.append(self._make_listitem(**li_info))
         if self._mode in ['crawl', 'interactive', 'test']:
             print '[%d] %s%s%s (%s)' % (i + 1, '', li_info.get('label'),
                                         '', li_info.get('url'))
             urls.append(li_info.get('url'))
     if self._mode is 'xbmc':
         if view_mode:
             xbmc.executebuiltin('Container.SetViewMode(%s)' % view_mode)
         xbmcplugin.addDirectoryItems(self.handle, items, len(items))
         for id in sort_method_ids:
             xbmcplugin.addSortMethod(self.handle, id)
         xbmcplugin.endOfDirectory(self.handle, updateListing=is_update)
     return urls
コード例 #8
0
 def add_items(self, iterable, is_update=False, sort_method_ids=[],
               override_view_mode=False):
     items = []
     urls = []
     for i, li_info in enumerate(iterable):
         items.append(self._make_listitem(**li_info))
         if self._mode in ['crawl', 'interactive', 'test']:
             print '[%d] %s%s%s (%s)' % (i + 1, '', li_info.get('label'),
                                         '', li_info.get('url'))
             urls.append(li_info.get('url'))
     if self._mode is 'xbmc':
         self.set_content('movies')
         xbmcplugin.addDirectoryItems(self.handle, items, len(items))
         for id in sort_method_ids:
             xbmcplugin.addSortMethod(self.handle, id)
         if override_view_mode:
             if xbmc.getSkinDir() == 'skin.confluence':
                 xbmc.executebuiltin('Container.SetViewMode(504)')
         xbmcplugin.endOfDirectory(self.handle, updateListing=is_update)
     return urls
コード例 #9
0
 def add_items(self, iterable, is_update=False, sort_method_ids=[], override_view_mode=True):
     items = []
     urls = []
     for i, li_info in enumerate(iterable):
         items.append(self._make_listitem(**li_info))
         if self._mode in ["crawl", "interactive", "test"]:
             print "[%d] %s%s%s (%s)" % (i + 1, "", li_info.get("label"), "", li_info.get("url"))
             urls.append(li_info.get("url"))
     if self._mode is "xbmc":
         if override_view_mode:
             skin = xbmc.getSkinDir()
             thumbnail_view = THUMBNAIL_VIEW_IDS.get(skin)
             if thumbnail_view:
                 cmd = "Container.SetViewMode(%s)" % thumbnail_view
                 xbmc.executebuiltin(cmd)
         xbmcplugin.addDirectoryItems(self.handle, items, len(items))
         for id in sort_method_ids:
             xbmcplugin.addSortMethod(self.handle, id)
         xbmcplugin.endOfDirectory(self.handle, updateListing=is_update)
     return urls