def delete_last_file(self, device: Device): last_file_result = device.shell(ADBShell_GetLastFileCommand) last_file_result.strip() last_file_full_path = f"{DEFAULT_VIDEO_DIR}/{last_file_result}".strip() self._run_shell( device, f"mv {last_file_full_path} {last_file_full_path}_DISCARDED") print(last_file_full_path)
def perform_cmd(device: Device, command: str, root: bool = False, timeout: int = None): if root: command = "su -c {}".format(command) try: return device.shell(command, timeout=timeout) except: pass return ""
def save_last_file(self, device: Device): last_file_result = device.shell(ADBShell_GetLastFileCommand) last_file_result.strip() last_file_full_path = f"{DEFAULT_VIDEO_DIR}/{last_file_result}".strip() self._run_shell( device, f"{ADBShell_CreateSaveDirCommand} {self.get_save_dir()}") self._run_shell(device, f"cp {last_file_full_path} {self.get_save_dir()}") print(last_file_full_path)
def click(self, device: Device) -> None: device.shell(f"input tap {self.position.x} {self.position.y}") return None
def _run_shell(self, device: Device, shellcmd: str): if self.args.dry_run: print(shellcmd) else: return device.shell(shellcmd)