diff --git a/.gitignore b/.gitignore index 000f2ca..3a52e8c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ .idea -test \ No newline at end of file +test +.env \ No newline at end of file diff --git a/Pipfile b/Pipfile index d81a786..0742e01 100644 --- a/Pipfile +++ b/Pipfile @@ -7,6 +7,7 @@ name = "pypi" multiping = "*" pillow = "*" websockets = "*" +python-dotenv = "*" [dev-packages] diff --git a/Pipfile.lock b/Pipfile.lock index a7950b6..d714720 100644 --- a/Pipfile.lock +++ b/Pipfile.lock @@ -1,7 +1,7 @@ { "_meta": { "hash": { - "sha256": "346704abb9344de6f71e398c67855db45e0398b35aa9fe688e19bc609df6321f" + "sha256": "ccef10c99ccde2850597144b704849fcf19f79b971452ec2852a364ff77499f7" }, "pipfile-spec": 6, "requires": { @@ -109,6 +109,14 @@ "index": "pypi", "version": "==9.4.0" }, + "python-dotenv": { + "hashes": [ + "sha256:a8df96034aae6d2d50a4ebe8216326c61c3eb64836776504fcca410e5937a3ba", + "sha256:f5971a9226b701070a4bf2c38c89e5a3f0d64de8debda981d1db98583009122a" + ], + "index": "pypi", + "version": "==1.0.0" + }, "websockets": { "hashes": [ "sha256:00213676a2e46b6ebf6045bc11d0f529d9120baa6f58d122b4021ad92adabd41", diff --git a/main.py b/main.py index 3d88577..c33df0d 100644 --- a/main.py +++ b/main.py @@ -1,8 +1,10 @@ import asyncio import io +import os from PIL import Image from websockets import connect +from dotenv import load_dotenv from differencing import get_pixel_differences from network import upload @@ -10,7 +12,9 @@ from network import upload # Start a websocket # In the initial image load, detect all changes between the target and -width, height = 512, 512 +load_dotenv() + +width, height = int(os.getenv("CANVAS_WIDTH")), int(os.getenv("CANVAS_HEIGHT")) async def get_image(websocket): @@ -21,9 +25,9 @@ async def get_image(websocket): async def main(): - source_path = "C:\\Users\\Xevion\\Documents\\ShareX\\Screenshots\\2023-03\\firefox_c60J4nQj77.png" + source_path = os.getenv("SOUCE_FILE") - async with connect("wss://v6.sys42.net/ws") as websocket: + async with connect(os.getenv("WEBSOCKET_ADDRESS")) as websocket: while True: print(websocket.messages)