pyslk.hsm2json_file

Contents

pyslk.hsm2json_file#

pyslk.hsm2json_file(outfile: str, resources: str | Path | list = '', search_id: int = -1, recursive: bool = False, restart_file: str | None = None, schema: str | list | None = None, write_json_lines: bool = False, write_mode: str | None = None, instant_metadata_record_output: bool = False, print_hidden: bool = False) None#

Extract metadata from HSM file(s) and return them in JSON structure

Parameters:
  • outfile (str or Path) – Write the output into a file instead to the stdout

  • resources (str or Path or list) – list of resources to be searched for

  • search_id (int) – id of a search

  • recursive (bool) – export metadata from all files in gns_path recursively

  • restart_file (str = None,) – set a restart file in which the processed metadata entries are listed

  • schema (str, list or None) – import only metadata fields of listed schemata; if str: comma-separated list without spaces

  • write_json_lines (bool = False) – write JSON-lines instead of JSON

  • write_mode (str = None) – applies when ‘output’ is set; possible values: OVERWRITE, ERROR

  • instant_metadata_record_output (bool) – False (default): read metadata of all files and write/print out afterward; True: write/print each metadata record after it has been read (requires ‘write_json_lines’)

  • print_hidden (bool) – print read-only not-searchable metadata fields (sidecar file) [default: False]

Returns:

nothing; throws an error if writing failed

Return type:

None