def __init__(self, destination, processor_id): self.api = mega.MegaApi('vIJE2YwK') self.destination = destination self.event = threading.Event() self.log = logging.getLogger('processor') self.status = ProcessorStatus.IDLE self.processor_id = processor_id self._updates = queue.Queue() self.current_file_id = None self._files: typing.List[NodeWrapper] = []
class DownloadProcessor(multiprocessing.Process): super().__init__(name='DownloadQueueProcessor', daemon=False) self.api = mega.MegaApi('vIJE2YwK') self.destination = destination self.event = threading.Event() self.log = logging.getLogger('processor') self.status = ProcessorStatus.IDLE self.processor_id = processor_id self._updates = queue.Queue() self.current_file_id = None self._files: typing.List[NodeWrapper] = []
def one_shot(url, dest): os.makedirs(dest, exist_ok=True) api = mega.MegaApi(MEGA_API_KEY) processor = UrlProcessor(api) file_nodes = processor.process(url) processor = FileNodeDownloader(api) for fname, file_node in file_nodes: fname = os.path.join(dest, fname) file_listener = FileListener() processor.download(fname, file_node, file_listener) file_listener.wait()
import mega api = mega.MegaApi('test') print(dir(api))
def main(): api = mega.MegaApi("test") pprint.pprint(dir(api))