Darktable2Piwigo
Loading...
Searching...
No Matches
tags.DtdataTags Class Reference
Inheritance diagram for tags.DtdataTags:
Inheritance graph
Collaboration diagram for tags.DtdataTags:
Collaboration graph

Protected Member Functions

Union[pd.DataFrame, List[Dict[Hashable, Any]]] _transform (self, pd.DataFrame df, bool fastapi_output, **Any kwargs)
 

Static Private Member Functions

Dict[str, str] __create_main_translation ("DatabaseTable" dest_tbl)
 

Detailed Description

Implements the transformer function for darktable tags to mysql tags

Member Function Documentation

◆ __create_main_translation()

Dict[str, str] tags.DtdataTags.__create_main_translation ( "DatabaseTable"  dest_tbl)
staticprivate
Load the existing tags translations from the mysql database and return them as a
translation dictionary

◆ _transform()

Union[pd.DataFrame, List[Dict[Hashable, Any]]] tags.DtdataTags._transform (   self,
pd.DataFrame  df,
bool  fastapi_output,
**Any   kwargs 
)
protected
Transforms the original tags table from darktable into a table including translated
hierarchies, export_flags and a hash column to detect changes

The method does the following steps:
* Split the name field in a hierarchy list of the primary language
* Split of the primary language synonyms and the secondary tag information
* Split the secondary tag information in name and synonym
* Replace empty translations with primary name
* Create the tranmslation dictionary between primary and secondary language
* Map the translations for each hierarchy level to create the translated hierarchy list
* Set marker for export of tags to Piwigo: 'web' = Piwig Album Structure 'no_exp'
* = Private tags
* Reduce the dataframe to the required output and replace uncompatible Nan/NaT values

:param df: The dataframe to be transformed
:param fastapi_output: Whether the output should be formatted for FastAPI
:param kwargs: Additional keyword arguments
:return: The transformed dataframe or a list of dictionaries

The documentation for this class was generated from the following file: