|
|
@@ -1,20 +1,5 @@
|
|
|
-import datetime
|
|
|
-import io
|
|
|
-from PIL import Image
|
|
|
-from ppadb.client import Client as AdbClient
|
|
|
+import os
|
|
|
+from helper import save_screenshot
|
|
|
|
|
|
-client = AdbClient(host="127.0.0.1", port=5037)
|
|
|
-device = client.device("192.168.178.32:5555")
|
|
|
-
|
|
|
-def save_screenshot():
|
|
|
- result = device.screencap()
|
|
|
-
|
|
|
- timestamp = datetime.datetime.now().strftime("%Y%m%d_%H%M%S")
|
|
|
- image = Image.open(io.BytesIO(result))
|
|
|
- jpeg_filename = f"/mnt/t/nextcloud/InstantUpload/Herowars/{timestamp}.jpg"
|
|
|
-
|
|
|
- image = image.convert('RGB') # Convert to RGB mode for JPEG
|
|
|
- with open(jpeg_filename, "wb") as fp:
|
|
|
- image.save(fp, format='JPEG', quality=85) # Adjust quality as needed
|
|
|
-
|
|
|
-save_screenshot()
|
|
|
+screenshot_address = os.getenv("SCREENSHOT_PATH")
|
|
|
+save_screenshot(screenshot_address)
|