forked from SpielerNogard/geschenkebot
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlog_out.py
More file actions
executable file
·162 lines (128 loc) · 4.28 KB
/
log_out.py
File metadata and controls
executable file
·162 lines (128 loc) · 4.28 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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
import subprocess
import time
from datetime import datetime
from watcher import watcher
from screen_maker import screen_maker
class log_out(object):
def __init__(self):
self.log("log_out ready")
self.screen_maker = screen_maker()
self.Watcher = watcher()
def log(self,info):
now = datetime.now().time()
now = str(now)
print(now+" : "+info)
def run(self):
self.screen_maker.make_screen()
#menu öffnen
self.öffne_menu()
#einstellungen suchen und abmelden
self.suche_einstellungen()
self.screen_maker.make_screen()
def abmelden(self):
self.make_screen()
pos = self.Watcher.find_pos("abmelden_ja")
name = pos[0]
coords = pos[1]
val = pos[2]
x = coords[0]
y = coords[1]
self.log("Logge aus")
if val >= 0.8:
self.log("Ausgeloggt")
subprocess.call("adb shell input tap "+str(x)+" "+str(y),shell=True)
time.sleep(40)
else:
self.log("Konnte Logout BEstätigung nicht finden")
def logge_aus(self):
self.make_screen()
pos = self.Watcher.find_pos("abmelden")
name = pos[0]
coords = pos[1]
val = pos[2]
x = coords[0]
y = coords[1]
self.log("Logge aus")
if val >= 0.8:
subprocess.call("adb shell input tap "+str(x)+" "+str(y),shell=True)
time.sleep(20)
self.abmelden()
else:
self.log("Konnte Logout nicht finden")
self.scroll()
self.logge_aus()
def make_screen(self):
self.screen_maker.make_screen()
def suche_einstellungen(self):
self.make_screen()
pos = self.Watcher.find_pos("einstellungen")
name = pos[0]
coords = pos[1]
val = pos[2]
x = coords[0]
y = coords[1]
self.log("Öffne Einstellungen")
if val >= 0.8:
subprocess.call("adb shell input tap "+str(x)+" "+str(y),shell=True)
time.sleep(10)
self.make_screen()
self.logge_aus()
else:
self.log("Konnte Einstellungen nicht finden")
self.close_menu2()
self.run()
def scroll(self):
self.log("Scrolle")
self.screen_maker.make_screen()
subprocess.call("adb shell input swipe 100 1000 100 800 ",shell=True)
time.sleep(8)
self.screen_maker.make_screen()
self.log("gescrollt")
def öffne_menu(self):
self.make_screen()
pos = self.Watcher.find_pos("menu")
name = pos[0]
coords = pos[1]
val = pos[2]
x = coords[0]
y = coords[1]
self.log("Öffne Menü")
if val >= 0.8:
subprocess.call("adb shell input tap "+str(x)+" "+str(y),shell=True)
time.sleep(8)
self.make_screen()
else:
self.log("Konnte Menu nicht finden")
self.close_menu()
def close_menu2(self):
self.make_screen()
pos = self.Watcher.find_pos("freund_close2")
name = pos[0]
coords = pos[1]
val = pos[2]
x = coords[0]
y = coords[1]
self.log("Schließe Menü")
if val >= 0.8:
subprocess.call("adb shell input tap "+str(x)+" "+str(y),shell=True)
time.sleep(8)
self.make_screen()
else:
self.log("Konnte Schließbutton nicht finden")
#self.close_menu()
def close_menu(self):
self.make_screen()
pos = self.Watcher.find_pos("freund_close")
name = pos[0]
coords = pos[1]
val = pos[2]
x = coords[0]
y = coords[1]
self.log("Schließe Menü")
if val >= 0.8:
subprocess.call("adb shell input tap "+str(x)+" "+str(y),shell=True)
time.sleep(8)
self.make_screen()
else:
self.log("Konnte Schließbutton nicht finden")
#self.close_menu()