def _build_regex(self):
     self.episode_regex = source_utils.get_filter_single_episode_fn(
         self.simple_show_info)
     self.show_regex = source_utils.get_filter_show_pack_fn(
         self.simple_show_info)
     self.season_regex = source_utils.get_filter_season_pack_fn(
         self.simple_show_info)
Example #2
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)
 def _generate_regex(self):
     self.regex = source_utils.get_filter_single_episode_fn(
         self.simple_show_info)