pgn2json.computation package

Submodules

pgn2json.computation.pgn_conversion module

pgn_conversion.py: Converts PGN files to JSON format.

class pgn2json.computation.pgn_conversion.PGNConverter(position_flags: dict[str, str], uuid_length: int)

Bases: object

Converts a PGN file into a JSON object compatible with the ‘chess-study’ Obsidian plug-in.

position_flags

Dictionary mapping move types to their respective flags.

Type:

dict[str, str]

uuid_length

The length of the UUIDs to generate.

Type:

int

pgn_content

The content of an inputed PGN file.

Type:

str

convert_to_json() dict:

Converts PGN content into a JSON object.

convert_to_json(storage_path: Path) tuple[str, str]

Converts PGN content into a JSON object.

Parameters:

storage_path (Path) – The path to the chess-study storage directory.

Returns:

The UUID of the saved file and the game link.

Return type:

tuple[str, str]

Module contents

Computation package for the project.