pyslk.hsm2json_raw

Contents

pyslk.hsm2json_raw#

pyslk.hsm2json_raw(resources: str | list | Path | None = None, search_id: int = -1, recursive: bool = False, outfile: str | Path | None = None, restart_file: str | Path | None = None, schema: str | list | None = None, write_json_lines: bool = False, verbose: bool = False, quiet: bool = False, write_mode: str | None = None, print_summary: bool = False, print_json_summary: bool = False, write_compact_json: bool = False, instant_metadata_record_output: bool = False, print_hidden: bool = False, return_type: int = 0) str | int | CompletedProcess#

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

Parameters:
  • resources (str or list or Path-like or None) – list of resources to be searched for [default: None]

  • search_id (int) – id of a search

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

  • outfile (str or Path-like or None) – Write the output into a file instead to the stdout [default: None]

  • restart_file (str or Path-like or None) – set a restart file in which the processed metadata entries are listed [default: None]

  • 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

  • verbose (bool = False) – verbose mode

  • quiet (bool = False) – quiet mode

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

  • print_summary (bool = False) – print summary on how many metadata records have been processed [default: False]

  • print_json_summary (bool = False) – print summary on how many metadata records have been processed as JSON [default: False]

  • write_compact_json (bool = False) – write JSON metadata in a compact form with less line breaks [default: False]

  • instant_metadata_record_output (bool) – False (default): read metadata of all files and write/print out afterwards; 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]

  • return_type (int) – select between 0 (== str output), 1 (== exit code), 2 (subprocess output)

Returns:

stdout of the slk_helpers call

Return type:

Union[str, int, subprocess.CompletedProcess]