SPB Git

Repository Public

shots.py 929 B 24 lines python

1#!/usr/bin/env python32# SP Drive iOS3# File: Scripts/shots.py4# Description: Gives the screenshots exported from a UI-test result bundle their readable names, in a destination folder.5#              usage: shots.py <exported attachments dir> <destination dir> [name prefix]6#7# Author: Simon-Pierre Boucher8# Contact: contact@spboucher.ai9import json, os, shutil, sys1011src, dst = sys.argv[1], sys.argv[2]12prefix = sys.argv[3] if len(sys.argv) > 3 else ""13os.makedirs(dst, exist_ok=True)14count = 015for test in json.load(open(os.path.join(src, "manifest.json"))):16    for a in test.get("attachments", []):17        f = a["exportedFileName"]18        if not f.endswith(".png"):19            continue20        name = a.get("suggestedHumanReadableName", f).split("_0_")[0].replace(".png", "")21        shutil.copyfile(os.path.join(src, f), os.path.join(dst, f"{prefix}{name}.png"))22        count += 123print(f"{count} captures → {dst}")24
Files main
Menu

Theme