[CLI][JSON] Make JSON structure uniform for 1 and 2+ input files
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).
Hi
I've submitted a PR to MediaArea/MediaInfoLib that should resolve this issue. Please take a look and let me know if you have any comments?
Thanks!
Thanks @trallen, PR description looks good. Tried building from your branch to test but couldn't get ZenLib to work.
Can refer to https://github.com/MediaArea/MediaInfo/blob/master/.github/workflows/MediaInfo_Checks.yml for how to successfully build CLI.
Can refer to https://github.com/MediaArea/MediaInfo/blob/master/.github/workflows/MediaInfo_Checks.yml for how to successfully build CLI.
Thanks, building with autotools worked (I was trying cmake+ninja before).