Example #1
0
 def _finalize_resolving(self, item_information, torrent, identified_file, folder_details):
     if identified_file is None:
         return None
     stream_link = self.resolve_stream_url(identified_file)
     self._do_post_processing(item_information, torrent)
     if not stream_link:
         raise FileIdentification([i["path"] for i in folder_details])
     return stream_link
Example #2
0
    def _movie_resolve(self, item_information, torrent):
        simple_info = {
            "year": item_information.get("info", {}).get("year"),
            "title": item_information.get("info").get("title"),
            }

        folder_details = self._sort_and_filter_files(
            self._normalize_item(self._fetch_source_files(torrent, item_information)), item_information, True
            )

        if self.pack_select:
            return self._finalize_resolving(
                item_information,
                torrent,
                self._user_selection(folder_details),
                folder_details,
                )

        m2ts_check = self._try_m2ts_resolving(folder_details)
        if m2ts_check:
            return self._finalize_resolving(
                item_information, torrent, folder_details[0], [m2ts_check]
                )

        if len(folder_details) == 1:
            return self._finalize_resolving(
                item_information, torrent, folder_details[0], folder_details
                )

        folder_details = source_utils.filter_files_for_resolving(
            folder_details, item_information
            )
        filter_list = [
            i
            for i in folder_details
            if source_utils.filter_movie_title(
                None,
                i["path"].split("/")[-1],
                item_information["info"]["originaltitle"],
                simple_info,
                )
            ]
        if len(filter_list) == 1:
            return self._finalize_resolving(
                item_information, torrent, filter_list[0], folder_details
                )

        raise FileIdentification([i["path"] for i in folder_details])
Example #3
0
 def _get_files_from_check_hash(self, torrent, item_information):
     hash_check = self.debrid_module.check_hash(
         torrent["hash"])[torrent["hash"]]["rd"]
     try:
         hash_check = [
             storage_variant for storage_variant in hash_check if
             self.debrid_module.is_streamable_storage_type(storage_variant)
         ]
     except IndexError:
         raise FileIdentification(hash_check)
     if self.media_type == "episode":
         hash_check = [
             i for i in hash_check if get_best_episode_match(
                 "filename", i.values(), item_information)
         ][0]
     else:
         hash_check = hash_check[0]
     [value.update({"idx": key}) for key, value in hash_check.items()]
     return hash_check.values()