From 3f1645dbc488027d07da5f437d7bd98c48215f6f Mon Sep 17 00:00:00 2001 From: Castro0o Date: Wed, 19 Feb 2020 10:02:47 +0100 Subject: [PATCH] documentation & helper script --- README.md | 6 ++++++ helper-upload_imgs_dir.sh | 21 +++++++++++++++++++++ upload_imgs_dir.py | 31 ++++++++++++++----------------- 3 files changed, 41 insertions(+), 17 deletions(-) create mode 100755 helper-upload_imgs_dir.sh diff --git a/README.md b/README.md index f07bb5f..56fe182 100644 --- a/README.md +++ b/README.md @@ -78,3 +78,9 @@ Each of the saved documents: * resulting in `static_html/index.html` +# Bulk image upload upload_imgs_dir.py + +Get Help: `python upload_imgs_dir.py --help` + +**Edit and run via** `.helper-upload_imgs_dir.sh` + diff --git a/helper-upload_imgs_dir.sh b/helper-upload_imgs_dir.sh new file mode 100755 index 0000000..138539f --- /dev/null +++ b/helper-upload_imgs_dir.sh @@ -0,0 +1,21 @@ +#!/bin/sh + +python3 upload_imgs_dir.py \ +--title 'Ang Bayan December 1984' \ +--creator 'Central Committee of the Communist Party of the Philippines' \ +--date '1984/12/01' \ +--org 'Communist Party of the Philippines' \ +--format 'Bulletin' \ +--topic 'Communism, Armed Struggle' \ +--dir '/full/path/to/2020_bantayog/Folder name' \ +# --dry + +# Note: +# * Add this values to you upload specific upload. +# * --dry can be enabled to show you what will be uploaded and the metadata, without actully uploading it +# * parameters --event --topic can be added +# * \ allow you to continue the command of a different line +# +# Get help: python3 upload_imgs_dir.py --help + + diff --git a/upload_imgs_dir.py b/upload_imgs_dir.py index 1eb6b4e..3c47d8d 100644 --- a/upload_imgs_dir.py +++ b/upload_imgs_dir.py @@ -16,31 +16,26 @@ p.add_argument('--dry', '-d', action='store_true', help='dry-run: will only print the metadata of each file that ' 'will be upload, but does NOT upload') p.add_argument('--dir', required=True, - help='Full path of the image directory, that you wish to upload') + help='Required. Full path of the image directory, that you wish to upload') p.add_argument('--title', required=True, - help='Metadata **Title** value of publication. Must not exist yet' - ' in the wiki.') + help='Required. Must not exist yet in the wiki.') p.add_argument('--date', required=True, - help='Metadata **Date** value of publication. Format yyyy/mm/dd ' - 'For dates without day or mont use 01 as default ' + help='Required. Format: yyyy/mm/dd ' + 'For dates without day or month use 01 as default ' 'ie. 1986: --date "1986/01/01" ' 'March 1985: --date "1984/05/01"') p.add_argument('--creator', required=False, action='append', default=[''], - help='Metadata **Creator** value(s) of publication. Multiple ' - 'values should be SEPARATED BY COMMA') -p.add_argument('--organization', required=False, action='append', default=[''], - help='Metadata **Organization** value(s) of publication. ' - 'Multiple values should be SEPARATED BY COMMA') + help='Multiple values should be SEPARATED BY COMMA') +p.add_argument('--org', required=False, action='append', default=[''], + help='Organization:Multiple values should be SEPARATED BY ' + 'COMMA') p.add_argument('--format', required=False, action='append', default=[''], - help='Metadata **Format** value(s) of publication. ' - 'Multiple values should be SEPARATED BY COMMA') + help='Multiple values should be SEPARATED BY COMMA') p.add_argument('--event', required=False, action='append', default=[''], - help='Metadata **Event** value(s) of publication. ' - 'Multiple values should be SEPARATED BY COMMA') + help='Multiple values should be SEPARATED BY COMMA') p.add_argument('--topic', required=False, action='append', default=[''], - help='Metadata **Topic** value(s) of publication. ' - 'Multiple values should be SEPARATED BY COMMA') + help='Multiple values should be SEPARATED BY COMMA') # TODO ADD NEW PROPS args = p.parse_args() @@ -91,7 +86,7 @@ for n, _file in enumerate(lsimgs): part=n + 1, partof=len(lsimgs), creator=(', ').join(args.creator[1:]), - organization=(', ').join(args.organization[1:]), + organization=(', ').join(args.org[1:]), format=(', ').join(args.format[1:]), event=(', ').join(args.event[1:]), topic=(', ').join(args.topic[1:]) @@ -113,4 +108,6 @@ for n, _file in enumerate(lsimgs): level='fail') print(f'See image at {pageurl}') + else: + print(img_smw_prop_val)