improve processing speed by priority of using local watermark images
This commit is contained in:
2
Makefile
2
Makefile
@@ -16,7 +16,7 @@ make:
|
|||||||
#export cloudscraper_path=$(python3 -c 'import cloudscraper as _; print(_.__path__[0])' | tail -n 1)
|
#export cloudscraper_path=$(python3 -c 'import cloudscraper as _; print(_.__path__[0])' | tail -n 1)
|
||||||
|
|
||||||
@echo "[+]Pyinstaller make"
|
@echo "[+]Pyinstaller make"
|
||||||
pyinstaller --onefile AV_Data_Capture.py --hidden-import ADC_function.py --hidden-import core.py
|
pyinstaller --onefile AV_Data_Capture.py --hidden-import ADC_function.py --hidden-import core.py --add-data "Img:Img"
|
||||||
|
|
||||||
@echo "[+]Move to bin"
|
@echo "[+]Move to bin"
|
||||||
if [ ! -d "./bin" ];then mkdir bin; fi
|
if [ ! -d "./bin" ];then mkdir bin; fi
|
||||||
|
|||||||
35
core.py
35
core.py
@@ -5,6 +5,7 @@ import re
|
|||||||
import shutil
|
import shutil
|
||||||
import platform
|
import platform
|
||||||
import errno
|
import errno
|
||||||
|
import sys
|
||||||
|
|
||||||
from PIL import Image
|
from PIL import Image
|
||||||
from io import BytesIO
|
from io import BytesIO
|
||||||
@@ -587,12 +588,34 @@ def add_mark_thread(pic_path, cn_sub, leak, uncensored, conf):
|
|||||||
|
|
||||||
def add_to_pic(pic_path, img_pic, size, count, mode):
|
def add_to_pic(pic_path, img_pic, size, count, mode):
|
||||||
mark_pic_path = ''
|
mark_pic_path = ''
|
||||||
if mode == 1:
|
# 先找pyinstaller打包的图片
|
||||||
mark_pic_path = BytesIO(get_html("https://raw.githubusercontent.com/yoshiko2/AV_Data_Capture/master/Img/SUB.png",return_type="content"))
|
base_path = ''
|
||||||
elif mode == 2:
|
if hasattr(sys, '_MEIPASS'):
|
||||||
mark_pic_path = BytesIO(get_html("https://raw.githubusercontent.com/yoshiko2/AV_Data_Capture/master/Img/LEAK.png",return_type="content"))
|
base_path = getattr(sys, '_MEIPASS')
|
||||||
elif mode == 3:
|
if base_path and os.path.isfile(os.path.join(base_path,"Img/SUB.png")):
|
||||||
mark_pic_path = BytesIO(get_html("https://raw.githubusercontent.com/yoshiko2/AV_Data_Capture/master/Img/UNCENSORED.png",return_type="content"))
|
if mode == 1:
|
||||||
|
mark_pic_path = os.path.join(base_path, "Img/SUB.png")
|
||||||
|
elif mode == 2:
|
||||||
|
mark_pic_path = os.path.join(base_path, "Img/LEAK.png")
|
||||||
|
elif mode == 3:
|
||||||
|
mark_pic_path = os.path.join(base_path, "Img/UNCENSORED.png")
|
||||||
|
# 再找py脚本所在路径的图片
|
||||||
|
elif os.path.isfile(os.path.join(os.path.dirname(os.path.realpath(__file__)),"Img/SUB.png")):
|
||||||
|
base_path = os.path.dirname(os.path.realpath(__file__))
|
||||||
|
if mode == 1:
|
||||||
|
mark_pic_path = os.path.join(base_path, "Img/SUB.png")
|
||||||
|
elif mode == 2:
|
||||||
|
mark_pic_path = os.path.join(base_path, "Img/LEAK.png")
|
||||||
|
elif mode == 3:
|
||||||
|
mark_pic_path = os.path.join(base_path, "Img/UNCENSORED.png")
|
||||||
|
# 如果没有本地图片才通过网络下载
|
||||||
|
else:
|
||||||
|
if mode == 1:
|
||||||
|
mark_pic_path = BytesIO(get_html("https://raw.githubusercontent.com/yoshiko2/AV_Data_Capture/master/Img/SUB.png",return_type="content"))
|
||||||
|
elif mode == 2:
|
||||||
|
mark_pic_path = BytesIO(get_html("https://raw.githubusercontent.com/yoshiko2/AV_Data_Capture/master/Img/LEAK.png",return_type="content"))
|
||||||
|
elif mode == 3:
|
||||||
|
mark_pic_path = BytesIO(get_html("https://raw.githubusercontent.com/yoshiko2/AV_Data_Capture/master/Img/UNCENSORED.png",return_type="content"))
|
||||||
img_subt = Image.open(mark_pic_path)
|
img_subt = Image.open(mark_pic_path)
|
||||||
scroll_high = int(img_pic.height / size)
|
scroll_high = int(img_pic.height / size)
|
||||||
scroll_wide = int(scroll_high * img_subt.width / img_subt.height)
|
scroll_wide = int(scroll_high * img_subt.width / img_subt.height)
|
||||||
|
|||||||
@@ -9,7 +9,8 @@ mkdir __pycache__
|
|||||||
pyinstaller --onefile AV_Data_Capture.py `
|
pyinstaller --onefile AV_Data_Capture.py `
|
||||||
--hidden-import ADC_function.py `
|
--hidden-import ADC_function.py `
|
||||||
--hidden-import core.py `
|
--hidden-import core.py `
|
||||||
--add-data "$CLOUDSCRAPER_PATH;cloudscraper"
|
--add-data "$CLOUDSCRAPER_PATH;cloudscraper" `
|
||||||
|
--add-data "Img;Img"
|
||||||
|
|
||||||
rmdir -Recurse -Force build
|
rmdir -Recurse -Force build
|
||||||
rmdir -Recurse -Force __pycache__
|
rmdir -Recurse -Force __pycache__
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
pkg install python38 py38-requests py38-pip py38-lxml py38-pillow py38-cloudscraper py38-pysocks git zip py38-beautifulsoup448
|
pkg install python38 py38-requests py38-pip py38-lxml py38-pillow py38-cloudscraper py38-pysocks git zip py38-beautifulsoup448
|
||||||
pip install pyquery pyinstaller
|
pip install pyquery pyinstaller
|
||||||
pyinstaller --onefile AV_Data_Capture.py --hidden-import ADC_function.py --hidden-import core.py --add-data "$(python3.8 -c 'import cloudscraper as _; print(_.__path__[0])' | tail -n 1):cloudscraper"
|
pyinstaller --onefile AV_Data_Capture.py --hidden-import ADC_function.py --hidden-import core.py --add-data "$(python3.8 -c 'import cloudscraper as _; print(_.__path__[0])' | tail -n 1):cloudscraper" --add-data "Img:Img"
|
||||||
cp config.ini ./dist
|
cp config.ini ./dist
|
||||||
|
|||||||
@@ -11,5 +11,5 @@ if [ '$(dpkg --print-architecture)' != 'amd64' ] || [ '$(dpkg --print-architectu
|
|||||||
#cd ../
|
#cd ../
|
||||||
fi
|
fi
|
||||||
pip3 install -r requirements.txt
|
pip3 install -r requirements.txt
|
||||||
pyinstaller --onefile AV_Data_Capture.py --hidden-import ADC_function.py --hidden-import core.py --add-data "$(python3 -c 'import cloudscraper as _; print(_.__path__[0])' | tail -n 1):cloudscraper"
|
pyinstaller --onefile AV_Data_Capture.py --hidden-import ADC_function.py --hidden-import core.py --add-data "$(python3 -c 'import cloudscraper as _; print(_.__path__[0])' | tail -n 1):cloudscraper" --add-data "Img:Img"
|
||||||
cp config.ini ./dist
|
cp config.ini ./dist
|
||||||
|
|||||||
Reference in New Issue
Block a user