Skip to content

Commit

Permalink
add scripts for unix
Browse files Browse the repository at this point in the history
  • Loading branch information
seiya-git committed Nov 22, 2023
1 parent 58a2164 commit d4259fb
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 31 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ __pycache__
smartgit*

build/**
!build/bin/**
!setup.py
!setup-build.bat
!setup-build.sh
Expand Down
File renamed without changes.
File renamed without changes.
9 changes: 9 additions & 0 deletions build/setup-build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash

SCRIPTPATH="$( cd "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"
cd "$SCRIPTPATH/.."

cp -r ./py/* ./build
cp LICENSE.md ./build
cp README.md ./build
python3 -m build build
6 changes: 4 additions & 2 deletions build/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,16 @@

setuptools.setup(
name = 'nstools',
version = '1.1.5.dev5',
version = '1.1.5.dev10',
url = 'https://github.com/seiya-dev/NSTools',
long_description = long_description,
long_description_content_type = 'text/markdown',
license = 'MIT',

scripts = [
'ns_verify_folder.py'
'bin/ns-verify-folder',
'bin/ns-verify-folder-log',
'ns_verify_folder.py',
],

packages = [
Expand Down
58 changes: 29 additions & 29 deletions py/ns_verify_folder.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
print(f'[:INFO:] App Path: {appPath}')

# set logs path
logs_dir = os.path.abspath(os.path.join(appPath, '..', 'logs'))
print(f'[:INFO:] Logs Path: {logs_dir}')
# logs_dir = os.path.abspath(os.path.join(appPath, '..', 'logs'))
# print(f'[:INFO:] Logs Path: {logs_dir}')

import argparse
parser = argparse.ArgumentParser(formatter_class = argparse.ArgumentDefaultsHelpFormatter)
Expand All @@ -34,7 +34,7 @@

Keys.load_default()
if not Keys.keys_loaded:
input("Press Enter to exit...")
input('Press Enter to exit...')
sys.exit(1)

def send_hook(message_content: str = '', PadPrint: bool = False):
Expand All @@ -59,9 +59,9 @@ def scan_folder():
ipath = os.path.abspath(INCP_PATH)
fname = os.path.basename(ipath).upper()

lpath_badfolder = os.path.join(logs_dir, 'bad-folder.log')
lpath_badname = os.path.join(logs_dir, 'bad-names.log')
lpath_badfile = os.path.join(logs_dir, 'bad-file.log')
# lpath_badfolder = os.path.join(logs_dir, 'bad-folder.log')
# lpath_badname = os.path.join(logs_dir, 'bad-names.log')
# lpath_badfile = os.path.join(logs_dir, 'bad-file.log')

if not os.path.exists(logs_dir):
os.makedirs(logs_dir)
Expand Down Expand Up @@ -98,28 +98,28 @@ def scan_folder():

if data is None:
send_hook(f'{item_path}: BAD NAME')
with open(lpath_badname, 'a') as f:
f.write(f'{item_path}\n')
# with open(lpath_badname, 'a') as f:
# f.write(f'{item_path}\n')

if data is not None and re.match(r'^BASE|UPD(ATE)?|DLC|XCI$', fname) is not None:
if item.lower().endswith(('.xci', '.xcz')):
iscart = True
else:
iscart = False
if fname == 'UPDATE':
fname = 'UPD'
if fname == 'BASE' and data['title_type'] != 'BASE' or fname == 'BASE' and iscart == True:
with open(lpath_badfolder, 'a') as f:
f.write(f'{item_path}\n')
if fname == 'UPD' and data['title_type'] != 'UPD' or fname == 'UPD' and iscart == True:
with open(lpath_badfolder, 'a') as f:
f.write(f'{item_path}\n')
if fname == 'DLC' and data['title_type'] != 'DLC' or fname == 'DLC' and iscart == True:
with open(lpath_badfolder, 'a') as f:
f.write(f'{item_path}\n')
if fname == 'XCI' and iscart == False:
with open(lpath_badfolder, 'a') as f:
f.write(f'{item_path}\n')
# if data is not None and re.match(r'^BASE|UPD(ATE)?|DLC|XCI$', fname) is not None:
# if item.lower().endswith(('.xci', '.xcz')):
# iscart = True
# else:
# iscart = False
# if fname == 'UPDATE':
# fname = 'UPD'
# if fname == 'BASE' and data['title_type'] != 'BASE' or fname == 'BASE' and iscart == True:
# with open(lpath_badfolder, 'a') as f:
# f.write(f'{item_path}\n')
# if fname == 'UPD' and data['title_type'] != 'UPD' or fname == 'UPD' and iscart == True:
# with open(lpath_badfolder, 'a') as f:
# f.write(f'{item_path}\n')
# if fname == 'DLC' and data['title_type'] != 'DLC' or fname == 'DLC' and iscart == True:
# with open(lpath_badfolder, 'a') as f:
# f.write(f'{item_path}\n')
# if fname == 'XCI' and iscart == False:
# with open(lpath_badfolder, 'a') as f:
# f.write(f'{item_path}\n')

rootpath = os.path.dirname(item_path)
basename = os.path.basename(item_path)
Expand All @@ -131,8 +131,8 @@ def scan_folder():
nspTest, nspLog = Verify.verify(item_path)
if nspTest != True:
send_hook(f'{item_path}: BAD', True)
with open(lpath_badfile, 'a') as f:
f.write(f'{item_path}\n')
# with open(lpath_badfile, 'a') as f:
# f.write(f'{item_path}\n')
else:
send_hook(f'{item_path}: OK', True)
if SAVE_VLOG == True:
Expand Down

0 comments on commit d4259fb

Please sign in to comment.