support meta arrays

This commit is contained in:
j 2025-01-24 14:28:56 +05:30
parent e8cd807eff
commit 178d935ca4
2 changed files with 9 additions and 2 deletions

View file

@ -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:

View file

@ -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()