From bc8dbbd2f6fa37ddd19e62e3c227f66cb501c34a Mon Sep 17 00:00:00 2001 From: j Date: Fri, 24 Jan 2025 15:04:00 +0530 Subject: [PATCH] better array parsing --- pandora_upload/__init__.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/pandora_upload/__init__.py b/pandora_upload/__init__.py index aca4944..2b1940a 100755 --- a/pandora_upload/__init__.py +++ b/pandora_upload/__init__.py @@ -59,19 +59,21 @@ def main(): print('\ninvalid metadata argument, format is -m "key=value"') sys.exit(1) k, v = m.split('=', 1) + if v[0] == '[' and v[-1] == ']': + v = [v[1:-1]] if k in meta: if isinstance(meta[k], str): meta[k] = [meta[k]] - meta[k].append(v) - elif v[0] == '[' and v[-1] == ']': - meta[k] = v[1:-1] + if isinstance(v, list): + meta[k].update(v) + else: + meta[k].append(v) else: meta[k] = v files = opts.files if not files: parser.print_help() sys.exit(1) - id = upload(opts.api_url, files, meta) print(id)