Пример #1
0
 def _add_next_page_link(self, list_type='mediaList'):
     if self.has_next_page:
         pages = self.links[-1]#.find_all('a')			
         for link in pages:		
             next_link = '/%s' % link["href"]
             #helper.show_error_dialog(['',str(link["href"])])	
             query = self._construct_query(next_link, list_type)
             helper.add_directory(query, {'title': 'Next'})
Пример #2
0
 def add_directories(self, src):
     helper.start('LocalList.add_directories')
     helper.set_content('addons')
     for (name, query) in src:
         icon = query.get('icon', '')
         fanart = query.get('fanart', '')
         helper.add_directory(query,
                              infolabels={'title': name},
                              img=icon,
                              fanart=fanart,
                              total_items=len(src))
     helper.end_of_directory()
     helper.end('LocalList.add_directories')
     return
Пример #3
0
    def add_items(self, title_prefix=None):
        helper.start('MediaList.add_items')
        timestamper = t_s.TimeStamper('MediaList.add_items')
        end_dir = (title_prefix == None)
        title_prefix = title_prefix if title_prefix else ''
        if end_dir:
            helper.set_content('tvshows')
        mlinks = self.links[:-1] if self.has_next_page else self.links
        #helper.show_error_dialog(['',str(self.links)])
        # Grabbing metadata is a huge bottleneck, so grabbing it in parallel speeds up things
        self.links_with_metadata = [None] * len(mlinks)
        if helper.debug_metadata_threads():
            map(lambda x: self.worker(x), enumerate(mlinks))#mc_links)		
        else:
            #pool = threadpool.ThreadPool(4)
            #pool.map(self.worker, enumerate(mlinks))
            #pool.wait_completion()
            #helper.show_error_dialog(['',str(mlinks[0])])			
            #helper.show_error_dialog(['',str(self.media_type_list)])		
            pool = ThreadPool(8) # Sets the pool size to 4			
            pool.map(self.worker, enumerate(mlinks))
            pool.close() 
            pool.join() 			
						
        timestamper.stamp('Grabbing metadata with threads')
        #helper.show_error_dialog(['',str(self.links_with_metadata)])

        try:		
            for (name, url, metadata, media_type) in self.links_with_metadata:
                icon, fanart = self._get_art_from_metadata(metadata)
                query = self._construct_query(url, 'episodeList', metadata, name, media_type)		
                contextmenu_items = self._get_contextmenu_items(url, name, metadata, media_type)
                metadata['title'] = title_prefix + name # adjust title for sub and dub
                helper.add_directory(query, metadata, img=icon, fanart=fanart, contextmenu_items=contextmenu_items, total_items=len(mlinks))
        except: pass
        self._add_next_page_link()

        if end_dir:
            helper.end_of_directory()
        timestamper.stamp_and_dump('Adding all items')
        helper.end('MediaList.add_items')
    def add_items(self):
        helper.start('SpecialsList.add_items')
        helper.set_content('episodes')

        icon, fanart = self._get_art_for_season0()

        for link in self.links:
            num = link.string.strip()
            url = link['href']
            metadata = self.get_metadata(args.base_title + ' - ' + num)
            query = self._construct_query(url, 'qualityPlayer', metadata)
            helper.add_directory(
                query,
                metadata,
                img=args.icon,
                fanart=args.fanart,
                contextmenu_items=self._get_contextmenu_items())

        self._add_related_links()

        helper.end_of_directory()
        helper.end('SpecialsList.add_items')
        return
Пример #5
0
    def _find_next_page_link(self):        
        paging_section = self.soup.find_all('div', class_='paging')
        if paging_section != None:
            if (self.list_type == 'all'): 
                sec = 0
            elif (self.list_type == 'watching'): 
                sec = 1	
            elif (self.list_type == 'watched'): 
                sec = 2	
            elif (self.list_type == 'onhold'): 
                sec = 3	
            elif (self.list_type == 'dropped'): 
                sec = 4	
            elif (self.list_type == 'planned'): 
                sec = 5					
            #helper.show_error_dialog(['',str(paging_section[2])])           
            pages = paging_section[sec].find_all('a')
            for link in pages:		
            #helper.show_error_dialog(['',pages[0].get_text()])	
                    next_link = '/%s' % link["href"]
                    query = self._construct_query(next_link,'watchList')
                    helper.add_directory(query, {'title': link.get_text()})