-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathadbot.py
More file actions
60 lines (50 loc) · 1.66 KB
/
adbot.py
File metadata and controls
60 lines (50 loc) · 1.66 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# pip install pyautogui
import pyautogui as gui
from time import sleep
from sys import exit as sysexit
# Coords of the 'Add pause' button and timeline input line
# for 1360x768 monitor in Chrome with 100% scale
# Maybe, it can be made auto-configurable for any monitor and gui scale
add_x = 300
add_y = 240
timeline_x = 270
timeline_y = 500
try:
minutes = int(input("Minutes: "))
seconds = int(input("Seconds: "))
interval = int(input("Interval: "))
except ValueError:
print("Invalid data!")
sysexit()
if minutes < 8 or seconds < 0:
print("Too short video!")
sysexit()
currentMinutes = 0
currentSeconds = 0
def can_time_be_incremented():
global currentMinutes, currentSeconds, minutes, seconds
return currentMinutes < minutes or (currentMinutes == minutes and currentSeconds <= seconds)
def increment_time():
global currentSeconds, currentMinutes
currentSeconds += interval
if currentSeconds >= 60:
currentMinutes += currentSeconds // 60
currentSeconds %= 60
def write_time():
global currentMinutes, currentSeconds
gui.write("0" + str(currentMinutes) if currentMinutes < 10 else str(currentMinutes))
gui.press(["shift", ":"])
gui.write("0" + str(currentSeconds) if currentSeconds < 10 else str(currentSeconds))
gui.press(["shift", ":"])
gui.write("00")
# Wait for 10 seconds to prepare the browser page
sleep(10)
while can_time_be_incremented():
gui.click(x=timeline_x, y=timeline_y, clicks=3, interval=0.1)
gui.press("backspace")
# Changing time to add new pause
write_time()
# Pressing 'Add pause' button
gui.click(x=add_x, y=add_y)
increment_time()
print("Finished!")