Currently --Output=JSON outputs a json object if passed a single file and an array of json objects if passed 2+ files:
$ mediainfo --Output=JSON 1.mkv
{ ... }
$ mediainfo --Output=JSON 1.mkv 2.mkv
[ { ... }, { ... } ]
This creates a problem in scripts that deal with arbitrary number of files (sometimes 1, sometimes 2+) as an object and an array of objects need to be handled differently.
Suggestion: always output an array of objects (in case of 1 file - an array with a single object).
Currently
--Output=JSONoutputs a json object if passed a single file and an array of json objects if passed 2+ files:$ mediainfo --Output=JSON 1.mkv { ... } $ mediainfo --Output=JSON 1.mkv 2.mkv [ { ... }, { ... } ]This creates a problem in scripts that deal with arbitrary number of files (sometimes 1, sometimes 2+) as an object and an array of objects need to be handled differently.
Suggestion: always output an array of objects (in case of 1 file - an array with a single object).