This commit is contained in:
itswait
2020-08-21 10:31:27 +08:00
parent 3a019a0430
commit 51ad58445e
5 changed files with 37 additions and 61 deletions

View File

@@ -10,21 +10,13 @@ on:
jobs: jobs:
Linux: Linux:
outputs:
version: ${{ steps.version.outputs.VERSION }}
runs-on: ubuntu-latest runs-on: ubuntu-latest
env:
version: ${{ outputs.version }}
steps: steps:
- id: version
run: echo "::set-output name=VERSION::$(cat AV_Data_Capture.py | grep "version = " | tr -d "version = '")"
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- name: Set up Python 3.8 - name: Setup Python 3.8
uses: actions/setup-python@v1 uses: actions/setup-python@v2
with: with:
python-version: 3.8 python-version: 3.8
@@ -33,21 +25,17 @@ jobs:
python -m pip install --upgrade pip python -m pip install --upgrade pip
pip install -r requirements.txt pip install -r requirements.txt
- name: Test number_perser.get_number - name: Set build version
run: | run: |
python number_parser.py -v version=$(python -c 'import AV_Data_Capture; print(AV_Data_Capture.__version__)')
echo "::set-env name=VERSION::$version"
- name: Set CLOUDSCRAPER_PATH variable - name: Build with PyInstaller
run: |
echo "::set-env name=CLOUDSCRAPER_PATH::$(python -c 'import cloudscraper as _; print(_.__path__[0])' | tail -n 1)"
- name: Build with pyinstaller
run: | run: |
pyinstaller \ pyinstaller \
--onefile AV_Data_Capture.py \ --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"
- name: Copy config.ini - name: Copy config.ini
run: | run: |
@@ -56,19 +44,17 @@ jobs:
- name: Upload build artifact - name: Upload build artifact
uses: actions/upload-artifact@v1 uses: actions/upload-artifact@v1
with: with:
name: AV_Data_Capture-CLI-${{ env.version }}-Linux name: AV_Data_Capture-CLI-${{ env.VERSION }}-Linux
path: dist path: dist
Windows: Windows:
runs-on: windows-latest runs-on: windows-latest
needs: Linux
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- name: Set up Python 3.8 - name: Setup Python 3.8
uses: actions/setup-python@v1 uses: actions/setup-python@v2
with: with:
python-version: 3.8 python-version: 3.8
@@ -77,21 +63,17 @@ jobs:
python -m pip install --upgrade pip python -m pip install --upgrade pip
pip install -r requirements.txt pip install -r requirements.txt
- name: Test number_perser.get_number - name: Set build version
run: | run: |
python number_parser.py -v $env:version=$(python -c 'import AV_Data_Capture; print(AV_Data_Capture.__version__)')
echo "::set-env name=VERSION::$env:version"
- name: Set CLOUDSCRAPER_PATH variable - name: Build with PyInstaller
run: |
echo "::set-env name=CLOUDSCRAPER_PATH::$(python -c 'import cloudscraper as _; print(_.__path__[0])' | tail -n 1)"
- name: Build with pyinstaller
run: | run: |
pyinstaller ` pyinstaller `
--onefile AV_Data_Capture.py ` --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 "$env:CLOUDSCRAPER_PATH;cloudscraper"
- name: Copy config.ini - name: Copy config.ini
run: | run: |
@@ -100,19 +82,17 @@ jobs:
- name: Upload build artifact - name: Upload build artifact
uses: actions/upload-artifact@v1 uses: actions/upload-artifact@v1
with: with:
name: AV_Data_Capture-CLI-${{ needs.Linux.env.version }}-Windows name: AV_Data_Capture-CLI-${{ env.VERSION }}-Windows
path: dist path: dist
MacOS: MacOS:
needs: Linux
runs-on: macos-latest runs-on: macos-latest
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- name: Set up Python 3.8 - name: Setup Python 3.8
uses: actions/setup-python@v1 uses: actions/setup-python@v2
with: with:
python-version: 3.8 python-version: 3.8
@@ -121,21 +101,17 @@ jobs:
python -m pip install --upgrade pip python -m pip install --upgrade pip
pip install -r requirements.txt pip install -r requirements.txt
- name: Test number_perser.get_number - name: Set build version
run: | run: |
python number_parser.py -v version=$(python -c 'import AV_Data_Capture; print(AV_Data_Capture.__version__)')
echo "::set-env name=VERSION::$version"
- name: Set CLOUDSCRAPER_PATH variable - name: Build with PyInstaller
run: |
echo "::set-env name=CLOUDSCRAPER_PATH::$(python -c 'import cloudscraper as _; print(_.__path__[0])' | tail -n 1)"
- name: Build with pyinstaller
run: | run: |
pyinstaller \ pyinstaller \
--onefile AV_Data_Capture.py \ --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"
- name: Copy config.ini - name: Copy config.ini
run: | run: |
@@ -144,5 +120,5 @@ jobs:
- name: Upload build artifact - name: Upload build artifact
uses: actions/upload-artifact@v1 uses: actions/upload-artifact@v1
with: with:
name: AV_Data_Capture-CLI-${{ needs.Linux.env.version }}-MacOS name: AV_Data_Capture-CLI-${{ env.VERSION }}-MacOS
path: dist path: dist

View File

@@ -59,6 +59,8 @@ def get_html(url, cookies: dict = None, ua: str = None, return_type: str = None)
if return_type == "object": if return_type == "object":
return result return result
elif return_type == "json":
return result.json()
else: else:
return result.text return result.text

View File

@@ -3,15 +3,14 @@ from core import *
import os import os
from number_parser import get_number from number_parser import get_number
__version__ = '3.7.1'
def check_update(local_version): def check_update():
data = json.loads(get_html("https://api.github.com/repos/yoshiko2/AV_Data_Capture/releases/latest")) latest = get_html("https://api.github.com/repos/yoshiko2/AV_Data_Capture/releases/latest",
return_type="json")["tag_name"]
remote = data["tag_name"] if __version__ != latest:
local = local_version line1 = "* New update " + str(latest) + " *"
if not local == remote:
line1 = "* New update " + str(remote) + " *"
print("[*]" + line1.center(54)) print("[*]" + line1.center(54))
print("[*]" + "↓ Download ↓".center(54)) print("[*]" + "↓ Download ↓".center(54))
print("[*] https://github.com/yoshiko2/AV_Data_Capture/releases") print("[*] https://github.com/yoshiko2/AV_Data_Capture/releases")
@@ -111,7 +110,6 @@ def create_data_and_move_with_custom_number(file_path: str, c: config.Config, cu
if __name__ == '__main__': if __name__ == '__main__':
version = '3.7.1'
# Parse command line args # Parse command line args
single_file_path, config_file, auto_exit, custom_number = argparse_function() single_file_path, config_file, auto_exit, custom_number = argparse_function()
@@ -119,13 +117,13 @@ if __name__ == '__main__':
# Read config.ini # Read config.ini
conf = config.Config(path=config_file) conf = config.Config(path=config_file)
version_print = 'Version ' + version version_print = 'Version ' + __version__
print('[*]================== AV Data Capture ===================') print('[*]================== AV Data Capture ===================')
print('[*]' + version_print.center(54)) print('[*]' + version_print.center(54))
print('[*]======================================================') print('[*]======================================================')
if conf.update_check(): if conf.update_check():
check_update(version) check_update()
create_failed_folder(conf.failed_folder()) create_failed_folder(conf.failed_folder())
os.chdir(os.getcwd()) os.chdir(os.getcwd())

View File

@@ -1,4 +1,4 @@
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
rmdir /s/q build rmdir /s/q build
rmdir /s/q __pycache__ rmdir /s/q __pycache__
pause pause

View File

@@ -1,5 +1,5 @@
{ {
. "version": "3.7.1", "version": "3.7.1",
"version_show": "3.7.1", "version_show": "3.7.1",
"download": "https://github.com/yoshiko2/AV_Data_Capture/releases" "download": "https://github.com/yoshiko2/AV_Data_Capture/releases"
} }