Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Option for the user to choose extension for metadata #3

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions gallery.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ def CleanStr(arg):
parser = argparse.ArgumentParser()
parser.add_argument('input', help='input directory')
parser.add_argument('--verbose', '-v', action='store_true', help='print some info to the screen')
parser.add_argument('--metadata', '-m', default='.json', help='extension for metadata informations (note the preceeding dot)')
parser.add_argument('--title-size', default='100', help='scale the text size of the plot titles, expressed as a percentage [0-100]')
# parser.add_argument('output', help='output directory')
args = parser.parse_args()
Expand Down Expand Up @@ -80,9 +81,11 @@ def ProcessDir(indir, is_parent=True, subdirs=[]):
groups = defaultdict(set)

for f, all_exts in sorted(base_files.iteritems()):
exts = [e for e in all_exts if e not in ['.png', '.json']]
exts = [e for e in all_exts if e not in ['.png', args.metadata]]
tags=''
if '.json' in all_exts:

# For now only getting metadata from json is supported
if args.metadata in all_exts and args.metadata==".json":
json_data = {}
with open(os.path.join(indir,f+'.json')) as jsonfile:
json_data = json.load(jsonfile)
Expand Down