moviewyrm/bookwyrm/thumbnail_generation.py

21 lines
641 B
Python
Raw Permalink Normal View History

2022-01-08 16:47:45 +00:00
"""thumbnail generation strategy for django-imagekit"""
2022-01-08 16:54:03 +00:00
2022-01-08 16:41:44 +00:00
class Strategy:
"""
A strategy that generates the image on source saved (Optimistic),
but also on demand, for old images (JustInTime).
"""
2022-01-08 16:47:45 +00:00
def on_source_saved(self, file): # pylint: disable=no-self-use
"""What happens on source saved"""
2022-01-08 16:41:44 +00:00
file.generate()
2022-01-08 16:47:45 +00:00
def on_existence_required(self, file): # pylint: disable=no-self-use
"""What happens on existence required"""
2022-01-08 16:41:44 +00:00
file.generate()
2022-01-08 16:47:45 +00:00
def on_content_required(self, file): # pylint: disable=no-self-use
"""What happens on content required"""
2022-01-08 16:41:44 +00:00
file.generate()