one dot oh

Signed-off-by: kkenny <kkenny379@gmail.com>
This commit is contained in:
kkenny 2025-01-10 16:59:39 -05:00
parent 35e30552fd
commit 4cf5a4e2e4
1 changed files with 116 additions and 36 deletions

140
main.py
View File

@ -1,15 +1,59 @@
#!/usr/bin/env python #!/usr/bin/env python
from os import system
from os import name
import pyautogui import pyautogui
import threading import threading
import datetime import datetime
from random import randint from random import randint
import subprocess import subprocess
time_between_moves = 5.0 # How long between each move (in seconds) _debug = False
move_duration = 1 # How long a move to the next coordinate should take (in seconds)
time_between_moves = 1.0 # How long between each move (in seconds)
move_duration = 0.1 # How long a move to the next coordinate should take (in seconds)
screenSize = pyautogui.size() screenSize = pyautogui.size()
idle_time_max = 0
idle_time_seconds = 0
previous_idle_time = 0
moves = 0
def banner():
print("\n")
print("\t ▄█ █▄ ▄█ ▄██████▄ ▄██████▄ ▄█ ▄██ ▄ ")
print("\t███ ███ ███ ███ ███ ███ ███ ███ ███ ██▄ ")
print("\t███ ███ ███▌ ███ █▀ ███ █▀ ███ ███▄▄▄███ ")
print("\t███ ███ ███▌ ▄███ ▄███ ███ ▀▀▀▀▀▀███ ")
print("\t███ ███ ███▌ ▀▀███ ████▄ ▀▀███ ████▄ ███ ▄██ ███ ")
print("\t███ ███ ███ ███ ███ ███ ███ ███ ███ ███ ")
print("\t███ ▄█▄ ███ ███ ███ ███ ███ ███ ███▌ ▄ ███ ███ ")
print("\t ▀███▀███▀ █▀ ████████▀ ████████▀ █████▄▄██ ▀█████▀ ")
print("\t")
print("\n\t_____________________________________________\n\n")
def clear():
# for windows
if name == 'nt':
_ = system('cls')
# for mac and linux(here, os.name is 'posix')
else:
_ = system('clear')
def rand_x():
return randint(1, screenSize[0])
def rand_y():
return randint(1, screenSize[1])
def moveMouse():
global moves
moves += 1
x = rand_x()
y = rand_y()
pyautogui.moveTo(x, y, duration = move_duration)
main()
def get_idle_time(): def get_idle_time():
"""Gets the idle time of the current user in seconds.""" """Gets the idle time of the current user in seconds."""
@ -21,42 +65,78 @@ def get_idle_time():
) )
return int(output) return int(output)
def rand_x():
return randint(1, screenSize[0])
def rand_y():
return randint(1, screenSize[1])
def moveMouse():
x = rand_x()
y = rand_y()
pyautogui.moveTo(x, y, duration = move_duration)
main()
#def clickMouse():
# pyautogui.click()
# main()
def doNothing(): def doNothing():
main() main()
def main(): def clear_line(number):
hour = datetime.datetime.now().hour print(f"\033[{number};0H\033[K\033[A")
idle_time_seconds = get_idle_time()
print(f"Idle time: {idle_time_seconds} seconds")
if hour == 18: def main():
global _debug
global moves
global idle_time_max
global previous_idle_time
global idle_time_seconds
cond = 0
max_set = 0
hour = datetime.datetime.now().hour
machine_idle_time_seconds = get_idle_time()
if previous_idle_time > machine_idle_time_seconds and previous_idle_time <= 118: # Reset
cond = 1
idle_time_seconds = machine_idle_time_seconds
else:
cond = 2
idle_time_seconds += 1
if idle_time_seconds > idle_time_max:
max_set = 1
idle_time_max = idle_time_seconds
it_hours = idle_time_seconds // (60 * 60)
it_s_remains = idle_time_seconds % (60 * 60)
it_minutes = it_s_remains // 60
it_seconds = it_s_remains % 60
itm_hours = idle_time_max // (60 * 60)
itm_s_remains = idle_time_max % (60 * 60)
itm_minutes = itm_s_remains // 60
itm_seconds = itm_s_remains % 60
clear_line(16)
print(f"\tIdle time: {it_hours}h {it_minutes}m {it_seconds}s",end="\r")
clear_line(17)
print(f"\tIdle time max: {itm_hours}h {itm_minutes}m {itm_seconds}s",end="\r")
clear_line(18)
print(f"\tMoves: {moves}",end="\r")
if _debug is True:
clear_line(15)
print(f"\tMachine Idle time: {machine_idle_time_seconds} seconds",end="\r")
clear_line(20)
print(f"\tPrevious Idle Time:: {previous_idle_time}",end="\r")
clear_line(21)
print(f"\tcondition hit: {cond}",end="\r")
clear_line(22)
print(f"\tmax updated: {max_set}",end="\r")
previous_idle_time = machine_idle_time_seconds
if hour == 21:
print("end of day reached") print("end of day reached")
quit() quit()
elif idle_time_seconds >= 15: elif machine_idle_time_seconds >= 120:
threading.Timer(time_between_moves, moveMouse).start() threading.Timer(time_between_moves, moveMouse).start()
# threading.Timer(10.0, clickMouse).start()
else: else:
threading.Timer(time_between_moves, doNothing).start() threading.Timer(time_between_moves, doNothing).start()
clear()
banner()
main() main()