Exemplo n.º 1
0
    def _identify_items(self, cloud_items):
        sources = []

        if self.media_type == 'episode':
            for item in cloud_items:
                release_title = source_utils.clean_title(item["release_title"])
                if self.episode_regex(release_title) or \
                        self.show_regex(release_title) or \
                        self.season_regex(release_title):
                    sources.append(item)

        else:
            simple_info = {
                'year': self.item_information.get('info', {}).get('year'),
                'title': self.item_information.get('info').get('title')
            }
            for item in cloud_items:
                if source_utils.filter_movie_title(
                        None, source_utils.clean_title(item['release_title']),
                        self.item_information['info']['title'], simple_info):
                    sources.append(item)

            return sources

        return sources
Exemplo n.º 2
0
    def _build_simple_show_info(info):
        simple_info = {
            'show_title': info['info'].get('tvshowtitle', ''),
            'episode_title': info['info'].get('originaltitle', ''),
            'year': str(info['info'].get('year', '')),
            'season_number': str(info['info']['season']),
            'episode_number': str(info['info']['episode']),
            'show_aliases': info['info'].get('aliases', []),
            'country': info['info'].get('country_origin', ''),
            'no_seasons': str(info.get('season_count', '')),
            'absolute_number': str(info.get('absoluteNumber', '')),
            'is_airing': info.get('is_airing', False),
            'no_episodes': str(info.get('episode_count', '')),
            'isanime': False
        }

        if '.' in simple_info['show_title']:
            simple_info['show_aliases'].append(
                source_utils.clean_title(simple_info['show_title'].replace(
                    '.', '')))
        if any(x in i.lower() for i in info['info'].get('genre', [''])
               for x in ['anime', 'animation']):
            simple_info['isanime'] = True

        return simple_info
Exemplo n.º 3
0
    def _get_local_torrent_results(self):

        local_storage = self.torrent_cache.get_torrents(self.item_information)[:100]

        relevant_torrents = []

        if self.media_type == 'episode':
            torrent_simple_info = self._build_simple_show_info(self.item_information)
            episode_regex = source_utils.get_filter_single_episode_fn(torrent_simple_info)
            show_regex = source_utils.get_filter_show_pack_fn(torrent_simple_info)
            season_regex = source_utils.get_filter_season_pack_fn(torrent_simple_info)

            for torrent in local_storage:
                clean_title = source_utils.clean_title(torrent['release_title'])
                if episode_regex(clean_title) or season_regex(clean_title) or show_regex(clean_title):
                    relevant_torrents.append(torrent)
        else:
            relevant_torrents = local_storage

        if len(relevant_torrents) > 0:
            for torrent in relevant_torrents:
                torrent['provider'] = '{} (Local Cache)'.format(torrent['provider'])

                self.sources_information["allTorrents"].update({torrent['hash']: torrent})

            TorrentCacheCheck(self).torrent_cache_check(relevant_torrents, self.item_information)
Exemplo n.º 4
0
    def _build_hoster_variables(self, info, media_type):

        info = copy.deepcopy(info)

        if media_type == 'tvshow':
            imdb = info['info'].get('imdb_id')
            tvdb = info['info'].get('tvdb_id')
            title = info['info'].get('tvshowtitle')
            localtitle = ''
            aliases = info['info'].get('aliases', [])
            if '.' in title:
                aliases.append(source_utils.clean_title(title.replace('.',
                                                                      '')))
            year = str(info['info']['year'])
            return imdb, tvdb, title, localtitle, aliases, year

        elif media_type == 'episode':
            imdb = info['info'].get('imdb_id')
            tvdb = info['info'].get('tvdb_id')
            title = info['info'].get('title')
            premiered = info['info'].get('premiered')
            season = str(info['info'].get('season'))
            episode = str(info['info'].get('episode'))
            return imdb, tvdb, title, premiered, season, episode
        elif media_type == 'movie':
            imdb = info['info'].get('imdb_id')
            title = info['info'].get('originaltitle')
            localtitle = info['info'].get('title')
            aliases = info['info'].get('aliases', [])
            year = str(info['info'].get('year'))
            return imdb, title, localtitle, aliases, year
        elif media_type == 'sources':
            hostpr_dict = [
                host[0] for debrid in self.hoster_domains['premium'].values()
                for host in debrid
            ]
            host_dict = self.hoster_domains['free']
            return host_dict, hostpr_dict
Exemplo n.º 5
0
 def _get_clean_title(item):
     return source_utils.clean_title(item.get('release_title', ''))