|
|
@ -64,8 +64,6 @@ elif len(list(site.ask(f'[[Title::{args.title}]]'))) > 0:
|
|
|
|
print_colormsg(f'Error: --title "{args.title}" already exists in wiki. Provide a different one', level='fail')
|
|
|
|
print_colormsg(f'Error: --title "{args.title}" already exists in wiki. Provide a different one', level='fail')
|
|
|
|
sys.exit()
|
|
|
|
sys.exit()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
lsimgs = reorder_imgs(dir=args.dir, dry=args.dry)
|
|
|
|
lsimgs = reorder_imgs(dir=args.dir, dry=args.dry)
|
|
|
|
dirname = os.path.split(args.dir)[-1].replace(' ', '_')
|
|
|
|
dirname = os.path.split(args.dir)[-1].replace(' ', '_')
|
|
|
|
dirname = re.sub(r'[\W]', '', dirname) #remove non letters or digits
|
|
|
|
dirname = re.sub(r'[\W]', '', dirname) #remove non letters or digits
|
|
|
@ -87,31 +85,23 @@ for n, _file in enumerate(lsimgs):
|
|
|
|
date=args.date,
|
|
|
|
date=args.date,
|
|
|
|
part=n + 1,
|
|
|
|
part=n + 1,
|
|
|
|
partof=len(lsimgs),
|
|
|
|
partof=len(lsimgs),
|
|
|
|
creator=(',').join(args.creator[1:]),
|
|
|
|
creator=(', ').join(args.creator[1:]),
|
|
|
|
organization=(',').join(args.organization[1:]),
|
|
|
|
organization=(', ').join(args.organization[1:]),
|
|
|
|
format=(',').join(args.format[1:]),
|
|
|
|
format=(', ').join(args.format[1:]),
|
|
|
|
event=(',').join(args.event[1:]),
|
|
|
|
event=(', ').join(args.event[1:]),
|
|
|
|
topic=(',').join(args.topic[1:])
|
|
|
|
topic=(', ').join(args.topic[1:])
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
print(img_smw_prop_val)
|
|
|
|
_file_path = os.path.join(args.dir, _file)
|
|
|
|
|
|
|
|
print(_file_path)
|
|
|
|
if args.dry == True:
|
|
|
|
if not args.dry:
|
|
|
|
print(args)
|
|
|
|
with open(_file_path, 'rb') as _f:
|
|
|
|
sys.exit()
|
|
|
|
site.upload(file=_file_path,
|
|
|
|
|
|
|
|
filename=pagename,
|
|
|
|
|
|
|
|
description=img_smw_prop_val,
|
|
|
|
|
|
|
|
ignore=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
print(img_smw_prop_val)
|
|
|
|
|
|
|
|
print(f'https://{args.host}{args.path}index.php/File:{pagename}')
|
|
|
|
|
|
|
|
|
|
|
|
filename = 'cat2.jpg'
|
|
|
|
|
|
|
|
page = site.images[filename]
|
|
|
|
|
|
|
|
img_url = f'https://{args.host}{args.path}/index.php/File:{filename}'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if page.exists is True:
|
|
|
|
|
|
|
|
print(f'{filename} is already upload it, you can see it at {img_url}' )
|
|
|
|
|
|
|
|
print('The upload process wont proceed. Please upload all images in folder by hand')
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
with open(filename, 'rb') as _file:
|
|
|
|
|
|
|
|
dirname = (os.path.split(dir)[-1])
|
|
|
|
|
|
|
|
site.upload(file=_file, filename=f'{dirname}_{filename}',
|
|
|
|
|
|
|
|
description='img_smw_prop_val', ignore=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|