import asyncio
from .functions05 import Configs
from ..exceptions import Qbitorcancel
#===================================================================

class TEngine:

    async def get01(cli, hid):
        moonus = cli.torrents_info(torrent_hashes=hid)[0]
        return moonus

#===================================================================

    async def get02(imog, cli, cid, hid):
        while True: #wait_for_metadata
            if cid not in Configs.DATA06:
                raise Qbitorcancel
            await asyncio.sleep(1)
            files = cli.torrents_files(torrent_hash=hid)
            if files:
                return files

#===================================================================

    async def get03(cid):
        append.Configs.DATA07(cid)
        while True:
            if cid not in Configs.DATA07:
                break

#===================================================================
