mirror of
https://gitee.com/sui-feng-cb/AzurLaneAutoScript1
synced 2026-05-31 16:26:41 +08:00
133
config/deploy.template-docker-cn.yaml
Normal file
133
config/deploy.template-docker-cn.yaml
Normal file
@@ -0,0 +1,133 @@
|
|||||||
|
Deploy:
|
||||||
|
Git:
|
||||||
|
# URL of AzurLaneAutoScript repository
|
||||||
|
# [CN user] Use 'https://gitee.com/LmeSzinc/AzurLaneAutoScript' for faster and more stable download
|
||||||
|
# [Other] Use 'https://github.com/LmeSzinc/AzurLaneAutoScript'
|
||||||
|
Repository: https://gitee.com/LmeSzinc/AzurLaneAutoScript
|
||||||
|
# Branch of Alas
|
||||||
|
# [Developer] Use 'dev', 'app', etc, to try new features
|
||||||
|
# [Other] Use 'master', the stable branch
|
||||||
|
Branch: master
|
||||||
|
# Filepath of git executable `git.exe`
|
||||||
|
# [Easy installer] Use './toolkit/Git/mingw64/bin/git.exe'
|
||||||
|
# [Other] Use you own git
|
||||||
|
GitExecutable: /usr/bin/git
|
||||||
|
# Set git proxy
|
||||||
|
# [CN user] Use your local http proxy (http://127.0.0.1:{port}) or socks5 proxy (socks5://127.0.0.1:{port})
|
||||||
|
# [Other] Use null
|
||||||
|
GitProxy: null
|
||||||
|
# Update Alas at startup
|
||||||
|
# [In most cases] Use true
|
||||||
|
AutoUpdate: true
|
||||||
|
# Whether to keep local changes during update
|
||||||
|
# User settings, logs and screenshots will be kept, no mather this is true or false
|
||||||
|
# [Developer] Use true, if you modified the code
|
||||||
|
# [Other] Use false
|
||||||
|
KeepLocalChanges: false
|
||||||
|
|
||||||
|
Python:
|
||||||
|
# Filepath of python executable `python.exe`
|
||||||
|
# [Easy installer] Use './toolkit/python.exe'
|
||||||
|
# [Other] Use you own python, and its version should be 3.7.6 64bit
|
||||||
|
PythonExecutable: /app/pyroot/bin/python
|
||||||
|
# URL of pypi mirror
|
||||||
|
# [CN user] Use 'https://pypi.tuna.tsinghua.edu.cn/simple' for faster and more stable download
|
||||||
|
# [Other] Use null
|
||||||
|
PypiMirror: https://pypi.tuna.tsinghua.edu.cn/simple
|
||||||
|
# Install dependencies at startup
|
||||||
|
# [In most cases] Use true
|
||||||
|
InstallDependencies: true
|
||||||
|
# Path to requirements.txt
|
||||||
|
# [In most cases] Use 'requirements.txt'
|
||||||
|
# [In AidLux] Use './deploy/AidLux/{version}/requirements.txt', version is default to 0.92
|
||||||
|
RequirementsFile: ./deploy/docker/requirements.txt
|
||||||
|
|
||||||
|
Adb:
|
||||||
|
# Filepath of ADB executable `adb.exe`
|
||||||
|
# [Easy installer] Use './toolkit/Lib/site-packages/adbutils/binaries/adb.exe'
|
||||||
|
# [Other] Use you own latest ADB, but not the ADB in your emulator
|
||||||
|
AdbExecutable: /usr/bin/adb
|
||||||
|
# Whether to replace ADB
|
||||||
|
# Chinese emulators (NoxPlayer, LDPlayer, MemuPlayer, MuMuPlayer) use their own ADB, instead of the latest.
|
||||||
|
# Different ADB servers will terminate each other at startup, resulting in disconnection.
|
||||||
|
# For compatibility, we have to replace them all.
|
||||||
|
# This will do:
|
||||||
|
# 1. Terminate current ADB server
|
||||||
|
# 2. Rename ADB from all emulators to *.bak and replace them by the AdbExecutable set above
|
||||||
|
# 3. Brute-force connect to all available emulator instances
|
||||||
|
# [In most cases] Use true
|
||||||
|
# [In few cases] Use false, if you have other programs using ADB.
|
||||||
|
ReplaceAdb: true
|
||||||
|
# Brute-force connect to all available emulator instances
|
||||||
|
# [In most cases] Use true
|
||||||
|
AutoConnect: true
|
||||||
|
# Re-install uiautomator2
|
||||||
|
# [In most cases] Use true
|
||||||
|
InstallUiautomator2: true
|
||||||
|
|
||||||
|
Ocr:
|
||||||
|
# Run Ocr as a service, can reduce memory usage by not import mxnet everytime you start an alas instance
|
||||||
|
|
||||||
|
# Whether to use ocr server
|
||||||
|
# [Default] false
|
||||||
|
UseOcrServer: false
|
||||||
|
# Whether to start ocr server when start GUI
|
||||||
|
# [Default] false
|
||||||
|
StartOcrServer: false
|
||||||
|
# Port of ocr server runs by GUI
|
||||||
|
# [Default] 22268
|
||||||
|
OcrServerPort: 22268
|
||||||
|
# Address of ocr server for alas instance to connect
|
||||||
|
# [Default] 127.0.0.1:22268
|
||||||
|
OcrClientAddress: 127.0.0.1:22268
|
||||||
|
|
||||||
|
Update:
|
||||||
|
# Use auto update and builtin updater feature
|
||||||
|
# This may cause problem https://github.com/LmeSzinc/AzurLaneAutoScript/issues/876
|
||||||
|
EnableReload: true
|
||||||
|
# Check update every X minute
|
||||||
|
# [Disable] 0
|
||||||
|
# [Default] 5
|
||||||
|
CheckUpdateInterval: 5
|
||||||
|
# Scheduled restart time
|
||||||
|
# If there are updates, Alas will automatically restart and update at this time every day
|
||||||
|
# and run all alas instances that running before restarted
|
||||||
|
# [Disable] null
|
||||||
|
# [Default] 03:50
|
||||||
|
AutoRestartTime: 03:50
|
||||||
|
|
||||||
|
Misc:
|
||||||
|
# Enable discord rich presence
|
||||||
|
DiscordRichPresence: false
|
||||||
|
|
||||||
|
Webui:
|
||||||
|
# --host. Host to listen
|
||||||
|
# [Use IPv6] '::'
|
||||||
|
# [In most cases] Default to '0.0.0.0'
|
||||||
|
WebuiHost: 0.0.0.0
|
||||||
|
# --port. Port to listen
|
||||||
|
# You will be able to access webui via `http://{host}:{port}`
|
||||||
|
# [In most cases] Default to 22267
|
||||||
|
WebuiPort: 22267
|
||||||
|
# Language to use on web ui
|
||||||
|
# 'zh-CN' for Chinese simplified
|
||||||
|
# 'en-US' for English
|
||||||
|
# 'ja-JP' for Japanese
|
||||||
|
# 'zh-TW' for Chinese traditional
|
||||||
|
Language: en-US
|
||||||
|
# Theme of web ui
|
||||||
|
# 'default' for light theme
|
||||||
|
# 'dark' for dark theme
|
||||||
|
Theme: default
|
||||||
|
# Follow system DPI scaling
|
||||||
|
# [In most cases] true
|
||||||
|
# [In few cases] false to make Alas smaller, if you have a low resolution but high DPI scaling.
|
||||||
|
DpiScaling: true
|
||||||
|
# --key. Password of web ui
|
||||||
|
# Useful when expose Alas to the public network
|
||||||
|
Password: null
|
||||||
|
# --cdn. Use jsdelivr cdn for pywebio static files (css, js).
|
||||||
|
# 'true' for jsdelivr cdn
|
||||||
|
# 'false' for self host cdn (automatically)
|
||||||
|
# 'https://path.to.your/cdn' to use custom cdn
|
||||||
|
CDN: false
|
||||||
133
config/deploy.template-docker.yaml
Normal file
133
config/deploy.template-docker.yaml
Normal file
@@ -0,0 +1,133 @@
|
|||||||
|
Deploy:
|
||||||
|
Git:
|
||||||
|
# URL of AzurLaneAutoScript repository
|
||||||
|
# [CN user] Use 'https://gitee.com/LmeSzinc/AzurLaneAutoScript' for faster and more stable download
|
||||||
|
# [Other] Use 'https://github.com/LmeSzinc/AzurLaneAutoScript'
|
||||||
|
Repository: https://github.com/LmeSzinc/AzurLaneAutoScript
|
||||||
|
# Branch of Alas
|
||||||
|
# [Developer] Use 'dev', 'app', etc, to try new features
|
||||||
|
# [Other] Use 'master', the stable branch
|
||||||
|
Branch: master
|
||||||
|
# Filepath of git executable `git.exe`
|
||||||
|
# [Easy installer] Use './toolkit/Git/mingw64/bin/git.exe'
|
||||||
|
# [Other] Use you own git
|
||||||
|
GitExecutable: /usr/bin/git
|
||||||
|
# Set git proxy
|
||||||
|
# [CN user] Use your local http proxy (http://127.0.0.1:{port}) or socks5 proxy (socks5://127.0.0.1:{port})
|
||||||
|
# [Other] Use null
|
||||||
|
GitProxy: null
|
||||||
|
# Update Alas at startup
|
||||||
|
# [In most cases] Use true
|
||||||
|
AutoUpdate: true
|
||||||
|
# Whether to keep local changes during update
|
||||||
|
# User settings, logs and screenshots will be kept, no mather this is true or false
|
||||||
|
# [Developer] Use true, if you modified the code
|
||||||
|
# [Other] Use false
|
||||||
|
KeepLocalChanges: false
|
||||||
|
|
||||||
|
Python:
|
||||||
|
# Filepath of python executable `python.exe`
|
||||||
|
# [Easy installer] Use './toolkit/python.exe'
|
||||||
|
# [Other] Use you own python, and its version should be 3.7.6 64bit
|
||||||
|
PythonExecutable: /app/pyroot/bin/python
|
||||||
|
# URL of pypi mirror
|
||||||
|
# [CN user] Use 'https://pypi.tuna.tsinghua.edu.cn/simple' for faster and more stable download
|
||||||
|
# [Other] Use null
|
||||||
|
PypiMirror: null
|
||||||
|
# Install dependencies at startup
|
||||||
|
# [In most cases] Use true
|
||||||
|
InstallDependencies: true
|
||||||
|
# Path to requirements.txt
|
||||||
|
# [In most cases] Use 'requirements.txt'
|
||||||
|
# [In AidLux] Use './deploy/AidLux/{version}/requirements.txt', version is default to 0.92
|
||||||
|
RequirementsFile: ./deploy/docker/requirements.txt
|
||||||
|
|
||||||
|
Adb:
|
||||||
|
# Filepath of ADB executable `adb.exe`
|
||||||
|
# [Easy installer] Use './toolkit/Lib/site-packages/adbutils/binaries/adb.exe'
|
||||||
|
# [Other] Use you own latest ADB, but not the ADB in your emulator
|
||||||
|
AdbExecutable: /usr/bin/adb
|
||||||
|
# Whether to replace ADB
|
||||||
|
# Chinese emulators (NoxPlayer, LDPlayer, MemuPlayer, MuMuPlayer) use their own ADB, instead of the latest.
|
||||||
|
# Different ADB servers will terminate each other at startup, resulting in disconnection.
|
||||||
|
# For compatibility, we have to replace them all.
|
||||||
|
# This will do:
|
||||||
|
# 1. Terminate current ADB server
|
||||||
|
# 2. Rename ADB from all emulators to *.bak and replace them by the AdbExecutable set above
|
||||||
|
# 3. Brute-force connect to all available emulator instances
|
||||||
|
# [In most cases] Use true
|
||||||
|
# [In few cases] Use false, if you have other programs using ADB.
|
||||||
|
ReplaceAdb: true
|
||||||
|
# Brute-force connect to all available emulator instances
|
||||||
|
# [In most cases] Use true
|
||||||
|
AutoConnect: true
|
||||||
|
# Re-install uiautomator2
|
||||||
|
# [In most cases] Use true
|
||||||
|
InstallUiautomator2: true
|
||||||
|
|
||||||
|
Ocr:
|
||||||
|
# Run Ocr as a service, can reduce memory usage by not import mxnet everytime you start an alas instance
|
||||||
|
|
||||||
|
# Whether to use ocr server
|
||||||
|
# [Default] false
|
||||||
|
UseOcrServer: false
|
||||||
|
# Whether to start ocr server when start GUI
|
||||||
|
# [Default] false
|
||||||
|
StartOcrServer: false
|
||||||
|
# Port of ocr server runs by GUI
|
||||||
|
# [Default] 22268
|
||||||
|
OcrServerPort: 22268
|
||||||
|
# Address of ocr server for alas instance to connect
|
||||||
|
# [Default] 127.0.0.1:22268
|
||||||
|
OcrClientAddress: 127.0.0.1:22268
|
||||||
|
|
||||||
|
Update:
|
||||||
|
# Use auto update and builtin updater feature
|
||||||
|
# This may cause problem https://github.com/LmeSzinc/AzurLaneAutoScript/issues/876
|
||||||
|
EnableReload: true
|
||||||
|
# Check update every X minute
|
||||||
|
# [Disable] 0
|
||||||
|
# [Default] 5
|
||||||
|
CheckUpdateInterval: 5
|
||||||
|
# Scheduled restart time
|
||||||
|
# If there are updates, Alas will automatically restart and update at this time every day
|
||||||
|
# and run all alas instances that running before restarted
|
||||||
|
# [Disable] null
|
||||||
|
# [Default] 03:50
|
||||||
|
AutoRestartTime: 03:50
|
||||||
|
|
||||||
|
Misc:
|
||||||
|
# Enable discord rich presence
|
||||||
|
DiscordRichPresence: false
|
||||||
|
|
||||||
|
Webui:
|
||||||
|
# --host. Host to listen
|
||||||
|
# [Use IPv6] '::'
|
||||||
|
# [In most cases] Default to '0.0.0.0'
|
||||||
|
WebuiHost: 0.0.0.0
|
||||||
|
# --port. Port to listen
|
||||||
|
# You will be able to access webui via `http://{host}:{port}`
|
||||||
|
# [In most cases] Default to 22267
|
||||||
|
WebuiPort: 22267
|
||||||
|
# Language to use on web ui
|
||||||
|
# 'zh-CN' for Chinese simplified
|
||||||
|
# 'en-US' for English
|
||||||
|
# 'ja-JP' for Japanese
|
||||||
|
# 'zh-TW' for Chinese traditional
|
||||||
|
Language: en-US
|
||||||
|
# Theme of web ui
|
||||||
|
# 'default' for light theme
|
||||||
|
# 'dark' for dark theme
|
||||||
|
Theme: default
|
||||||
|
# Follow system DPI scaling
|
||||||
|
# [In most cases] true
|
||||||
|
# [In few cases] false to make Alas smaller, if you have a low resolution but high DPI scaling.
|
||||||
|
DpiScaling: true
|
||||||
|
# --key. Password of web ui
|
||||||
|
# Useful when expose Alas to the public network
|
||||||
|
Password: null
|
||||||
|
# --cdn. Use jsdelivr cdn for pywebio static files (css, js).
|
||||||
|
# 'true' for jsdelivr cdn
|
||||||
|
# 'false' for self host cdn (automatically)
|
||||||
|
# 'https://path.to.your/cdn' to use custom cdn
|
||||||
|
CDN: false
|
||||||
2
deploy/docker/.dockerignore
Normal file
2
deploy/docker/.dockerignore
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
Docker-run.sh
|
||||||
|
requirements_generator.py
|
||||||
30
deploy/docker/Dockerfile
Normal file
30
deploy/docker/Dockerfile
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
FROM condaforge/mambaforge:4.12.0-0
|
||||||
|
|
||||||
|
# Install dependencies
|
||||||
|
RUN apt update && \
|
||||||
|
apt install -y adb netcat
|
||||||
|
|
||||||
|
# Create user
|
||||||
|
RUN useradd -m abc && \
|
||||||
|
usermod -G users abc
|
||||||
|
|
||||||
|
# Set remote and local dirs
|
||||||
|
WORKDIR /app
|
||||||
|
ENV SOURCE=./
|
||||||
|
RUN chown abc:abc /app
|
||||||
|
USER abc
|
||||||
|
|
||||||
|
# Install the base conda environment
|
||||||
|
ENV PYROOT=/app/pyroot
|
||||||
|
RUN mamba create --prefix $PYROOT python==3.7.6 -y
|
||||||
|
|
||||||
|
# Install the requriements to the conda environment
|
||||||
|
COPY --chown=abc:abc $SOURCE/requirements.txt /app/requirements.txt
|
||||||
|
RUN $PYROOT/bin/pip install -r /app/requirements.txt
|
||||||
|
|
||||||
|
# Initial download of UIAutomator2 is really slow with appetizer mirror
|
||||||
|
RUN sed -i "s#path = mirror_download(url,#path = cache_download(url,#" $PYROOT/lib/python3.7/site-packages/uiautomator2/init.py
|
||||||
|
|
||||||
|
# When running the image, mount the ALAS folder into the container
|
||||||
|
CMD $PYROOT/bin/python -m uiautomator2 init && \
|
||||||
|
$PYROOT/bin/python /app/AzurLaneAutoScript/gui.py
|
||||||
27
deploy/docker/requirements.txt
Normal file
27
deploy/docker/requirements.txt
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
numpy==1.16.6
|
||||||
|
scipy==1.4.1
|
||||||
|
pillow
|
||||||
|
opencv-python-headless
|
||||||
|
imageio
|
||||||
|
lz4
|
||||||
|
tqdm
|
||||||
|
adbutils==0.11.0
|
||||||
|
uiautomator2==2.16.7
|
||||||
|
retrying
|
||||||
|
mxnet==1.6.0
|
||||||
|
cnocr==1.2.2
|
||||||
|
jellyfish
|
||||||
|
pyyaml
|
||||||
|
inflection
|
||||||
|
pywebio==1.5.2
|
||||||
|
starlette==0.14.2
|
||||||
|
anyio==1.3.1
|
||||||
|
uvicorn[standard]==0.17.6
|
||||||
|
aiofiles
|
||||||
|
wrapt==1.13.1
|
||||||
|
prettytable==2.2.1
|
||||||
|
pypresence==4.2.1
|
||||||
|
rich==11.0.0
|
||||||
|
zerorpc==0.6.3
|
||||||
|
pyzmq==22.3.0
|
||||||
|
atomicwrites
|
||||||
58
deploy/docker/requirements_generator.py
Normal file
58
deploy/docker/requirements_generator.py
Normal file
@@ -0,0 +1,58 @@
|
|||||||
|
import os
|
||||||
|
|
||||||
|
BASE_FOLDER = os.path.dirname(os.path.abspath(__file__))
|
||||||
|
print(BASE_FOLDER)
|
||||||
|
|
||||||
|
def read_file(file):
|
||||||
|
out = {}
|
||||||
|
with open(file, 'r', encoding='utf-8') as f:
|
||||||
|
for line in f.readlines():
|
||||||
|
res = [s.strip() for s in line.split('==')]
|
||||||
|
if len(res) > 1:
|
||||||
|
name, version = res
|
||||||
|
else:
|
||||||
|
name, version = res[0], None
|
||||||
|
out[name] = version
|
||||||
|
|
||||||
|
return out
|
||||||
|
|
||||||
|
|
||||||
|
def write_file(file, data):
|
||||||
|
lines = []
|
||||||
|
for name, version in data.items():
|
||||||
|
if version:
|
||||||
|
lines.append(f'{name}=={version}')
|
||||||
|
else:
|
||||||
|
lines.append(str(name))
|
||||||
|
|
||||||
|
with open(file, 'w', encoding='utf-8', newline='') as f:
|
||||||
|
f.write('\n'.join(lines))
|
||||||
|
|
||||||
|
|
||||||
|
def docker_requirements_generate(requirements_in='requirements-in.txt'):
|
||||||
|
|
||||||
|
if not os.path.exists(requirements_in):
|
||||||
|
requirements_in = os.path.join(BASE_FOLDER+"/../../", requirements_in)
|
||||||
|
assert os.path.exists(requirements_in)
|
||||||
|
|
||||||
|
requirements = read_file(requirements_in)
|
||||||
|
|
||||||
|
print(f'Generate requirements for Docker image')
|
||||||
|
|
||||||
|
new = {}
|
||||||
|
print(requirements)
|
||||||
|
for name, version in requirements.items():
|
||||||
|
# alas-webapp is for windows only
|
||||||
|
if name == 'alas-webapp':
|
||||||
|
continue
|
||||||
|
if name == 'opencv-python':
|
||||||
|
name = 'opencv-python-headless'
|
||||||
|
version = None
|
||||||
|
# if name == 'numpy':
|
||||||
|
# version = None
|
||||||
|
new[name] = version
|
||||||
|
|
||||||
|
write_file(os.path.join(BASE_FOLDER, f'./requirements.txt'), data=new)
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
docker_requirements_generate()
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
FROM continuumio/anaconda3:2021.05
|
|
||||||
|
|
||||||
# Set remote and local dirs
|
|
||||||
WORKDIR /app
|
|
||||||
ENV SOURCE=./
|
|
||||||
|
|
||||||
# Install the base conda environment
|
|
||||||
ENV PYROOT=/app/pyroot
|
|
||||||
RUN conda create --prefix $PYROOT python==3.7.6 -y
|
|
||||||
|
|
||||||
# CV2 requires libGL.so.1
|
|
||||||
RUN apt update
|
|
||||||
RUN apt install -y libgl1 adb
|
|
||||||
|
|
||||||
# Install the requriements to the conda environment
|
|
||||||
COPY $SOURCE/requirements-in.txt /app/requirements-in.txt
|
|
||||||
RUN $PYROOT/bin/pip install -r /app/requirements-in.txt
|
|
||||||
|
|
||||||
# When running the image, mount the ALAS folder into the container
|
|
||||||
CMD $PYROOT/bin/python /app/AzurLaneAutoScript/gui.py
|
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
import os
|
import os
|
||||||
|
|
||||||
from deploy.AidLux.requirements_generator import aidlux_requirements_generate
|
from deploy.AidLux.requirements_generator import aidlux_requirements_generate
|
||||||
|
from deploy.docker.requirements_generator import docker_requirements_generate
|
||||||
|
|
||||||
# Ensure running in Alas root folder
|
# Ensure running in Alas root folder
|
||||||
os.chdir(os.path.join(os.path.dirname(__file__), '../'))
|
os.chdir(os.path.join(os.path.dirname(__file__), '../'))
|
||||||
@@ -37,3 +38,4 @@ def requirements_modify(file='requirements.txt'):
|
|||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
requirements_modify()
|
requirements_modify()
|
||||||
aidlux_requirements_generate()
|
aidlux_requirements_generate()
|
||||||
|
docker_requirements_generate()
|
||||||
|
|||||||
12
docker-compose.yml
Normal file
12
docker-compose.yml
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
version: '3.7'
|
||||||
|
services:
|
||||||
|
ALAS:
|
||||||
|
network_mode: host
|
||||||
|
volumes:
|
||||||
|
- '.:/app/AzurLaneAutoScript:rw'
|
||||||
|
- '/etc/localtime:/etc/localtime:ro'
|
||||||
|
container_name: 'alas'
|
||||||
|
image: 'alas'
|
||||||
|
build:
|
||||||
|
context: ./deploy/docker/
|
||||||
|
dockerfile: ./Dockerfile
|
||||||
@@ -99,17 +99,20 @@ def release_resources(next_task=''):
|
|||||||
# Release all OCR models
|
# Release all OCR models
|
||||||
# Usually to have 2 models loaded and each model takes about 20MB
|
# Usually to have 2 models loaded and each model takes about 20MB
|
||||||
# This will release 20-40MB
|
# This will release 20-40MB
|
||||||
from module.ocr.ocr import OCR_MODEL
|
from module.webui.setting import State
|
||||||
if 'Opsi' in next_task or 'commission' in next_task:
|
if not State.deploy_config.UseOcrServer:
|
||||||
# OCR models will be used soon, don't release
|
# Release only when using per-instance OCR
|
||||||
models = []
|
from module.ocr.ocr import OCR_MODEL
|
||||||
elif next_task:
|
if 'Opsi' in next_task or 'commission' in next_task:
|
||||||
# Release OCR models except 'azur_lane'
|
# OCR models will be used soon, don't release
|
||||||
models = ['cnocr', 'jp', 'tw']
|
models = []
|
||||||
else:
|
elif next_task:
|
||||||
models = ['azur_lane', 'cnocr', 'jp', 'tw']
|
# Release OCR models except 'azur_lane'
|
||||||
for model in models:
|
models = ['cnocr', 'jp', 'tw']
|
||||||
del_cached_property(OCR_MODEL, model)
|
else:
|
||||||
|
models = ['azur_lane', 'cnocr', 'jp', 'tw']
|
||||||
|
for model in models:
|
||||||
|
del_cached_property(OCR_MODEL, model)
|
||||||
|
|
||||||
# Release assets cache
|
# Release assets cache
|
||||||
# module.ui has about 80 assets and takes about 3MB
|
# module.ui has about 80 assets and takes about 3MB
|
||||||
|
|||||||
@@ -4321,7 +4321,8 @@
|
|||||||
"series_3_234_only",
|
"series_3_234_only",
|
||||||
"series_2_than_3_457_234",
|
"series_2_than_3_457_234",
|
||||||
"series_2_blueprint_457",
|
"series_2_blueprint_457",
|
||||||
"series_2_blueprint_only"
|
"series_2_blueprint_only",
|
||||||
|
"series_2_457_only"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"CustomFilter": {
|
"CustomFilter": {
|
||||||
|
|||||||
@@ -292,6 +292,7 @@ Research:
|
|||||||
- series_2_than_3_457_234
|
- series_2_than_3_457_234
|
||||||
- series_2_blueprint_457
|
- series_2_blueprint_457
|
||||||
- series_2_blueprint_only
|
- series_2_blueprint_only
|
||||||
|
- series_2_457_only
|
||||||
CustomFilter: |-
|
CustomFilter: |-
|
||||||
S4-Q0.5 > Q-0.5 > S4-DR0.5 > S4-PRY0.5 > DR-0.5 > PRY-0.5
|
S4-Q0.5 > Q-0.5 > S4-DR0.5 > S4-PRY0.5 > DR-0.5 > PRY-0.5
|
||||||
> S4-Q1 > S4-Q2
|
> S4-Q1 > S4-Q2
|
||||||
|
|||||||
@@ -183,7 +183,7 @@ class GeneratedConfig:
|
|||||||
Research_UseCube = 'only_05_hour' # always_use, only_05_hour, only_no_project, do_not_use
|
Research_UseCube = 'only_05_hour' # always_use, only_05_hour, only_no_project, do_not_use
|
||||||
Research_UseCoin = 'always_use' # always_use, only_05_hour, only_no_project, do_not_use
|
Research_UseCoin = 'always_use' # always_use, only_05_hour, only_no_project, do_not_use
|
||||||
Research_UsePart = 'always_use' # always_use, only_05_hour, only_no_project, do_not_use
|
Research_UsePart = 'always_use' # always_use, only_05_hour, only_no_project, do_not_use
|
||||||
Research_PresetFilter = 'series_4_blueprint_tenrai' # custom, series_4_blueprint_tenrai, series_4_blueprint_only, series_4_tenrai_only, series_3_blueprint_234, series_3_blueprint_only, series_3_234_only, series_2_than_3_457_234, series_2_blueprint_457, series_2_blueprint_only
|
Research_PresetFilter = 'series_4_blueprint_tenrai' # custom, series_4_blueprint_tenrai, series_4_blueprint_only, series_4_tenrai_only, series_3_blueprint_234, series_3_blueprint_only, series_3_234_only, series_2_than_3_457_234, series_2_blueprint_457, series_2_blueprint_only, series_2_457_only
|
||||||
Research_CustomFilter = 'S4-Q0.5 > Q-0.5 > S4-DR0.5 > S4-PRY0.5 > DR-0.5 > PRY-0.5\n> S4-Q1 > S4-Q2\n> S4-DR2.5 > S4-G1.5\n> S4-Q4 > S4-H0.5 > S4-G4\n> S4-PRY2.5 > S4-G2.5\n> reset > S4-H1 > shortest'
|
Research_CustomFilter = 'S4-Q0.5 > Q-0.5 > S4-DR0.5 > S4-PRY0.5 > DR-0.5 > PRY-0.5\n> S4-Q1 > S4-Q2\n> S4-DR2.5 > S4-G1.5\n> S4-Q4 > S4-H0.5 > S4-G4\n> S4-PRY2.5 > S4-G2.5\n> reset > S4-H1 > shortest'
|
||||||
|
|
||||||
# Group `Dorm`
|
# Group `Dorm`
|
||||||
|
|||||||
@@ -387,6 +387,13 @@ class ConfigGenerator:
|
|||||||
'AdbExecutable': '/usr/bin/adb',
|
'AdbExecutable': '/usr/bin/adb',
|
||||||
}
|
}
|
||||||
|
|
||||||
|
docker = {
|
||||||
|
'GitExecutable': '/usr/bin/git',
|
||||||
|
'PythonExecutable': '/app/pyroot/bin/python',
|
||||||
|
'RequirementsFile': './deploy/docker/requirements.txt',
|
||||||
|
'AdbExecutable': '/usr/bin/adb',
|
||||||
|
}
|
||||||
|
|
||||||
def update(suffix, *args):
|
def update(suffix, *args):
|
||||||
file = f'./config/deploy.{suffix}.yaml'
|
file = f'./config/deploy.{suffix}.yaml'
|
||||||
new = deepcopy(template)
|
new = deepcopy(template)
|
||||||
@@ -398,6 +405,8 @@ class ConfigGenerator:
|
|||||||
update('template-cn', cn)
|
update('template-cn', cn)
|
||||||
update('template-AidLux', aidlux)
|
update('template-AidLux', aidlux)
|
||||||
update('template-AidLux-cn', aidlux, cn)
|
update('template-AidLux-cn', aidlux, cn)
|
||||||
|
update('template-docker', docker)
|
||||||
|
update('template-docker-cn', docker, cn)
|
||||||
|
|
||||||
def insert_package(self):
|
def insert_package(self):
|
||||||
option = deep_get(self.argument, keys='Emulator.PackageName.option')
|
option = deep_get(self.argument, keys='Emulator.PackageName.option')
|
||||||
|
|||||||
@@ -1122,12 +1122,13 @@
|
|||||||
"series_4_blueprint_tenrai": "Series 4 Blueprints+Tenrai",
|
"series_4_blueprint_tenrai": "Series 4 Blueprints+Tenrai",
|
||||||
"series_4_blueprint_only": "Series 4 Blueprints Only",
|
"series_4_blueprint_only": "Series 4 Blueprints Only",
|
||||||
"series_4_tenrai_only": "Series 4 Tenrai Only",
|
"series_4_tenrai_only": "Series 4 Tenrai Only",
|
||||||
"series_3_blueprint_234": "Series 3 Blueprint+234",
|
"series_3_blueprint_234": "Series 3 Blueprints+234",
|
||||||
"series_3_blueprint_only": "Series 3 Blueprint Only",
|
"series_3_blueprint_only": "Series 3 Blueprints Only",
|
||||||
"series_3_234_only": "Series 3 234 Only",
|
"series_3_234_only": "Series 3 234 Only",
|
||||||
"series_2_than_3_457_234": "Series 2+3 457+234",
|
"series_2_than_3_457_234": "Series 2+3 457+234",
|
||||||
"series_2_blueprint_457": "Series2 Blueprint+457",
|
"series_2_blueprint_457": "Series 2 Blueprints+457",
|
||||||
"series_2_blueprint_only": "Series 2 Blueprint Only"
|
"series_2_blueprint_only": "Series 2 Blueprints Only",
|
||||||
|
"series_2_457_only": "Series 2 457 Only"
|
||||||
},
|
},
|
||||||
"CustomFilter": {
|
"CustomFilter": {
|
||||||
"name": "Custom Research Priority",
|
"name": "Custom Research Priority",
|
||||||
|
|||||||
@@ -1122,12 +1122,13 @@
|
|||||||
"series_4_blueprint_tenrai": "Series 4 Blueprints+Tenrai",
|
"series_4_blueprint_tenrai": "Series 4 Blueprints+Tenrai",
|
||||||
"series_4_blueprint_only": "Series 4 Blueprints Only",
|
"series_4_blueprint_only": "Series 4 Blueprints Only",
|
||||||
"series_4_tenrai_only": "Series 4 Tenrai Only",
|
"series_4_tenrai_only": "Series 4 Tenrai Only",
|
||||||
"series_3_blueprint_234": "Series 3 Blueprint+234",
|
"series_3_blueprint_234": "Series 3 Blueprints+234",
|
||||||
"series_3_blueprint_only": "Series 3 Blueprint Only",
|
"series_3_blueprint_only": "Series 3 Blueprints Only",
|
||||||
"series_3_234_only": "Series 3 234 Only",
|
"series_3_234_only": "Series 3 234 Only",
|
||||||
"series_2_than_3_457_234": "Series 2+3 457+234",
|
"series_2_than_3_457_234": "Series 2+3 457+234",
|
||||||
"series_2_blueprint_457": "Series2 Blueprint+457",
|
"series_2_blueprint_457": "Series 2 Blueprints+457",
|
||||||
"series_2_blueprint_only": "Series 2 Blueprint Only"
|
"series_2_blueprint_only": "Series 2 Blueprints Only",
|
||||||
|
"series_2_457_only": "Series 2 457 Only"
|
||||||
},
|
},
|
||||||
"CustomFilter": {
|
"CustomFilter": {
|
||||||
"name": "Research.CustomFilter.name",
|
"name": "Research.CustomFilter.name",
|
||||||
|
|||||||
@@ -1127,7 +1127,8 @@
|
|||||||
"series_3_234_only": "三期 仅234",
|
"series_3_234_only": "三期 仅234",
|
||||||
"series_2_than_3_457_234": "二期兼顾三期 457+234",
|
"series_2_than_3_457_234": "二期兼顾三期 457+234",
|
||||||
"series_2_blueprint_457": "二期 蓝图+457",
|
"series_2_blueprint_457": "二期 蓝图+457",
|
||||||
"series_2_blueprint_only": "二期 仅蓝图"
|
"series_2_blueprint_only": "二期 仅蓝图",
|
||||||
|
"series_2_457_only": "二期 仅457"
|
||||||
},
|
},
|
||||||
"CustomFilter": {
|
"CustomFilter": {
|
||||||
"name": "自定义科研过滤器",
|
"name": "自定义科研过滤器",
|
||||||
|
|||||||
@@ -1127,7 +1127,8 @@
|
|||||||
"series_3_234_only": "三期 僅234",
|
"series_3_234_only": "三期 僅234",
|
||||||
"series_2_than_3_457_234": "二期兼顧三期 457+234",
|
"series_2_than_3_457_234": "二期兼顧三期 457+234",
|
||||||
"series_2_blueprint_457": "二期 藍圖+457",
|
"series_2_blueprint_457": "二期 藍圖+457",
|
||||||
"series_2_blueprint_only": "二期 僅藍圖"
|
"series_2_blueprint_only": "二期 僅藍圖",
|
||||||
|
"series_2_457_only": "二期 僅457"
|
||||||
},
|
},
|
||||||
"CustomFilter": {
|
"CustomFilter": {
|
||||||
"name": "自定義科研過濾器",
|
"name": "自定義科研過濾器",
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import socket
|
|||||||
import subprocess
|
import subprocess
|
||||||
import time
|
import time
|
||||||
import ipaddress
|
import ipaddress
|
||||||
|
import platform
|
||||||
from functools import wraps
|
from functools import wraps
|
||||||
|
|
||||||
import adbutils
|
import adbutils
|
||||||
@@ -110,6 +111,7 @@ class Connection:
|
|||||||
self.serial = str(self.config.Emulator_Serial)
|
self.serial = str(self.config.Emulator_Serial)
|
||||||
self.serial_check()
|
self.serial_check()
|
||||||
self.detect_device()
|
self.detect_device()
|
||||||
|
self.is_avd
|
||||||
|
|
||||||
# Connect
|
# Connect
|
||||||
self.adb_connect(self.serial)
|
self.adb_connect(self.serial)
|
||||||
@@ -118,15 +120,12 @@ class Connection:
|
|||||||
# Package
|
# Package
|
||||||
self.package = self.config.Emulator_PackageName
|
self.package = self.config.Emulator_PackageName
|
||||||
if self.package == 'auto':
|
if self.package == 'auto':
|
||||||
self.detect_package(set_config=False)
|
self.detect_package()
|
||||||
else:
|
else:
|
||||||
set_server(self.package)
|
set_server(self.package)
|
||||||
logger.attr('PackageName', self.package)
|
logger.attr('PackageName', self.package)
|
||||||
logger.attr('Server', self.config.SERVER)
|
logger.attr('Server', self.config.SERVER)
|
||||||
|
|
||||||
self._nc_server_host = '127.0.0.1'
|
|
||||||
self._nc_server_port = self.config.REVERSE_SERVER_PORT
|
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def find_bluestacks4_hyperv(serial):
|
def find_bluestacks4_hyperv(serial):
|
||||||
"""
|
"""
|
||||||
@@ -274,6 +273,16 @@ class Connection:
|
|||||||
result = self.adb.shell(cmd, timeout=10, **kwargs)
|
result = self.adb.shell(cmd, timeout=10, **kwargs)
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
@cached_property
|
||||||
|
def is_avd(self):
|
||||||
|
if get_serial_pair(self.serial)[0] is None:
|
||||||
|
return False
|
||||||
|
if 'ranchu' in self.adb_shell(['getprop', 'ro.hardware']):
|
||||||
|
return True
|
||||||
|
if 'goldfish' in self.adb_shell(['getprop', 'ro.hardware.audio.primary']):
|
||||||
|
return True
|
||||||
|
return False
|
||||||
|
|
||||||
@cached_property
|
@cached_property
|
||||||
def _nc_server_host_port(self):
|
def _nc_server_host_port(self):
|
||||||
"""
|
"""
|
||||||
@@ -290,8 +299,15 @@ class Connection:
|
|||||||
# For emulators, listen on current host
|
# For emulators, listen on current host
|
||||||
if self.serial.startswith('emulator-') or self.serial.startswith('127.0.0.1:'):
|
if self.serial.startswith('emulator-') or self.serial.startswith('127.0.0.1:'):
|
||||||
host = socket.gethostbyname(socket.gethostname())
|
host = socket.gethostbyname(socket.gethostname())
|
||||||
|
if platform.system() == 'Linux' and host == '127.0.1.1':
|
||||||
|
host = '127.0.0.1'
|
||||||
logger.info(f'Connecting to local emulator, using host {host}')
|
logger.info(f'Connecting to local emulator, using host {host}')
|
||||||
port = random_port(self.config.FORWARD_PORT_RANGE)
|
port = random_port(self.config.FORWARD_PORT_RANGE)
|
||||||
|
|
||||||
|
# For AVD instance
|
||||||
|
if self.is_avd:
|
||||||
|
return host, port, "10.0.2.2", port
|
||||||
|
|
||||||
return host, port, host, port
|
return host, port, host, port
|
||||||
# For local network devices, listen on the host under the same network as target device
|
# For local network devices, listen on the host under the same network as target device
|
||||||
if re.match(r'\d+\.\d+\.\d+\.\d+:\d+', self.serial):
|
if re.match(r'\d+\.\d+\.\d+\.\d+:\d+', self.serial):
|
||||||
|
|||||||
@@ -19,9 +19,11 @@ def is_port_using(port_num):
|
|||||||
s.settimeout(2)
|
s.settimeout(2)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
result = s.connect_ex(('127.0.0.1', port_num))
|
s.bind(('127.0.0.1', port_num))
|
||||||
# if port is using, return code should be 0. (can be connected)
|
return False
|
||||||
return result == 0
|
except OSError:
|
||||||
|
# Address already bind
|
||||||
|
return True
|
||||||
finally:
|
finally:
|
||||||
s.close()
|
s.close()
|
||||||
|
|
||||||
|
|||||||
@@ -278,7 +278,8 @@ class FastForwardHandler(AutoSearchHandler):
|
|||||||
name (str):
|
name (str):
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
str: Name of next stage, or origin name if unable to increase.
|
str: Name of next stage in upper case,
|
||||||
|
or origin name if unable to increase.
|
||||||
"""
|
"""
|
||||||
name = name.upper()
|
name = name.upper()
|
||||||
for increase in self.STAGE_INCREASE:
|
for increase in self.STAGE_INCREASE:
|
||||||
@@ -287,10 +288,15 @@ class FastForwardHandler(AutoSearchHandler):
|
|||||||
index = increase.index(name) + 1
|
index = increase.index(name) + 1
|
||||||
if index < len(increase):
|
if index < len(increase):
|
||||||
new = increase[index]
|
new = increase[index]
|
||||||
|
# Don't check main stages, assume all exist
|
||||||
|
# Main stages are named like campaign_7_2, but user inputs 7-2
|
||||||
|
if self.config.Campaign_Event == 'campaign_main':
|
||||||
|
return new
|
||||||
|
# Check if map file exist
|
||||||
existing = map_files(self.config.Campaign_Event)
|
existing = map_files(self.config.Campaign_Event)
|
||||||
logger.info(f'Existing files: {existing}')
|
logger.info(f'Existing files: {existing}')
|
||||||
if new in existing:
|
if new.lower() in existing:
|
||||||
return increase[index]
|
return new
|
||||||
else:
|
else:
|
||||||
logger.info(f'Stage increase reach end, new map {new} does not exist')
|
logger.info(f'Stage increase reach end, new map {new} does not exist')
|
||||||
return name
|
return name
|
||||||
|
|||||||
@@ -67,4 +67,9 @@ DICT_FILTER_PRESET = {
|
|||||||
> S2-PRY2.5 > 0.5 > S2-G2.5 > S2-Q1 > 1 > reset > S2-DR5 > S2-DR8
|
> S2-PRY2.5 > 0.5 > S2-G2.5 > S2-Q1 > 1 > reset > S2-DR5 > S2-DR8
|
||||||
> S2-PRY5 > 1.5 > S2-Q2 > 2 > S2-PRY8 > 2.5 > S2-Q4 > 4 > 5 > S2-C6
|
> S2-PRY5 > 1.5 > S2-Q2 > 2 > S2-PRY8 > 2.5 > S2-Q4 > 4 > 5 > S2-C6
|
||||||
> 6 > S2-C8 > 8 > S2-C12 > 12""",
|
> 6 > S2-C8 > 8 > S2-C12 > 12""",
|
||||||
|
'series_2_457_only': """
|
||||||
|
S2-Q0.5 > S2-PRY0.5 > S2-DR0.5 > S2-Q4 > S2-Q1 > S2-Q2 > S2-H0.5 > 0.5
|
||||||
|
> Q1 > S2-G4 > S2-G1.5 > S2-DR2.5 > reset > S2-PRY2.5 > S2-G2.5 > H1 > 1.5
|
||||||
|
> Q2 > 2.5 > S2-DR5 > S2-PRY5 > Q4 > G4 > 5 > H2 > S2-C6 > S2-DR8 > S2-PRY8 > S2-C8
|
||||||
|
> 6 > 8 > 4 > S2-C12 > 12"""
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user