Skip to content

Commit

Permalink
Fix pull
Browse files Browse the repository at this point in the history
  • Loading branch information
aBozowski committed Oct 20, 2023
1 parent 1239a90 commit a856bf6
Showing 1 changed file with 10 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ def __init__(self, platform: "Android"):
self.screen_pull = False
self.file_counter = 0
self.pull_commands: [str] = []
self.manifest_file = os.path.join(platform.artifact_dir, "screen_manifest.txt")

def check_screen(self) -> bool:
screen_cmd_output = self.platform.run_adb_command(
Expand All @@ -70,9 +71,10 @@ def update_commands(self) -> None:
parent=self.platform.artifact_dir)
self.screen_phone_out_path = f"/sdcard/Movies/{os.path.basename(self.screen_artifact)}"
self.screen_command = f"shell screenrecord --bugreport {self.screen_phone_out_path}"
screen_pull_command = f"pull {self.screen_phone_out_path} {self.screen_artifact}"
screen_pull_command = f"pull {self.screen_phone_out_path} {self.screen_artifact}\n"
self.pull_commands.append(screen_pull_command)
# Need to write these to a file instead, to be shared between processes
with open(self.manifest_file, "a+") as manifest:
manifest.write(screen_pull_command)
self.file_counter += 1

def run_recorder(self) -> None:
Expand All @@ -90,11 +92,12 @@ async def start(self):

async def pull_screen_recording(self) -> None:
if self.screen_pull:
for command in self.pull_commands:
self.logger.info("Attempting to pull screen recording")
await asyncio.sleep(3)
self.platform.run_adb_command(command)
self.screen_pull = False
self.logger.info("Attempting to pull screen recording")
await asyncio.sleep(3)
with open(self.manifest_file) as manifest:
for line in manifest:
self.platform.run_adb_command(line)
self.screen_pull = False

async def stop(self):
self.logger.info("Stopping screen proc")
Expand Down

0 comments on commit a856bf6

Please sign in to comment.