def get_torrents_data(self, task, config):
        client = QBittorrentClientFactory().get_client(
            config.get('qbittorrent_ressed'))
        task_data = client.get_task_data(id(task))
        torrent_dict = {}
        torrents_hashes = {}
        hashes = []

        for entry in task_data.get('entry_dict').values():
            if 'up' in entry['qbittorrent_state'].lower():
                torrent_dict[entry['torrent_info_hash']] = entry
                hashes.append(entry['torrent_info_hash'])

        list.sort(hashes)
        hashes_json = json.dumps(hashes)
        sha1 = hashlib.sha1(hashes_json.encode("utf-8")).hexdigest()

        torrents_hashes['hash'] = {}
        torrents_hashes['hash']['clients_0'] = hashes_json
        torrents_hashes['sha1'] = []
        torrents_hashes['sha1'].append(sha1)
        torrents_hashes['sign'] = config['iyuu']
        torrents_hashes['version'] = config['version']
        torrents_hashes['timestamp'] = int(time.time())

        return torrent_dict, torrents_hashes
 def create_client(self, config):
     client = QBittorrentClientFactory().get_client(config)
     return client