support meta arrays
This commit is contained in:
parent
e8cd807eff
commit
178d935ca4
2 changed files with 9 additions and 2 deletions
|
@ -8,7 +8,7 @@ To upload/sync large repositories use pandora_client
|
||||||
Upload a file from the command line:
|
Upload a file from the command line:
|
||||||
|
|
||||||
``` sh
|
``` 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:
|
or you can use pandora-upload in a python script:
|
||||||
|
|
|
@ -59,6 +59,13 @@ def main():
|
||||||
print('\ninvalid metadata argument, format is -m "key=value"')
|
print('\ninvalid metadata argument, format is -m "key=value"')
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
k, v = m.split('=', 1)
|
k, v = m.split('=', 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]
|
||||||
|
else:
|
||||||
meta[k] = v
|
meta[k] = v
|
||||||
files = opts.files
|
files = opts.files
|
||||||
if not files:
|
if not files:
|
||||||
|
|
Loading…
Add table
Reference in a new issue