darkbridge.core – Convert Nikon sidecar files

Convert Nikon sidecar files

The core module schedules operations to convert the sidecar files. Main task are filtering/checking the supported image files, parsing the Nikon sidecar files, transforming the metadata and wrinting the result in a XMP sidecar file compliant with Darktable.

The exported classes, exceptions and functions (and any other objects) are as follows:

darkbridge.core exceptions

Todo

review the list after completing

darkbridge.core classes

darkbridge.core constants

Todo

review the list after completing

Using darkbridge.core

Todo

describe how using the module

darkbridge.core reference manual

class darkbridge.core.DarkBridge(pathname: list[str])

Bases: object

Convert sidecar files from Nikon NX Studio (.nksc) in sidecar files compliant with Darktable.

Using darkbridge

This class is the scheduler and handles elementary operations to complete the expected task.

The easiest way of using this class is to call the run method. This all-in-one method searches sidecar files in the required folders (and subfolders if required), reads the metadata and create or modify the sidecar files in XMP format at the same level as the original image file.

To have more control, you must call individually each method. A typical use case is to build the images files list by calling parse method and run the conversion by calling convert

Reference

convert(dry_run: bool, force: bool, recursive: bool) bool

Run the conversion.

Parameters:
  • dry_runTrue runs in preview mode without any sidecar writing.

  • forceTrue overwrites existing sidecar files without prompting for confirmation.

  • recursiveTrue make a recursive search of images files in subfolders.

Returns:

True if the execution went well. In case of failure, an error is written on console.

filter(path: Path) None | list[Path]

Filter the file list by removing no supported images files or images files without sidecar files.

Parameters:

path – path of an image file.

Returns:

the path of the image file and the path of the Nikon sidecar file. None if the image file is not supported or without sidecar

Return type:

a list of two path

list_filters(all: bool) bool

list the image adjustment filters.

Parameters:

allTrue includes all filters in the list, False limits the list to only active filters.

Returns:

True if the execution went well. In case of failure, an error is written on console.

list_metadata() bool

list the metadata specified in the sidecar files.

Returns:

True if the execution went well. In case of failure, an error is written on console.

parse(recursive: bool) bool

Build the images files list based on patterns as defined in glob.glob functions.

Returns:

True if the execution went well. In case of failure, an error is written on console.

run(dry_run: bool, force: bool, recursive: bool) bool

All-in-one entry point to run the conversion

Parameters:
  • dry_runTrue runs in preview mode without any sidecar writing.

  • forceTrue overwrites existing sidecar files without prompting for confirmation.

  • recursiveTrue make a recursive search of images files in subfolders.

Returns:

True if the execution went well. In case of failure, an error is written on console.