diff options
author | clarkzjw <[email protected]> | 2018-01-03 00:41:37 +0800 |
---|---|---|
committer | clarkzjw <[email protected]> | 2018-01-03 00:41:37 +0800 |
commit | f4c535b38aaee18dd479e230858db316d1051d88 (patch) | |
tree | 5864dd6f8794a17c61ad4cf27246bec811a583c3 | |
parent | f4a786ad11fc659d649738d90113604c6f32567b (diff) | |
download | LumberJack-f4c535b38aaee18dd479e230858db316d1051d88.tar.gz |
+ fix
-rw-r--r-- | Dockerfile | 38 | ||||
-rw-r--r-- | README.md | 29 | ||||
-rw-r--r-- | bot.py | 5 | ||||
-rw-r--r-- | circle.yml | 12 | ||||
-rw-r--r-- | requirements.txt | 9 |
5 files changed, 14 insertions, 79 deletions
diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index 0f556b7..0000000 --- a/Dockerfile +++ /dev/null | |||
@@ -1,38 +0,0 @@ | |||
1 | # LumberJack bot | ||
2 | # It is difficult to dockerize this bot | ||
3 | # I have no idea how to access host's screenshot | ||
4 | # inside a docker container | ||
5 | # Project's present status: | ||
6 | # It can access mouse move inside a container | ||
7 | # But due to it cannot access screenshot of the host | ||
8 | # it cannot make decisions yet | ||
9 | |||
10 | FROM ubuntu:latest | ||
11 | MAINTAINER clarkzjw <[email protected]> | ||
12 | |||
13 | RUN \ | ||
14 | sed -i 's/# \(.*multiverse$\)/\1/g' /etc/apt/sources.list && \ | ||
15 | apt-get update && \ | ||
16 | apt-get -y upgrade && \ | ||
17 | apt-get install -y firefox sudo xvfb scrot git build-essential python3 python3-dev python3-pip python3-tk | ||
18 | |||
19 | RUN export uid=1000 gid=1000 && \ | ||
20 | mkdir -p /home/developer && \ | ||
21 | echo "developer:x:${uid}:${gid}:Developer,,,:/home/developer:/bin/bash" >> /etc/passwd && \ | ||
22 | echo "developer:x:${uid}:" >> /etc/group && \ | ||
23 | echo "developer ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/developer && \ | ||
24 | chmod 0440 /etc/sudoers.d/developer && \ | ||
25 | chown ${uid}:${gid} -R /home/developer | ||
26 | |||
27 | RUN \ | ||
28 | Xvfb :1 -screen 0 1366x768x16 &> xvfb.log && \ | ||
29 | export DISPLAY=:1.0 && \ | ||
30 | touch /root/.Xauthority && \ | ||
31 | touch /home/developer/.Xauthority && \ | ||
32 | pip3 install image && \ | ||
33 | pip3 install python3-xlib && \ | ||
34 | pip3 install pyautogui | ||
35 | |||
36 | USER developer | ||
37 | ENV HOME /home/developer | ||
38 | CMD /bin/bash | ||
@@ -1,8 +1,8 @@ | |||
1 | # LumberJack bot [![CircleCI](https://circleci.com/gh/clarkzjw/LumberJack.svg?style=svg)](https://circleci.com/gh/clarkzjw/LumberJack) [![](https://images.microbadger.com/badges/version/clarkzjw/lumberjack.svg)](https://microbadger.com/images/clarkzjw/lumberjack "Get your own version badge on microbadger.com") [![](https://images.microbadger.com/badges/image/clarkzjw/lumberjack.svg)](https://microbadger.com/images/clarkzjw/lumberjack "Get your own image badge on microbadger.com") | 1 | # LumberJack bot |
2 | 2 | ||
3 | Current Top Score: 408 | 3 | Current Top Score: 1068 |
4 | 4 | ||
5 | ![image](https://cloud.githubusercontent.com/assets/2663319/20305522/de7b327e-ab70-11e6-898e-3f286a0b567a.png) | 5 | ![image](https://user-images.githubusercontent.com/2663319/34491418-4e345ac6-f01e-11e7-99af-88e8e8a1e2ec.png) |
6 | 6 | ||
7 | ## Usage | 7 | ## Usage |
8 | 8 | ||
@@ -10,25 +10,4 @@ Current Top Score: 408 | |||
10 | python3 bot.py | 10 | python3 bot.py |
11 | ``` | 11 | ``` |
12 | 12 | ||
13 | Make sure you have PyAutoGUI installed. | 13 | Tested on macOS 10.12.6 with screen resolution 1680*1050 (not HiDPI) on Safari. |
14 | |||
15 | If you use Debian based Linux, you can install PyAutoGUI by | ||
16 | |||
17 | ```bash | ||
18 | sudo apt-get install scrot python3-tk python3 python3-dev python3-pip | ||
19 | sudo pip3 install image | ||
20 | sudo pip3 install python3-xlib | ||
21 | sudo pip3 install pyautogui | ||
22 | ``` | ||
23 | |||
24 | ## The Docker way | ||
25 | |||
26 | Although the Docker image of this bot cannot work correctly, you can give it a try. Remember to read the comments on top of Dockerfile | ||
27 | |||
28 | ```bash | ||
29 | docker run -it \ | ||
30 | -e DISPLAY=$DISPLAY \ | ||
31 | -v /tmp/.X11-unix:/tmp/.X11-unix \ | ||
32 | clarkzjw/lumberjack | ||
33 | ``` | ||
34 | |||
@@ -3,12 +3,11 @@ import time | |||
3 | import mss | 3 | import mss |
4 | import pyautogui as pg | 4 | import pyautogui as pg |
5 | from numpy import array, uint8 | 5 | from numpy import array, uint8 |
6 | |||
7 | #from keyboard import send | ||
8 | |||
9 | from pynput.keyboard import Key, Controller | 6 | from pynput.keyboard import Key, Controller |
7 | |||
10 | keyboard = Controller() | 8 | keyboard = Controller() |
11 | 9 | ||
10 | |||
12 | def begin(): | 11 | def begin(): |
13 | pg.click(440, 900, 2) | 12 | pg.click(440, 900, 2) |
14 | 13 | ||
diff --git a/circle.yml b/circle.yml deleted file mode 100644 index e4d4da5..0000000 --- a/circle.yml +++ /dev/null | |||
@@ -1,12 +0,0 @@ | |||
1 | machine: | ||
2 | services: | ||
3 | - docker | ||
4 | |||
5 | dependencies: | ||
6 | override: | ||
7 | - docker info | ||
8 | - docker build -t lumberjack . | ||
9 | |||
10 | test: | ||
11 | override: | ||
12 | - docker run -d lumberjack; sleep 10 | ||
diff --git a/requirements.txt b/requirements.txt index f30d3d3..1b8e67c 100644 --- a/requirements.txt +++ b/requirements.txt | |||
@@ -1,6 +1,13 @@ | |||
1 | keyboard==0.11.0 | 1 | keyboard==0.11.0 |
2 | mss==3.1.1 | 2 | mss==3.1.1 |
3 | numpy==1.13.3 | 3 | numpy==1.13.3 |
4 | Pillow==5.0.0 | ||
4 | PyAutoGUI==0.9.36 | 5 | PyAutoGUI==0.9.36 |
5 | pyobjc==4.1 | 6 | PyMsgBox==1.0.6 |
7 | pynput==1.3.8.1 | ||
6 | pyobjc-core==4.1 | 8 | pyobjc-core==4.1 |
9 | pyobjc-framework-Cocoa==4.1 | ||
10 | pyobjc-framework-Quartz==4.1 | ||
11 | PyScreeze==0.1.13 | ||
12 | PyTweening==1.0.3 | ||
13 | six==1.11.0 | ||