upsies.utils.bbcode

Helper functions for generating BBcode

Functions

upsies.utils.bbcode.screenshots_grid(screenshots, columns=2, horizontal_spacer='  ', vertical_spacer='\n')[source]

Return BBcode for thumbnailed screenshots in a grid layout

Parameters:
  • screenshots – Sequence of UploadedImage objects (URLs with a thumbnail_url attribute)

  • columns (int) –

    How many columns to split screenshots into

    columns may also be a sequence of acceptable values to automatically find the best number of columns for the number of screenshots.

    For example, for 9 screenshots and columns=(2, 3, 4), the best number of columns would be 3, for 8 screenshots it would be 4, and for 2 screenshots it would be 2 columns.

  • horizontal_spacer (str) – String between columns

  • vertical_spacer (str) – String between rows

Raises:

RuntimeError – if any screenshot doesn’t have a thumbnail