sigal 2.4__py3-none-any.whl → 2.6__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (64) hide show
  1. sigal/__init__.py +1 -1
  2. sigal/__main__.py +18 -10
  3. sigal/gallery.py +90 -88
  4. sigal/image.py +26 -7
  5. sigal/log.py +1 -1
  6. sigal/plugins/compress_assets.py +4 -3
  7. sigal/plugins/encrypt/encrypt.py +1 -1
  8. sigal/plugins/encrypt/endec.py +2 -2
  9. sigal/plugins/extended_caching.py +5 -1
  10. sigal/plugins/feeds.py +1 -0
  11. sigal/plugins/media_page.py +1 -1
  12. sigal/plugins/nomedia.py +1 -1
  13. sigal/plugins/nonmedia_files.py +26 -15
  14. sigal/plugins/titleregexp.py +2 -2
  15. sigal/plugins/zip_gallery.py +1 -1
  16. sigal/settings.py +35 -3
  17. sigal/templates/sigal.conf.py +9 -11
  18. sigal/themes/colorbox/templates/album.html +30 -28
  19. sigal/themes/default/templates/description.html +29 -0
  20. sigal/themes/default/templates/footer.html +3 -0
  21. sigal/themes/galleria/templates/album_items.html +3 -24
  22. sigal/themes/photoswipe/static/photoswipe-dynamic-caption-plugin.esm.js +414 -0
  23. sigal/themes/photoswipe/static/photoswipe-dynamic-caption-plugin.esm.min.js +5 -0
  24. sigal/themes/photoswipe/static/photoswipe-fullscreen.esm.js +129 -0
  25. sigal/themes/photoswipe/static/photoswipe-fullscreen.esm.min.js +8 -0
  26. sigal/themes/photoswipe/static/photoswipe-lightbox.esm.js +1960 -0
  27. sigal/themes/photoswipe/static/photoswipe-lightbox.esm.js.map +1 -0
  28. sigal/themes/photoswipe/static/photoswipe-lightbox.esm.min.js +5 -0
  29. sigal/themes/photoswipe/static/photoswipe-video-plugin.esm.js +257 -0
  30. sigal/themes/photoswipe/static/photoswipe-video-plugin.esm.min.js +1 -0
  31. sigal/themes/photoswipe/static/photoswipe.css +385 -140
  32. sigal/themes/photoswipe/static/photoswipe.esm.js +7081 -0
  33. sigal/themes/photoswipe/static/photoswipe.esm.js.map +1 -0
  34. sigal/themes/photoswipe/static/photoswipe.esm.min.js +5 -0
  35. sigal/themes/photoswipe/static/styles.css +57 -5
  36. sigal/themes/photoswipe/templates/album.html +2 -91
  37. sigal/themes/photoswipe/templates/album_items.html +31 -0
  38. sigal/themes/photoswipe/templates/album_list.html +5 -0
  39. sigal/themes/photoswipe/templates/base.html +49 -0
  40. sigal/utils.py +5 -2
  41. sigal/version.py +29 -3
  42. sigal/video.py +3 -3
  43. sigal/writer.py +11 -3
  44. {sigal-2.4.dist-info → sigal-2.6.dist-info}/METADATA +24 -28
  45. {sigal-2.4.dist-info → sigal-2.6.dist-info}/RECORD +49 -50
  46. {sigal-2.4.dist-info → sigal-2.6.dist-info}/WHEEL +1 -1
  47. {sigal-2.4.dist-info → sigal-2.6.dist-info/licenses}/LICENSE +1 -1
  48. sigal/plugins/upload_s3.py +0 -106
  49. sigal/themes/photoswipe/static/app.js +0 -214
  50. sigal/themes/photoswipe/static/default-skin/default-skin.css +0 -485
  51. sigal/themes/photoswipe/static/default-skin/default-skin.css.map +0 -10
  52. sigal/themes/photoswipe/static/default-skin/default-skin.png +0 -0
  53. sigal/themes/photoswipe/static/default-skin/default-skin.svg +0 -36
  54. sigal/themes/photoswipe/static/default-skin/preloader.gif +0 -0
  55. sigal/themes/photoswipe/static/echo/blank.gif +0 -0
  56. sigal/themes/photoswipe/static/echo/echo.js +0 -135
  57. sigal/themes/photoswipe/static/echo/echo.min.js +0 -2
  58. sigal/themes/photoswipe/static/photoswipe-ui-default.js +0 -871
  59. sigal/themes/photoswipe/static/photoswipe-ui-default.min.js +0 -1
  60. sigal/themes/photoswipe/static/photoswipe.css.map +0 -10
  61. sigal/themes/photoswipe/static/photoswipe.js +0 -3592
  62. sigal/themes/photoswipe/static/photoswipe.min.js +0 -1
  63. {sigal-2.4.dist-info → sigal-2.6.dist-info}/entry_points.txt +0 -0
  64. {sigal-2.4.dist-info → sigal-2.6.dist-info}/top_level.txt +0 -0
@@ -18,7 +18,7 @@
18
18
  # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
19
19
  # IN THE SOFTWARE.
20
20
 
21
- """ This plugin controls the generation of a ZIP archive for a gallery
21
+ """This plugin controls the generation of a ZIP archive for a gallery
22
22
 
23
23
  If the ``zip_gallery`` setting is set, it contains the location of a zip
24
24
  archive with all original images of the corresponding directory.
sigal/settings.py CHANGED
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2009-2023 - Simon Conseil
1
+ # Copyright (c) 2009-2026 - Simon Conseil
2
2
  # Copyright (c) 2013 - Christophe-Marie Duquesne
3
3
  # Copyright (c) 2017 - Mate Lakat
4
4
  # Copyright (c) 2021 - Keith Feldman
@@ -26,13 +26,17 @@ import os
26
26
  from os.path import abspath, isabs, join, normpath
27
27
  from pprint import pformat
28
28
 
29
+ from PIL import Image as PILImage
30
+
29
31
  _DEFAULT_CONFIG = {
30
32
  "albums_sort_attr": "name",
31
33
  "albums_sort_reverse": False,
32
34
  "autorotate_images": True,
35
+ "autoplay": False,
33
36
  "colorbox_column_size": 3,
34
37
  "copy_exif_data": False,
35
38
  "datetime_format": "%c",
39
+ "display_timestamp": False,
36
40
  "destination": "_build",
37
41
  "files_to_copy": (),
38
42
  "galleria_theme": "classic",
@@ -40,7 +44,16 @@ _DEFAULT_CONFIG = {
40
44
  "google_tag_manager": "",
41
45
  "ignore_directories": [],
42
46
  "ignore_files": [],
43
- "img_extensions": [".jpg", ".jpeg", ".png", ".gif", ".tif", ".tiff", ".webp"],
47
+ "img_extensions": [
48
+ ".jpg",
49
+ ".jpeg",
50
+ ".png",
51
+ ".gif",
52
+ ".heic",
53
+ ".tif",
54
+ ".tiff",
55
+ ".webp",
56
+ ],
44
57
  "img_processor": "ResizeToFit",
45
58
  "img_size": (640, 480),
46
59
  "img_format": None,
@@ -101,6 +114,20 @@ class Status:
101
114
  FAILURE = 1
102
115
 
103
116
 
117
+ class _ImgExtensions:
118
+ def __init__(self):
119
+ # Register all formats
120
+ PILImage.init()
121
+
122
+ self.ext2format = PILImage.EXTENSION
123
+ self.format2ext = {v: k for k, v in PILImage.EXTENSION.items()}
124
+ self.format2ext["JPEG"] = ".jpg" # prefered ext for jpg
125
+ self.format2ext["PNG"] = ".png" # prefered ext for png
126
+
127
+
128
+ IMG_EXTENSIONS = _ImgExtensions()
129
+
130
+
104
131
  def get_thumb(settings, filename):
105
132
  """Return the path to the thumb.
106
133
 
@@ -121,6 +148,11 @@ def get_thumb(settings, filename):
121
148
 
122
149
  if ext.lower() in settings["video_extensions"]:
123
150
  ext = ".jpg"
151
+
152
+ imgformat = settings.get("img_format")
153
+ if imgformat:
154
+ ext = IMG_EXTENSIONS.format2ext[imgformat]
155
+
124
156
  return join(
125
157
  path,
126
158
  settings["thumb_dir"],
@@ -162,7 +194,7 @@ def read_settings(filename=None):
162
194
  settings[p] = abspath(normpath(join(settings_path, path)))
163
195
  logger.debug("Rewrite %s : %s -> %s", p, path, settings[p])
164
196
 
165
- for key in ("img_size", "thumb_size", "video_size"):
197
+ for key in ("img_size", "video_size"):
166
198
  if settings[key]:
167
199
  w, h = settings[key]
168
200
  if h > w:
@@ -39,6 +39,9 @@ theme = "galleria"
39
39
  # Path to a CSS file that can be used to customize themes
40
40
  # user_css =
41
41
 
42
+ # Enable autoplay (galleria only)
43
+ # autoplay = False
44
+
42
45
  # ----------------
43
46
  # Image processing (ignored if use_orig = True)
44
47
  # ----------------
@@ -63,7 +66,7 @@ img_size = (800, 600)
63
66
  # map_height = '500px'
64
67
 
65
68
  # File extensions that should be treated as images
66
- # img_extensions = ['.jpg', '.jpeg', '.png', '.gif']
69
+ # img_extensions = [".jpg", ".jpeg", ".png", ".gif", ".heic", ".tif", ".tiff", ".webp"]
67
70
 
68
71
  # Pilkit processor used to resize the image
69
72
  # (see http://pilkit.readthedocs.org/en/latest/#processors)
@@ -86,6 +89,9 @@ img_size = (800, 600)
86
89
  # https://docs.python.org/3/library/datetime.html#strftime-strptime-behavior
87
90
  # datetime_format = '%c'
88
91
 
92
+ # Display generated datetime in the resulting output
93
+ # display_timestamp = False
94
+
89
95
  # Jpeg options
90
96
  # jpg_options = {'quality': 85,
91
97
  # 'optimize': True,
@@ -128,7 +134,7 @@ thumb_size = (280, 210)
128
134
  # thumb_video_black_max_colors = 4
129
135
 
130
136
  # Keep original image (default: False)
131
- # keep_orig = True
137
+ # keep_orig = False
132
138
 
133
139
  # Subdirectory for original images
134
140
  # orig_dir = 'original'
@@ -158,7 +164,7 @@ thumb_size = (280, 210)
158
164
  # Filter directories and files.
159
165
  # The settings take a list of patterns matched with the fnmatch module on the
160
166
  # path relative to the source directory:
161
- # http://docs.python.org/2/library/fnmatch.html
167
+ # http://docs.python.org/3/library/fnmatch.html
162
168
  ignore_directories = []
163
169
  ignore_files = []
164
170
 
@@ -281,7 +287,6 @@ ignore_files = []
281
287
  # 'sigal.plugins.media_page',
282
288
  # 'sigal.plugins.nomedia',
283
289
  # 'sigal.plugins.nonmedia_files',
284
- # 'sigal.plugins.upload_s3',
285
290
  # 'sigal.plugins.watermark',
286
291
  # 'sigal.plugins.zip_gallery',
287
292
  # ]
@@ -317,13 +322,6 @@ ignore_files = []
317
322
  # 'thumb_font_size': 40, # only applies when a font is selected
318
323
  # }
319
324
 
320
- # Settings for upload to s3 plugin
321
- # upload_s3_options = {
322
- # 'bucket': 'my-bucket',
323
- # 'policy': 'public-read',
324
- # 'overwrite': False
325
- # }
326
-
327
325
  # Set zip_gallery to either False or a file name. The file name can
328
326
  # be formatted python style with an 'album' variable, for example
329
327
  # '{album.name}.zip'. The final archive will contain all resized or
@@ -16,47 +16,49 @@
16
16
 
17
17
  {% include 'map.html' %}
18
18
  <div id="gallery">
19
- {% for media in album.medias | selectattr("type", "in", ("image", "video")) %}
19
+ {% for media in album.medias %}
20
20
  {% if loop.index % nb_columns == 1 %}
21
- <div id="albums" class="row">
21
+ <div id="albums" class="row">
22
22
  {% endif%}
23
- {% if media.type == "image" %}
23
+ {% if media.thumbnail %}
24
24
  <div class="{{ column_size_t }} columns thumbnail">
25
+ {% if media.type == "image" %}
26
+ <a class="gallery" title="{{ media.title }}" {{ img_description(media) }}
27
+ {% if 'sigal.plugins.media_page' in settings.plugins %}
28
+ href="{{ media.url }}.html" data-href="{{ media.url }}"
29
+ {% else %}
30
+ href="{{ media.url }}"
31
+ {% endif %}
32
+ {% elif media.type == "video" %}
33
+ {% set mhash = media.url|replace('.', '')|replace(' ', '') %}
25
34
  {% if 'sigal.plugins.media_page' in settings.plugins %}
26
- <a href="{{ media.url}}.html" class="gallery"
27
- title="{{ media.title }}"
28
- data-href="{{ media.url }}" {{ img_description(media) }}>
35
+ <a href="{{ media.url }}.html" data-href="#{{ mhash }}"
29
36
  {% else %}
30
- <a href="{{ media.url }}" class="gallery" title="{{ media.title }}"
31
- {{ img_description(media) }}>
37
+ <a href="#{{ mhash }}" class="gallery" inline='yes' title="{{ media.url }}"
32
38
  {% endif %}
39
+ {% if media.big %} data-big="{{ media.big_url }}"{% endif %}
40
+ {% else %}
41
+ <a href="{{ media.url }}" title="{{ media.title }}"
42
+ {% endif %}
43
+ >
33
44
  <img src="{{ media.thumbnail }}" alt="{{ media.url }}"
34
- title="{{ media.title }}" /></a>
45
+ title="{{ media.title }}">
46
+ </a>
35
47
  </div>
36
48
  {% endif %}
49
+
37
50
  {% if media.type == "video" %}
38
- {% set mhash = media.url|replace('.', '')|replace(' ', '') %}
39
- <div class="{{ column_size_t }} columns thumbnail">
40
- {% if 'sigal.plugins.media_page' in settings.plugins %}
41
- <a href="{{ media.url }}.html" data-href="#{{ mhash }}"
42
- {% else %}
43
- <a href="#{{ mhash }}" class="gallery" inline='yes' title="{{ media.url }}"
44
- {% endif %}
45
- {% if media.big %} data-big="{{ media.big_url }}"{% endif %}>
46
- <img src="{{ media.thumbnail }}" alt="{{ media.url }}"
47
- title="{{ media.title }}" /></a>
48
- </div>
49
- <!-- This contains the hidden content for the video -->
50
- <div style='display:none'>
51
- <div id="{{ mhash }}">
52
- <video controls>
53
- <source src='{{ media.url }}' type='{{ media.mime }}' />
54
- </video>
55
- </div>
51
+ <!-- This contains the hidden content for the video -->
52
+ <div style='display:none'>
53
+ <div id="{{ mhash }}">
54
+ <video controls>
55
+ <source src='{{ media.url }}' type='{{ media.mime }}' />
56
+ </video>
56
57
  </div>
58
+ </div>
57
59
  {% endif %}
58
60
  {% if loop.last or loop.index % nb_columns == 0 %}
59
- </div>
61
+ </div>
60
62
  {% endif%}
61
63
  {% endfor %}
62
64
  </div>
@@ -0,0 +1,29 @@
1
+ {% macro img_description(media, with_big=True) -%}
2
+ {%- if with_big and media.big -%}
3
+ <a href='{{ media.big_url }}'>Full size</a>
4
+ {%- endif -%}
5
+ {%- if media.description -%}
6
+ <br>{{ media.description }}
7
+ {%- endif -%}
8
+ {%- if media.exif -%}
9
+ <div class='film-meta'>
10
+ {%- if media.exif.iso -%}
11
+ <abbr title='film speed'>{{ media.exif.iso }}</abbr> {%- endif -%}
12
+ {%- if media.exif.exposure -%}
13
+ <abbr title='exposure'>{{ media.exif.exposure }}</abbr> {%- endif -%}
14
+ {%- if media.exif.fstop -%}
15
+ <abbr title='aperture'>{{ media.exif.fstop }}</abbr> {%- endif -%}
16
+ {%- if media.exif.focal -%}
17
+ <abbr title='focal length'>{{ media.exif.focal }}</abbr> {%- endif -%}
18
+ </div>
19
+ {%- if media.exif.gps -%}
20
+ <a title='location' href='https://www.openstreetmap.org/?mlat={{ media.exif.gps.lat }}&amp;mlon={{ media.exif.gps.lon}}&amp;zoom=12&amp;layers=M' target='_blank' class='map' >{{ 'N{:.6f}'.format(media.exif.gps.lat) if media.exif.gps.lat > 0 else 'S{:.6f}'.format(-media.exif.gps.lat) }}{{ 'E{:.6f}'.format(media.exif.gps.lon) if media.exif.gps.lon > 0 else 'W{:.6f}'.format(-media.exif.gps.lon) }}</a>
21
+ {%- endif -%}
22
+ {%- if media.exif.Make or media.exif.Model -%}
23
+ <abbr title='camera make and model'>{{ media.exif.Make }} {{ media.exif.Model }}</abbr>
24
+ {%- endif -%}
25
+ {%- if media.exif.datetime -%}
26
+ <abbr title='date'>{{ media.exif.datetime }}</abbr>
27
+ {%- endif -%}
28
+ {% endif %}
29
+ {%- endmacro %}
@@ -12,5 +12,8 @@
12
12
  <span><a href={{ settings.atom_feed.feed_url }}>Atom Feed</a></span>
13
13
  {% endif %}
14
14
  {% endif %}
15
+ {% if settings.display_timestamp %}
16
+ @ {{ generated_timestamp }}
17
+ {% endif %}
15
18
  </p>
16
19
  </footer>
@@ -1,3 +1,4 @@
1
+ {% from 'description.html' import img_description %}
1
2
  <div class="icons">
2
3
  <a id="fullscreen"><img src="{{ theme.url }}/img/fullscreen.png"
3
4
  title="Fullscreen" alt="Fullscreen (f)" /></a>
@@ -17,29 +18,6 @@
17
18
 
18
19
  {% block late_js %}
19
20
  {% if album.medias %}
20
- {% macro img_description(media) -%}
21
- {%- if media.big -%}<a href='{{ media.big_url }}'>Full size</a>{%- endif -%}
22
- {# clean up tags and whitespace, including newlines, in the description #}
23
- {%- if media.description -%}<br>{{ media.description | striptags }}{%- endif -%}
24
- {%- if media.exif -%}
25
- <div class='film-meta'>
26
- {%- if media.exif.iso -%}<abbr title='film speed'>{{ media.exif.iso }}</abbr> {%- endif -%}
27
- {%- if media.exif.exposure -%}<abbr title='exposure'>{{ media.exif.exposure }}</abbr> {%- endif -%}
28
- {%- if media.exif.fstop -%}<abbr title='aperture'>{{ media.exif.fstop }}</abbr> {%- endif -%}
29
- {%- if media.exif.focal -%}<abbr title='focal length'>{{ media.exif.focal }}</abbr> {%- endif -%}
30
- </div>
31
- {%- if media.exif.gps -%}
32
- <a title='location' href='https://www.openstreetmap.org/?mlat={{ media.exif.gps.lat }}&amp;mlon={{ media.exif.gps.lon}}&amp;zoom=12&amp;layers=M' target='_blank' class='map' >{{ 'N{:.6f}'.format(media.exif.gps.lat) if media.exif.gps.lat > 0 else 'S{:.6f}'.format(-media.exif.gps.lat) }}{{ 'E{:.6f}'.format(media.exif.gps.lon) if media.exif.gps.lon > 0 else 'W{:.6f}'.format(-media.exif.gps.lon) }}</a>
33
- {%- endif -%}
34
- {%- if media.exif.Make or media.exif.Model -%}
35
- <abbr title='camera make and model'>{{ media.exif.Make }} {{ media.exif.Model }}</abbr>
36
- {%- endif -%}
37
- {%- if media.exif.datetime -%}
38
- <abbr title='date'>{{ media.exif.datetime }}</abbr>
39
- {%- endif -%}
40
- {% endif %}
41
- {%- endmacro %}
42
-
43
21
  <script src="{{ theme.url }}/jquery-3.3.1.min.js"></script>
44
22
  <script src="{{ theme.url }}/galleria.min.js"></script>
45
23
  <script src="{{ theme.url }}/themes/{{ settings.galleria_theme }}/galleria.{{ settings.galleria_theme }}.min.js"></script>
@@ -49,7 +27,7 @@
49
27
  {% for media in album.medias -%}
50
28
  {
51
29
  title: "{{ media.title }}",
52
- description: "{{ img_description(media) | e }}",
30
+ description: {{ img_description(media) | tojson }},
53
31
  thumb: "{{ media.thumbnail }}",
54
32
  {% if media.big %}
55
33
  big: "{{ media.big_url }}",
@@ -93,6 +71,7 @@
93
71
  });
94
72
 
95
73
  Galleria.configure({
74
+ {% if settings.autoplay %}autoplay: true,{% endif %}
96
75
  imageCrop: false,
97
76
  transition: "fade",
98
77
  thumbnails: "lazy"