def get_metainfo(self, torrent_path, seeder=False): """ (1) Create an empty resource object (2) call the method parse_metainfo() from that object which must return all the fields and values from the metainfo file, including the hashes from the file pieces. :param torrent_path: :return: the metainfo """ # should resource_id be a random number?... ma_map = Resource.parse_metainfo(torrent_path) resource = Resource(resource_id=ma_map["file_name"], file_path=ma_map["path"], file_len=ma_map["file_len"], piece_len=ma_map["piece_len"], pieces_hash=ma_map["pieces"], seed=seeder) resource.add_tracker(ma_map["tracker_ip_address"], ma_map["tracker_port"]) return resource