def run(self): self.progressed("Logging into oagd.net...") if not app.settings["device_id"]: app.settings["device_id"] = str(uuid4()) try: result = self.client.auth(self.username, self.password, app.settings["device_id"], get_device_name()) except UnauthorizedError: raise Task.Failure("Wrong e-mail address or password") app.settings["database_username"] = result["username"] app.settings["database_email"] = result["email"] app.settings["database_auth"] = result["auth_token"] app.settings["database_password"] = ""
def run(self): self.progressed("Logging into openretro.org...") if not Settings.instance()["device_id"]: Settings.instance()["device_id"] = str(uuid4()) try: result = self.client.authorize( self.username, self.password, Settings.instance()["device_id"], get_device_name(), ) except UnauthorizedError: raise Task.Failure("Wrong e-mail address or password") Settings.instance()["database_username"] = result["username"] Settings.instance()["database_email"] = result["email"] Settings.instance()["database_auth"] = result["auth_token"] Settings.instance()["database_password"] = ""
def upload_check(self, prefix): self.progressed( gettext("Finding files eligible for OpenRetro Locker") + " ({:0.0%})".format((prefix / 16.0))) file_database = FileDatabase.instance() cursor = file_database.cursor() # FIXME: prefix p = "0123456789ABCDEF"[prefix] cursor.execute( "SELECT DISTINCT sha1 FROM file " "WHERE hex(sha1) LIKE ?", (p + "%", ), ) string_io = StringIO() for row in cursor: string_io.write(row[0]) # print(prefix, len(string_io.getvalue())) self.stop_check() retry_seconds = 1 while True: try: result = self.client.post("/api/locker-upload-check", data=string_io.getvalue()) except OGDClient.ForbiddenError: raise Task.Failure( gettext("OpenRetro Locker is not enabled for your user. " "It may be available only to a few select beta " "users.")) except OGDClient.NonRetryableHTTPError as e: raise e except Exception: traceback.print_exc() self.progressed( gettext("Re-trying in {0} seconds...").format( retry_seconds)) for _ in range(retry_seconds): self.stop_check() time.sleep(1.0) retry_seconds = min(retry_seconds * 2, 60 * 10) else: return result
def __init__(self, client, username, password): Task.__init__(self, "Login Task") self.client = client self.username = username self.password = password
def __init__(self, url): Task.__init__(self, "DownloadTermsTask") self.url = url self.data = None
def __init__(self): Task.__init__(self, "RescanTask")
def __init__(self): Task.__init__(self, "Locker Uploader Task") self.client = OGDClient()
def __init__(self, driver): Task.__init__(self, "RunnerTask") self.driver = driver
def __init__(self, launch_handler): Task.__init__(self, "Amiga Launch Task") self.launch_handler = launch_handler
def __init__(self, runner): Task.__init__(self, "Runner Task") self.runner = runner
def __init__(self): Task.__init__(self, "DatabaseRefreshTask")
def __init__(self, client, auth_token): Task.__init__(self, "Logout Task") self.client = client self.auth_token = auth_token
def __init__(self): Task.__init__(self, gettext("Defragment Databases"))