| 123456789101112131415161718 |
- import datetime
- from ppadb.client import Client as AdbClient
- client = AdbClient(host="127.0.0.1", port=5037)
- device = client.device("192.168.178.32:5555")
- def save_screenshot():
- # Take a screenshot
- result = device.screencap()
- timestamp = datetime.datetime.now().strftime("%Y%m%d_%H%M%S")
- filename = f"fights/{timestamp}.png"
- # Save the screenshot to a file
- with open(filename, "wb") as fp:
- fp.write(result)
- save_screenshot()
|