Skip to content

Commit

Permalink
Fix: working on oneplus5
Browse files Browse the repository at this point in the history
  • Loading branch information
wangshub committed May 27, 2018
1 parent d1e24cb commit 5416698
Show file tree
Hide file tree
Showing 40 changed files with 1,343 additions and 28 deletions.
Binary file modified .DS_Store
Binary file not shown.
674 changes: 652 additions & 22 deletions .idea/workspace.xml

Large diffs are not rendered by default.

591 changes: 591 additions & 0 deletions README.md

Large diffs are not rendered by default.

Binary file removed autojump-crunch.png
Binary file not shown.
Binary file modified autojump.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 8 additions & 1 deletion config/1920x1080/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,19 @@
"x": 540,
"y": 965,
"rx": 10,
"ry": 10
"ry": 300
},
"follow_bottom":{
"x": 990,
"y": 950,
"rx": 10,
"ry": 10
},
"star_bottom":{
"x": 1000,
"y": 1083,
"rx": 10,
"ry": 10
}

}
79 changes: 75 additions & 4 deletions douyin-bot.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# -*- coding: utf-8 -*-
import sys
import math
import re
import random
import time
from PIL import Image
Expand All @@ -22,16 +20,21 @@
exit(1)

VERSION = "0.0.1"

# 我申请的 Key,随便用,嘻嘻嘻
AppID = '1106858595'
AppKey = 'bNUNgOpY6AeeJjFu'

DEBUG_SWITCH = True
FACE_PATH = 'face/'

adb = auto_adb()
adb.test_device()

config = config.open_accordant_config()

# 审美标准
BEAUTY_THRESHOLD = 90


def yes_or_no():
"""
Expand Down Expand Up @@ -59,6 +62,48 @@ def _random_bias(num):
return random.randint(-num, num)


def next_page():
"""
翻到下一页
:return:
"""
cmd = 'shell input swipe {x1} {y1} {x2} {y2} {duration}'.format(
x1=config['center_point']['x'],
y1=config['center_point']['y']+config['center_point']['ry'],
x2=config['center_point']['x'],
y2=config['center_point']['y'],
duration=200
)
adb.run(cmd)
time.sleep(1.5)


def follow_user():
"""
关注用户
:return:
"""
cmd = 'shell input tap {x} {y}'.format(
x=config['follow_bottom']['x'] + _random_bias(10),
y=config['follow_bottom']['y'] + _random_bias(10)
)
adb.run(cmd)
time.sleep(0.5)


def thumbs_up():
"""
点赞
:return:
"""
cmd = 'shell input tap {x} {y}'.format(
x=config['star_bottom']['x'] + _random_bias(10),
y=config['star_bottom']['y'] + _random_bias(10)
)
adb.run(cmd)
time.sleep(0.5)


def main():
"""
main
Expand All @@ -68,16 +113,42 @@ def main():
print('激活窗口并按 CONTROL + C 组合键退出')
debug.dump_device_info()
screenshot.check_screenshot()

while True:
next_page()

time.sleep(1)
screenshot.pull_screenshot()

resize_image('autojump.png', 'optimized.png', 1024*1024)

with open('optimized.png', 'rb') as bin_data:
image_data = bin_data.read()

ai_obj = apiutil.AiPlat(AppID, AppKey)
rsp = ai_obj.face_detectface(image_data, 0)
print(rsp)

if rsp['ret'] == 0:
beauty = 0
for face in rsp['data']['face_list']:
print(face)
face_area = (face['x'], face['y'], face['x']+face['width'], face['y']+face['height'])
print(face_area)
img = Image.open("optimized.png")
cropped_img = img.crop(face_area).convert('RGB')
cropped_img.save(FACE_PATH + face['face_id'] + '.png')
# 性别判断
if face['beauty'] > beauty and face['gender'] < 50:
beauty = face['beauty']

# 是个美人儿~关注点赞走一波
if beauty > BEAUTY_THRESHOLD:
thumbs_up()
follow_user()

else:
print(rsp)
continue


if __name__ == '__main__':
Expand Down
10 changes: 10 additions & 0 deletions example/test_crop.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
from PIL import Image

im = Image.open("../autojump.png")
w, h = im.size

area = (0, 0, 50, 50)

im_croped = im.crop(area)

im_croped.show()
2 changes: 1 addition & 1 deletion example/test_plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
# img = mpimg.imread('../screenshot/comment_comment.jpeg')
# img = mpimg.imread('../screenshot/add_comment.jpeg')

img = mpimg.imread('../screenshot/WechatIMG26.jpeg')
img = mpimg.imread('../autojump.png')

imgplot = plt.imshow(img)
plt.show()
Binary file added face/.DS_Store
Binary file not shown.
Empty file added face/2597312621134769340.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added face/2597314038783309777.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added face/2597323172958238990.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added face/2597323177791125774.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added face/2597323182607235342.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added face/2597323427984505136.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added face/2597323561109617080.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added face/2597323636664724532.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added face/2597323641581497409.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added face/2597323707484528424.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added face/2597324026148827138.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added face/2597324031099154565.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added face/2597324133798800623.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added face/2597324264393727895.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added face/2597332489931356030.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added face/2597332494899509118.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added face/2597334089248831442.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added face/2597334094165604290.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added face/2597336452252593187.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added face/2597345312234332124.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added face/2597350742189734197.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added face/2597350841970092145.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added face/2597350982375463100.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added face/2597350987327887548.png
Binary file added face/2597356846122555875.png
Binary file added face/2597356940656916896.png
Binary file added face/2597357121386343547.png
Binary file added face/2597357266833307988.png
Binary file modified optimized.png
6 changes: 6 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
matplotlib==2.2.0
xlrd==1.1.0
pandas==0.22.0
numpy==1.14.1
Pillow==5.1.0
scikit_learn==0.19.1

0 comments on commit 5416698

Please sign in to comment.