优化
This commit is contained in:
@@ -33,7 +33,7 @@ class _App:
|
|||||||
def open_function(self):
|
def open_function(self):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def _exec(rule, func, log_prefix = ""):
|
def _exec(rule, func = [], log_prefix = "执行任务"):
|
||||||
factor = getattr(rule, "factor")
|
factor = getattr(rule, "factor")
|
||||||
if hasattr(rule, "num"):
|
if hasattr(rule, "num"):
|
||||||
num = getattr(rule, "num")
|
num = getattr(rule, "num")
|
||||||
@@ -43,6 +43,10 @@ def _exec(rule, func, log_prefix = ""):
|
|||||||
if factor > 0:
|
if factor > 0:
|
||||||
wait_time = round(random.uniform(wait_time - factor, wait_time + factor), 2)
|
wait_time = round(random.uniform(wait_time - factor, wait_time + factor), 2)
|
||||||
print("{}:{}/{} ,停留 {} 秒".format(log_prefix, i, num, wait_time))
|
print("{}:{}/{} ,停留 {} 秒".format(log_prefix, i, num, wait_time))
|
||||||
|
if isinstance(func, list):
|
||||||
|
for f in func:
|
||||||
|
f()
|
||||||
|
else:
|
||||||
func()
|
func()
|
||||||
time.sleep(wait_time)
|
time.sleep(wait_time)
|
||||||
i += 1
|
i += 1
|
||||||
|
@@ -2,17 +2,6 @@ from devices import WikoHi70m
|
|||||||
import apps
|
import apps
|
||||||
import random
|
import random
|
||||||
|
|
||||||
def app_custom(device):
|
|
||||||
# 上滑视频
|
|
||||||
device.swipe(240 + int(random.uniform(-10, 10)), 1200 + int(random.uniform(-10, 10)), 240 + int(random.uniform(-10, 10)), 1100 + int(random.uniform(-10, 10)), 50)
|
|
||||||
# 上滑浏览(小窗口)
|
|
||||||
# device.swipe(450 + int(random.uniform(-10, 10)), 400 + int(random.uniform(-10, 10)), 450 + int(random.uniform(-10, 10)), 200 + int(random.uniform(-10, 10)), 300)
|
|
||||||
# 上滑视频(小窗口)
|
|
||||||
device.swipe(450 + int(random.uniform(-10, 10)), 400 + int(random.uniform(-10, 10)), 450 + int(random.uniform(-10, 10)), 200 + int(random.uniform(-10, 10)), 50)
|
|
||||||
# 左滑(小窗口)
|
|
||||||
# device.swipe(600 + int(random.uniform(-10, 10)), 400 + int(random.uniform(-10, 10)), 400 + int(random.uniform(-10, 10)), 400 + int(random.uniform(-10, 10)), 80)
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
|
||||||
# adb_cmd.mobile_unlock()
|
# adb_cmd.mobile_unlock()
|
||||||
@@ -20,9 +9,22 @@ def main():
|
|||||||
try:
|
try:
|
||||||
|
|
||||||
# 3URNU24803102309 192.168.8.138:5555
|
# 3URNU24803102309 192.168.8.138:5555
|
||||||
wikoHi70m = WikoHi70m('192.168.8.138:5555')
|
wikoHi70m = WikoHi70m('3URNU24803102309')
|
||||||
|
|
||||||
# apps._exec(apps.Rule.count(500, 5, 2), lambda : app_custom(wikoHi70m), "任务执行中")
|
func = [
|
||||||
|
# 上滑视频
|
||||||
|
# lambda : device.swipe(240 + int(random.uniform(-10, 10)), 1200 + int(random.uniform(-10, 10)), 240 + int(random.uniform(-10, 10)), 1100 + int(random.uniform(-10, 10)), 50)
|
||||||
|
# 左滑
|
||||||
|
lambda : wikoHi70m.swipe(500 + int(random.uniform(-10, 10)), 1200 + int(random.uniform(-10, 10)), 240 + int(random.uniform(-10, 10)), 1200 + int(random.uniform(-10, 10)), 80),
|
||||||
|
|
||||||
|
# 左滑(小窗口)
|
||||||
|
lambda : wikoHi70m.swipe(600 + int(random.uniform(-10, 10)), 400 + int(random.uniform(-10, 10)), 400 + int(random.uniform(-10, 10)), 400 + int(random.uniform(-10, 10)), 80)
|
||||||
|
# 上滑浏览(小窗口)
|
||||||
|
# lambda : device.swipe(450 + int(random.uniform(-10, 10)), 400 + int(random.uniform(-10, 10)), 450 + int(random.uniform(-10, 10)), 200 + int(random.uniform(-10, 10)), 300)
|
||||||
|
# 上滑视频(小窗口)
|
||||||
|
# lambda : device.swipe(450 + int(random.uniform(-10, 10)), 400 + int(random.uniform(-10, 10)), 450 + int(random.uniform(-10, 10)), 200 + int(random.uniform(-10, 10)), 50)
|
||||||
|
]
|
||||||
|
apps._exec(apps.Rule.count(1000, 5, 2), func, "任务执行中")
|
||||||
|
|
||||||
# 快手
|
# 快手
|
||||||
# kuaishouLite = apps.KuaishouLite(wikoHi70m)
|
# kuaishouLite = apps.KuaishouLite(wikoHi70m)
|
||||||
|
Reference in New Issue
Block a user