Darktable2Piwigo
Loading...
Searching...
No Matches
albums.DtdataAlbums Class Reference
Inheritance diagram for albums.DtdataAlbums:
Inheritance graph
Collaboration diagram for albums.DtdataAlbums:
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] albums.DtdataAlbums.__create_main_translation ( "DatabaseTable"  dest_tbl)
staticprivate
Load the existing tags translations from the mysql database and return them as a
translation dictionary

This function is a special case for the albums transformer, as it needs the actual
content of the tags table to create the album names. The function resets the
filter arguments before and after the function call to ensure that the filter
arguments of the original table are not modified.

◆ _transform()

Union[pd.DataFrame, List[Dict[Hashable, Any]]] albums.DtdataAlbums._transform (   self,
pd.DataFrame  df,
bool  fastapi_output,
**Any   kwargs 
)
protected
Transforms the original tags table from darktable into an albums table
which only includes album tags and different columns than tags itself

The transformation process is as follows:
1. Take the original tags table from darktable
2. Split the name field in a hierarchy list of the primary language
3. Split the synonym string in its parts: yes we could have taken pd.DataFrame.str.split,
   but then all separators ,must be present
4. we need to copy the primary language name to secondary language name in case not exists
5. Create the tranmslation dictionary between primary and secondary language; we need
   to create new translations and then merge them with the existing ones
6. Map the translations for each hierarchy level to create the translated hierarchy list
7. Join the translated hierarchy lists with the separator given in config.py

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