Skip to content

Commit

Permalink
Update scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
BingLingGroup committed Jul 10, 2019
1 parent f777ad1 commit ad9f14b
Show file tree
Hide file tree
Showing 15 changed files with 62 additions and 20 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ MANIFEST
/.idea
/.build_and_dist
/.build_and_dist27
/.release
8 changes: 4 additions & 4 deletions autosub/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,10 @@ def validate(args):
"""
Check that the CLI arguments passed to autosub are valid.
"""
if not args.source_path:
print("Error: You need to specify a source path.")
return False

if args.format not in FORMATTERS:
print(
"Subtitle format not supported. "
Expand Down Expand Up @@ -403,10 +407,6 @@ def validate(args):
)
return False

if not args.source_path:
print("Error: You need to specify a source path.")
return False

return True


Expand Down
13 changes: 0 additions & 13 deletions build_cmds/create_release.bat

This file was deleted.

4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
six==1.12.0
pysubs2==0.2.4
requests==2.21.0
pysrt==1.1.1
setuptools==40.6.2
requests==2.21.0
google_api_python_client==1.7.9
progressbar2==3.42.0
pysubs2==0.2.4
28 changes: 28 additions & 0 deletions scripts/GENERATE.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import hashlib, os, sys

text = '''| 文件名 | SHA256 |
| :- | :- |'''

def checksum(filename):
algorithm = hashlib.sha256()
with open(filename, 'rb') as f:
for byte_block in iter(lambda: f.read(4096), b''):
algorithm.update(byte_block)
return str(algorithm.hexdigest())


def filelist(path):
r = []
n = os.listdir(path)
for f in n:
if not os.path.isdir(f):
r.append(f)
return r

if len(sys.argv) == 2:
print(text)
r = filelist(str(sys.argv[1]))
for i in r:
print('| {0} | {1} |'.format(i, checksum(str(sys.argv[1]) + '\\' + i)))
13 changes: 13 additions & 0 deletions scripts/create_release.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
set "release_name=autosub"
set "package_name=autosub"

cd %~dp0
mkdir "..\.release\%package_name%"
cp "release_files\run.bat" "..\.release\%package_name%"
cp "release_files\help.bat" "..\.release\%package_name%"
cp "..\.build_and_dist\pyinstaller.build\%release_name%.exe" "..\.release\%package_name%"
call update_requirements.bat
cp "..\requirements.txt" "..\.release\%package_name%"
7z a -sdel "..\.release\%release_name%-alpha-win-x64.7z" "..\.release\%package_name%"
%PY_HOME%\python GENERATE.py "..\.release"
call cmd
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
set dist_dir="..\.build_and_dist\pyinstaller.build"

@echo on
cd %~dp0
pyinstaller pyinstaller_build.spec --clean --distpath %dist_dir% --workpath %dist_dir%
call cmd
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,5 @@ exe = EXE(pyz,
debug=False,
bootloader_ignore_signals=False,
strip=False,
upx=True,
upx=False,
console=True )
5 changes: 5 additions & 0 deletions scripts/release_files/help.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
@echo off
set package_name=autosub
@echo on
%package_name% -h
call cmd
7 changes: 7 additions & 0 deletions scripts/release_files/run.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
@echo off
set package_name=autosub
set "file_name="
rem input your file name between '=' and '"'
@echo on
%package_name% -S en-US "%file_name%"
call cmd
File renamed without changes.

0 comments on commit ad9f14b

Please sign in to comment.