From 3d2514eaaa0232a21d7c8c0c2618fa4f85706d34 Mon Sep 17 00:00:00 2001 From: wangzhengzhen Date: Mon, 30 Dec 2024 10:49:34 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- script/apps.py | 8 ++++++-- script/main.py | 28 +++++++++++++++------------- 2 files changed, 21 insertions(+), 15 deletions(-) diff --git a/script/apps.py b/script/apps.py index 8681df9..655eb0f 100644 --- a/script/apps.py +++ b/script/apps.py @@ -33,7 +33,7 @@ class _App: def open_function(self): pass -def _exec(rule, func, log_prefix = ""): +def _exec(rule, func = [], log_prefix = "执行任务"): factor = getattr(rule, "factor") if hasattr(rule, "num"): num = getattr(rule, "num") @@ -43,7 +43,11 @@ def _exec(rule, func, log_prefix = ""): if factor > 0: wait_time = round(random.uniform(wait_time - factor, wait_time + factor), 2) print("{}:{}/{} ,停留 {} 秒".format(log_prefix, i, num, wait_time)) - func() + if isinstance(func, list): + for f in func: + f() + else: + func() time.sleep(wait_time) i += 1 return True diff --git a/script/main.py b/script/main.py index 2ac5872..df6299c 100644 --- a/script/main.py +++ b/script/main.py @@ -2,17 +2,6 @@ from devices import WikoHi70m import apps 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(): # adb_cmd.mobile_unlock() @@ -20,9 +9,22 @@ def main(): try: # 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)