76 lines
1.7 KiB
Python
76 lines
1.7 KiB
Python
import argparse
|
|
import json
|
|
import requests
|
|
import os
|
|
|
|
parser = argparse.ArgumentParser(description='Videos to images')
|
|
|
|
parser.add_argument(
|
|
'-d',
|
|
'--dir',
|
|
type=str,
|
|
default='dist',
|
|
help='Директоия билда'
|
|
)
|
|
|
|
parser.add_argument(
|
|
'-fjs',
|
|
'--file_js',
|
|
type=str,
|
|
default='index.js',
|
|
help='Файл javascript билда'
|
|
)
|
|
|
|
parser.add_argument(
|
|
'-fcss',
|
|
'--file_css',
|
|
type=str,
|
|
default='index.css',
|
|
help='Файл css билда'
|
|
)
|
|
|
|
parser.add_argument(
|
|
'-f',
|
|
'--file',
|
|
type=str,
|
|
default='script.js',
|
|
help='Файл билда'
|
|
)
|
|
|
|
parser.add_argument(
|
|
'-st',
|
|
'--stable',
|
|
action='store_true',
|
|
help='Стабильная версия'
|
|
)
|
|
|
|
parser.add_argument(
|
|
'-pj',
|
|
'--package',
|
|
default='package.json',
|
|
help='Путь к файлу package.json'
|
|
)
|
|
|
|
if __name__ == '__main__':
|
|
args = parser.parse_args()
|
|
|
|
if os.path.exists(args.package):
|
|
d = json.load(open(args.package, 'rb'))
|
|
|
|
print("package name: {name}".format(name=d['name']))
|
|
print("package version: {version}".format(version=d['version']))
|
|
|
|
filepath = args.file
|
|
if os.path.exists(filepath):
|
|
file = {'file': open(filepath, 'rb')}
|
|
res = requests.post(url='https://cdn.itguild.info/uploadfile/',
|
|
files=file, data={'package': d['name'], 'version': d['version'], 'filename': os.path.basename(args.file), 'stable': args.stable})
|
|
if res.ok:
|
|
print(f"Successfully uploaded {filepath}")
|
|
print(res.text)
|
|
else:
|
|
print("Wrong")
|
|
|
|
else:
|
|
print("package.json not found")
|