From 998833c4cf2f536049e4c60085f21fd35c0bb376 Mon Sep 17 00:00:00 2001 From: "Fabio U. Krapohl" Date: Mon, 4 Apr 2022 15:33:28 +0200 Subject: [PATCH] Allow column wise pixel placement instead of the current row by row method --- README.md | 2 ++ config_example.json | 1 + main.py | 30 ++++++++++++++++++++++++------ 3 files changed, 27 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 37fbc031..48bccbdb 100644 --- a/README.md +++ b/README.md @@ -128,6 +128,7 @@ If any JSON decoders errors are found, the `config.json` needs to be fixed. Make { "thread_delay": 2, "unverified_place_frequency": false, + "column_wise": false, "proxies": ["1.1.1.1:8080", "2.2.2.2:1234"], "compact_logging": true } @@ -135,6 +136,7 @@ If any JSON decoders errors are found, the `config.json` needs to be fixed. Make - thread_delay - Adds a delay between starting a new thread. Can be used to avoid ratelimiting. - unverified_place_frequency - Sets the pixel place frequency to the unverified account limit. +- column_wise - If true, sets pixels column by column instead of row by row. - proxies - Sets proxies to use for sending requests to reddit. The proxy used is randomly selected for each request. Can be used to avoid ratelimiting. - compact_logging - Disables timer text until next pixel. - Transparency can be achieved by using the RGB value (69, 42, 0) in any part of your image. diff --git a/config_example.json b/config_example.json index 9177e354..cbd861c3 100644 --- a/config_example.json +++ b/config_example.json @@ -4,6 +4,7 @@ "legacy_transparency": true, "thread_delay": 2, "unverified_place_frequency": false, + "column_wise": false, "compact_logging": true, "using_tor": false, "tor_port": 1881, diff --git a/main.py b/main.py index 71ef0e06..9e72b228 100755 --- a/main.py +++ b/main.py @@ -48,6 +48,12 @@ def __init__(self, config_path): and self.json_data["legacy_transparency"] is not None else True ) + self.column_wise = ( + self.json_data["column_wise"] + if "column_wise" in self.json_data + and self.json_data["column_wise"] is not None + else False + ) proxy.Init(self) # Color palette @@ -345,13 +351,22 @@ def get_unset_pixel(self, x, y, index): wasWaiting = False time.sleep(index * self.delay_between_launches) - if x >= self.image_size[0]: - y += 1 - x = 0 + if self.column_wise: + if y >= self.image_size[1]: + x += 1 + y = 0 + + if x >= self.image_size[0]: - if y >= self.image_size[1]: + x = 0 + else: + if x >= self.image_size[0]: + y += 1 + x = 0 + + if y >= self.image_size[1]: - y = 0 + y = 0 if x == originalX and y == originalY and loopedOnce: logger.info( @@ -403,7 +418,10 @@ def get_unset_pixel(self, x, y, index): x + self.pixel_x_start, y + self.pixel_y_start, ) - x += 1 + if self.column_wise: + y += 1 + else: + x += 1 loopedOnce = True return x, y, new_rgb