Skip to main content

springheel.genextra module

Generate extras pages.

springheel.genextra.duH(size_in_b: int, decimal_separator: str)str

Convert a filesize from bytes to kibibytes or mebibytes.

Used for indicating the filesize of downloads on extra pages in a more human-comprehensible manner.

Parameters
size_in_bint

The filesize in bytes.

decimal_separatorstr

The decimal separator used by the current site locale.

Returns
str

The filesize and unit used.

Examples

>>> springheel.genextra.duH(2357621, ".")
'2.2 MiB'
springheel.genextra.gen_extra(i_path: str, o_path: str, extras_j: str, translated_strings: dict, all_images: dict)Tuple[springheel.classes.EXpage, dict]

Generate an extras page.

Parameters
i_pathstr

Path to the input folder.

o_pathstr

Path to the output folder.

extras_jstr

Path to the Extra.json file.

translated_stringsdict

The translation file contents for this site.

all_imagesdict

A dictionary mapping image filenames to (width, height) in pixels.

Returns
EXpage

The completed extras page. A springheel.classes.EXpage object.

jdict

Raw JSON of the extras page.