From 178d935ca470c51d5aa77f8d8f1327b03d91ee40 Mon Sep 17 00:00:00 2001 From: j Date: Fri, 24 Jan 2025 14:28:56 +0530 Subject: [PATCH] support meta arrays --- README.md | 2 +- pandora_upload/__init__.py | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 7f5c215..83019fb 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ To upload/sync large repositories use pandora_client Upload a file from the command line: ``` sh -pandora-upload -p http://pandora/api/ -m "title=This is an example" -m "date=2021-11-15" /home/example/Videos/video.mp4 +pandora-upload -p http://pandora/api/ -m "title=This is an example" -m "director=[Jane Doe]" -m "date=2021-11-15" /home/example/Videos/video.mp4 ``` or you can use pandora-upload in a python script: diff --git a/pandora_upload/__init__.py b/pandora_upload/__init__.py index ce8226b..aca4944 100755 --- a/pandora_upload/__init__.py +++ b/pandora_upload/__init__.py @@ -59,7 +59,14 @@ def main(): print('\ninvalid metadata argument, format is -m "key=value"') sys.exit(1) k, v = m.split('=', 1) - meta[k] = v + 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] + else: + meta[k] = v files = opts.files if not files: parser.print_help()