Beispiel #1
0
    def select(self):
        logger.debug()
        self.PROGRESS.setVisible(False)
        items = []
        if self.persons:
            tmdb_info = tmdb.discovery(self.item, dict_=self.item.discovery)
            results = tmdb_info.results.get('cast',[])
        else:
            tmdb_info = tmdb.Tmdb(texto_buscado=self.item.text, tipo=self.item.mode.replace('show', ''))
            results = tmdb_info.results

        for result in results:
            result = tmdb_info.get_infoLabels(result, origen=result)
            movie = result.get('title','')
            tvshow = result.get('name','')
            title = tvshow if tvshow else movie
            result['mode'] = 'tvshow' if tvshow else 'movie'
            self.find.append(result)
            thumb = 'Infoplus/' + result['mode'].replace('show','') + '.png'
            it = xbmcgui.ListItem(title)
            it.setProperty('thumb', result.get('thumbnail', thumb))
            it.setProperty('fanart', result.get('fanart',''))
            it.setProperty('plot', result.get('overview', ''))
            it.setProperty('search','search')
            items.append(it)

        if items:
            self.RESULTS.reset()
            self.RESULTS.addItems(items)
            self.setFocusId(RESULTS)
        else:
            self.NORESULTS.setVisible(True)
Beispiel #2
0
    def select(self):
        logger.debug()
        self.PROGRESS.setVisible(False)
        self.items = []
        if self.item.mode == 'person_':
            tmdb_info = tmdb.discovery(self.item, dict_=self.item.discovery)
            results = tmdb_info.results.get('cast',[])
        else:
            tmdb_info = tmdb.Tmdb(searched_text=self.item.text, search_type=self.item.mode.replace('show', ''))
            results = tmdb_info.results

        for result in results:
            result = tmdb_info.get_infoLabels(result, origen=result)
            if self.item.mode == 'movie':
                title = result['title']
                result['mode'] = 'movie'
            elif self.item.mode == 'tvshow':
                title = result['name']
                result['mode'] = 'tvshow'
            else:
                title = result.get('title', '')
                result['mode'] = result['media_type'].replace('tv', 'tvshow')

            thumbnail = result.get('thumbnail', '')
            noThumb = 'Infoplus/' + result['mode'].replace('show','') + '.png'
            fanart = result.get('fanart', '')
            year = result.get('release_date', '')
            rating = str(result.get('vote_average', ''))

            new_item = Item(channel='globalsearch',
                            action="Search",
                            title=title,
                            thumbnail=thumbnail,
                            fanart=fanart,
                            mode='search',
                            type=result['mode'],
                            contentType=result['mode'],
                            text=title,
                            infoLabels=result)

            if self.item.mode == 'movie':
                new_item.contentTitle = result['title']
            else:
                new_item.contentSerieName = result['name']

            it = xbmcgui.ListItem(title)
            it.setProperties({'thumb': result.get('thumbnail', noThumb), 'fanart': result.get('fanart', ''), 'rating': '    [' + rating + ']' if rating else '',
                              'plot': result.get('overview', ''), 'search': 'search', 'release_date': '', 'item': new_item.tourl(),
                              'year': '   [' + year.split('/')[-1] + ']' if year else '    [' + result.get('first_air_date','').split('-')[0] + ']'})
            self.items.append(it)

        if self.items:
            self.RESULTS.reset()
            self.RESULTS.addItems(self.items)
            self.setFocusId(RESULTS)
        else:
            self.RESULTS.setVisible(False)
            self.NORESULTS.setVisible(True)
            self.setFocusId(CLOSE)
Beispiel #3
0
    def actors(self):
        logger.debug()
        self.PROGRESS.setVisible(False)
        items = []

        dict_ = {'url': 'search/person', 'language': def_lang, 'query': self.item.text, 'page':self.page}
        prof = {'Acting': 'Actor', 'Directing': 'Director', 'Production': 'Productor'}
        plot = ''
        self.item.search_type = 'person'
        tmdb_inf = tmdb.discovery(self.item, dict_=dict_)
        results = tmdb_inf.results

        for elem in results:
            name = elem.get('name', '')
            if not name: continue
            rol = elem.get('known_for_department', '')
            rol = prof.get(rol, rol)
            know_for = elem.get('known_for', '')
            cast_id = elem.get('id', '')
            if know_for:
                t_k = know_for[0].get('title', '')
                if t_k: plot = '%s in %s' % (rol, t_k)

            t = elem.get('profile_path', '')
            if t: thumb = 'https://image.tmdb.org/t/p/original' + t
            else : thumb = 'Infoplus/no_photo.png'

            discovery = {'url': 'person/%s/combined_credits' % cast_id, 'page': '1', 'sort_by': 'primary_release_date.desc', 'language': def_lang}
            self.persons.append(discovery)

            new_item = Item(channel='globalsearch',
                            action="Search",
                            title=name,
                            thumbnail=thumb,
                            mode='search')

            it = xbmcgui.ListItem(name)
            it.setProperties({'thumb': thumb, 'plot': plot, 'search': 'persons', 'item': new_item.tourl()})
            items.append(it)
        if len(results) > 19:
            it = xbmcgui.ListItem(config.get_localized_string(70006))
            it.setProperty('thumb', 'Infoplus/next_focus.png')
            it.setProperty('search','next')
            items.append(it)
        if self.page > 1:
            it = xbmcgui.ListItem(config.get_localized_string(70005))
            it.setProperty('thumb', 'Infoplus/previous_focus.png')
            it.setProperty('search','previous')
            items.insert(0, it)

        if items:
            self.RESULTS.reset()
            self.RESULTS.addItems(items)
            self.setFocusId(RESULTS)
        else:
            self.RESULTS.setVisible(False)
            self.NORESULTS.setVisible(True)
            self.setFocusId(CLOSE)