Merge pull request #340 from saimn/doc-license

Add doc page with licenses and replace a few images whose license/origin is unclear
This commit is contained in:
Simon Conseil
2018-09-05 22:33:04 +02:00
committed by GitHub
25 changed files with 105 additions and 48 deletions

View File

@@ -15,4 +15,5 @@ Documentation
plugins
faq
contribute
license
changelog

54
docs/license.rst Normal file
View File

@@ -0,0 +1,54 @@
=========
License
=========
Sigal itself is available under the MIT license, but it also relies on several
librairies (thanks!):
- `Colorbox <http://www.jacklmoore.com/colorbox>`__ (MIT)
- `Galleria <http://galleria.io/>`__ (MIT)
- `Photoswipe <http://photoswipe.com/>`__ (MIT)
- `JQuery <https://jquery.org/>`__ (MIT)
- `JQuery TouchSwipe <https://github.com/mattbryson/TouchSwipe-Jquery-Plugin>`__ (MIT)
- `Skeleton <http://getskeleton.com/>`__ (MIT)
- `normalize.css <https://github.com/necolas/normalize.css>`__ (MIT)
- `Leaflet <http://leafletjs.com/>`__ (BSD)
- `echo <https://github.com/toddmotto/echo>`__ (MIT)
The ``tests/sample/pictures`` directory contain images used for the unit
tests:
- ``11.jpg``, ``21.jpg``, ``22.jpg``, ``3.jpg`` : From @saimn
- ``1.jpg``, ``2.jpg`` : From @edwinsteele
(https://github.com/saimn/sigal/pull/297#issuecomment-365879755)
- ``example.gif`` :
https://commons.wikimedia.org/wiki/File:00_nuvolosit%C3%A0_media_AM.GIF
(CC-BY-3.0)
- ``CMB_Timeline300_no_WMAP.jpg`` :
https://en.wikipedia.org/wiki/File:CMB_Timeline300_no_WMAP.jpg
(Public domain)
- ``KeckObservatory20071020.jpg`` :
https://commons.wikimedia.org/wiki/File:KeckObservatory20071020.jpg
(CC-BY-3.0)
- ``flickr_jerquiaga_2394751088_cc-by-nc.jpg``
http://www.flickr.com/photos/jerquiaga/2394751088/ (CC-BY-NC)
- ``hélicoïde.jpg`` : https://commons.wikimedia.org/wiki/File:Helicoid.PNG
(CC BY-SA 3.0)
- ``Hubble Interacting Galaxy NGC 5257.jpg``
https://commons.wikimedia.org/wiki/File:Hubble_Interacting_Galaxy_NGC_5257_(2008-04-24).jpg
(Public domain)
- ``Hubble ultra deep field.jpg`` :
https://commons.wikimedia.org/wiki/File%3AHubble_ultra_deep_field.jpg
(Public domain)
- ``m57_the_ring_nebula-587px.jpg``
https://commons.wikimedia.org/wiki/File%3AM57_The_Ring_Nebula.JPG
(Public domain)
- ``noexif.png`` : https://commons.wikimedia.org/wiki/File:Ilc_9yr_moll4096.png
(Public domain)
- ``should_be_created.jpg``, ``should_be_ignored_1.jpg``,
``should_be_ignored2.jpg``, ``should_be_ignored3.jpg``,
``should_be_ignored.jpg`` : from the apollo 7 mission, public domain:
https://www.flickr.com/photos/projectapolloarchive/21756099278/in/album-72157657129869694/
(https://github.com/saimn/sigal/pull/233#issuecomment-275430083)
- ``example video.ogv`` : https://commons.wikimedia.org/wiki/File:I-15bis.ogv
(GFDL)

Binary file not shown.

After

Width:  |  Height:  |  Size: 212 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 67 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 74 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 174 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 74 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 74 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 174 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 34 KiB

View File

@@ -10,19 +10,22 @@ This is an [example link](http://example.com/ "With a Title").
### Image sources
- *Hubble Interacting Galaxy NGC 5257* By NASA, ESA, the Hubble Heritage
- *Hubble Interacting Galaxy NGC 5257* : By NASA, ESA, the Hubble Heritage
(STScI/AURA)-ESA/Hubble Collaboration, and A. Evans (University of Virginia,
Charlottesville/NRAO/Stony Brook University) [Public domain], via Wikimedia
Commons
Charlottesville/NRAO/Stony Brook University) [Public domain], <a
href="https://commons.wikimedia.org/wiki/File:Hubble_Interacting_Galaxy_NGC_5257_(2008-04-24).jpg">
from Wikimedia Commons</a>
- *Hubble ultra deep field.jpg* Par NASA and the European Space Agency. [Public
domain], <a
href="https://commons.wikimedia.org/wiki/File%3AHubble_ultra_deep_field.jpg">via
Wikimedia Commons</a>
- *Hubble ultra deep field.jpg* : By NASA and the European Space Agency.
[Public domain], <a
href="https://commons.wikimedia.org/wiki/File%3AHubble_ultra_deep_field.jpg">
from Wikimedia Commons</a>
- *m57_the_ring_nebula-587px.jpg* By The Hubble Heritage Team
- *m57_the_ring_nebula-587px.jpg* : By The Hubble Heritage Team
(AURA/STScI/NASA) [Public domain], <a
href="https://commons.wikimedia.org/wiki/File%3AM57_The_Ring_Nebula.JPG">via
Wikimedia Commons</a>
href="https://commons.wikimedia.org/wiki/File%3AM57_The_Ring_Nebula.JPG">
from Wikimedia Commons</a>
- *exo20101028-b-full.jpg*
- *KeckObservatory20071020.jpg* : By SiOwl [CC BY 3.0] <a
href="https://commons.wikimedia.org/wiki/File:KeckObservatory20071020.jpg">
from Wikimedia Commons</a>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 174 KiB

After

Width:  |  Height:  |  Size: 108 KiB

Binary file not shown.

View File

@@ -13,10 +13,10 @@ plugins = ['sigal.plugins.adjust', 'sigal.plugins.copyright',
'sigal.plugins.watermark', 'sigal.plugins.feeds',
'sigal.plugins.nomedia', 'sigal.plugins.extended_caching']
copyright = '© An example copyright message'
adjust_options = {'color': 0.0, 'brightness': 1.0,
adjust_options = {'color': 0.9, 'brightness': 1.0,
'contrast': 1.0, 'sharpness': 0.0}
watermark = 'watermark.png'
watermark_position = 'tile'
watermark_position = (10, 10)
watermark_opacity = 0.3
theme = 'colorbox'

Binary file not shown.

Before

Width:  |  Height:  |  Size: 32 KiB

After

Width:  |  Height:  |  Size: 3.0 KiB

View File

@@ -34,8 +34,8 @@ def test_build(tmpdir, disconnect_signals):
assert result.exit_code == 0
os.symlink(join(TESTGAL, 'watermark.png'),
join(tmpdir, 'watermark.png'))
os.symlink(join(TESTGAL, 'pictures', 'dir2', 'exo20101028-b-full.jpg'),
join(tmpdir, 'pictures', 'exo20101028-b-full.jpg'))
os.symlink(join(TESTGAL, 'pictures', 'dir2', 'KeckObservatory20071020.jpg'),
join(tmpdir, 'pictures', 'KeckObservatory20071020.jpg'))
result = runner.invoke(build, ['-n', 1, '--debug'])
assert result.exit_code == 1
@@ -76,7 +76,7 @@ atom_feed = {'feed_url': 'http://example.org/feed.atom', 'nb_items': 10}
'-n', 1, '--debug'])
assert result.exit_code == 0
assert os.path.isfile(join(tmpdir, 'build', 'thumbnails',
'exo20101028-b-full.jpg'))
'KeckObservatory20071020.jpg'))
assert os.path.isfile(join(tmpdir, 'build', 'feed.atom'))
assert os.path.isfile(join(tmpdir, 'build', 'feed.rss'))
assert os.path.isfile(join(tmpdir, 'build', 'watermark.png'))

View File

@@ -22,16 +22,16 @@ REF = {
'name': 'test1',
'thumbnail': 'test1/thumbnails/11.tn.jpg',
'subdirs': [],
'medias': ['11.jpg', 'archlinux-kiss-1024x640.png',
'medias': ['11.jpg', 'CMB_Timeline300_no_WMAP.jpg',
'flickr_jerquiaga_2394751088_cc-by-nc.jpg',
'50a1d0bc-763d-457e-b634-c87f16a64270.gif'],
'example.gif'],
},
'dir1/test2': {
'title': 'test2',
'name': 'test2',
'thumbnail': 'test2/thumbnails/21.tn.jpg',
'subdirs': [],
'medias': ['21.jpg', '22.jpg', 'archlinux-kiss-1024x640.png'],
'medias': ['21.jpg', '22.jpg', 'CMB_Timeline300_no_WMAP.jpg'],
},
'dir1/test3': {
'title': '01 First title alphabetically',
@@ -45,7 +45,7 @@ REF = {
'name': 'dir2',
'thumbnail': 'dir2/thumbnails/m57_the_ring_nebula-587px.tn.jpg',
'subdirs': [],
'medias': ['exo20101028-b-full.jpg',
'medias': ['KeckObservatory20071020.jpg',
'Hubble Interacting Galaxy NGC 5257.jpg',
'Hubble ultra deep field.jpg',
'm57_the_ring_nebula-587px.jpg'],
@@ -55,15 +55,15 @@ REF = {
'name': 'accentué',
'thumbnail': 'accentué/thumbnails/hélicoïde.tn.jpg',
'subdirs': [],
'medias': ['hélicoïde.jpg', 'superdupont_source_wikipedia_en.jpg'],
'medias': ['hélicoïde.jpg', '11.jpg'],
},
'video': {
'title': 'video',
'name': 'video',
'thumbnail': ('video/thumbnails/'
'stallman software-freedom-day-low.tn.jpg'),
'example video.tn.jpg'),
'subdirs': [],
'medias': ['stallman software-freedom-day-low.ogv']
'medias': ['example video.ogv']
}
}
@@ -97,9 +97,9 @@ def test_media_orig(settings, tmpdir):
m = Image('11.jpg', 'dir1/test1', settings)
assert m.big == 'original/11.jpg'
m = Video('stallman software-freedom-day-low.ogv', 'video', settings)
assert m.filename == 'stallman software-freedom-day-low.webm'
assert m.big == 'original/stallman software-freedom-day-low.ogv'
m = Video('example video.ogv', 'video', settings)
assert m.filename == 'example video.webm'
assert m.big == 'original/example video.ogv'
assert os.path.isfile(join(settings['destination'], m.path, m.big))
settings['use_orig'] = True
@@ -138,14 +138,13 @@ def test_image(settings, tmpdir):
def test_video(settings, tmpdir):
settings['destination'] = str(tmpdir)
m = Video('stallman software-freedom-day-low.ogv', 'video', settings)
file_path = join('video', 'stallman software-freedom-day-low.webm')
m = Video('example video.ogv', 'video', settings)
file_path = join('video', 'example video.webm')
assert str(m) == file_path
assert m.dst_path == join(settings['destination'], file_path)
os.makedirs(join(settings['destination'], 'video', 'thumbnails'))
assert m.thumbnail == join('thumbnails',
'stallman software-freedom-day-low.tn.jpg')
assert m.thumbnail == join('thumbnails', 'example video.tn.jpg')
assert os.path.isfile(m.thumb_path)
@@ -222,14 +221,14 @@ def test_medias_sort(settings):
a = Album('dir1/test2', settings, album['subdirs'], album['medias'], gal)
a.sort_medias(settings['medias_sort_attr'])
assert [im.filename for im in a.images] == ['22.jpg', '21.jpg',
'archlinux-kiss-1024x640.png']
'CMB_Timeline300_no_WMAP.jpg']
settings['medias_sort_attr'] = 'meta.order'
settings['medias_sort_reverse'] = False
a = Album('dir1/test2', settings, album['subdirs'], album['medias'], gal)
a.sort_medias(settings['medias_sort_attr'])
assert [im.filename for im in a.images] == [
'archlinux-kiss-1024x640.png', '21.jpg', '22.jpg']
'CMB_Timeline300_no_WMAP.jpg', '21.jpg', '22.jpg']
def test_gallery(settings, tmpdir):
@@ -269,13 +268,13 @@ def test_ignores(settings, tmpdir):
tmp = str(tmpdir)
settings['destination'] = tmp
settings['ignore_directories'] = ['*test2', 'accentué']
settings['ignore_files'] = ['dir2/Hubble*', '*.png']
settings['ignore_files'] = ['dir2/Hubble*', '*.png', '*CMB_*']
gal = Gallery(settings, ncpu=1)
gal.build()
assert 'test2' not in os.listdir(join(tmp, 'dir1'))
assert 'accentué' not in os.listdir(tmp)
assert 'archlinux-kiss-1024x640.png' not in os.listdir(
assert 'CMB_Timeline300_no_WMAP.jpg' not in os.listdir(
join(tmp, 'dir1', 'test1'))
assert 'Hubble Interacting Galaxy NGC 5257.jpg' not in os.listdir(
join(tmp, 'dir2'))

View File

@@ -9,10 +9,10 @@ from sigal.image import (generate_image, generate_thumbnail, get_exif_tags,
from sigal.settings import create_settings, Status
CURRENT_DIR = os.path.dirname(__file__)
TEST_IMAGE = 'exo20101028-b-full.jpg'
TEST_IMAGE = 'KeckObservatory20071020.jpg'
SRCFILE = os.path.join(CURRENT_DIR, 'sample', 'pictures', 'dir2', TEST_IMAGE)
TEST_GIF_IMAGE = '50a1d0bc-763d-457e-b634-c87f16a64270.gif'
TEST_GIF_IMAGE = 'example.gif'
SRC_GIF_FILE = os.path.join(CURRENT_DIR, 'sample', 'pictures',
'dir1', 'test1', TEST_GIF_IMAGE)
@@ -60,7 +60,7 @@ def test_resize_image_portrait(tmpdir):
# Hence we test that the shorter side has the smallest length.
assert im.size[0] == 200
landscape_image = 'exo20101028-b-full.jpg'
landscape_image = 'KeckObservatory20071020.jpg'
landscape_src = os.path.join(CURRENT_DIR, 'sample', 'pictures', 'dir2', landscape_image)
landscape_dst = str(tmpdir.join(landscape_image))
@@ -109,8 +109,8 @@ def test_generate_image_processor(tmpdir):
@pytest.mark.parametrize(
("image", "path", "wide_size", "high_size"),
[(TEST_IMAGE, SRCFILE, (185, 150), (150, 122)),
(TEST_GIF_IMAGE, SRC_GIF_FILE, (127, 150), (150, 177))])
[(TEST_IMAGE, SRCFILE, (200, 133), (150, 100)),
(TEST_GIF_IMAGE, SRC_GIF_FILE, (134, 150), (150, 167))])
def test_generate_thumbnail(tmpdir, image, path, wide_size, high_size):
"Test the generate_thumbnail function."

View File

@@ -19,7 +19,7 @@ def test_plugins(settings, tmpdir, disconnect_signals):
gal.build()
out_html = os.path.join(settings['destination'],
'dir2', 'exo20101028-b-full.jpg.html')
'dir2', 'KeckObservatory20071020.jpg.html')
assert os.path.isfile(out_html)
for path, dirs, files in os.walk(os.path.join(str(tmpdir), "nomedia")):

View File

@@ -6,7 +6,7 @@ SAMPLE_DIR = os.path.join(CURRENT_DIR, 'sample')
def test_copy(tmpdir):
filename = 'exo20101028-b-full.jpg'
filename = 'KeckObservatory20071020.jpg'
src = os.path.join(SAMPLE_DIR, 'pictures', 'dir2', filename)
dst = str(tmpdir.join(filename))
utils.copy(src, dst)
@@ -19,7 +19,7 @@ def test_copy(tmpdir):
assert os.path.islink(dst)
assert os.readlink(dst) == src
filename = 'exo20101028-b-full.jpg'
filename = 'KeckObservatory20071020.jpg'
src = os.path.join(SAMPLE_DIR, 'pictures', 'dir2', filename)
utils.copy(src, dst, symlink=True)
assert os.path.islink(dst)

View File

@@ -5,13 +5,13 @@ from sigal.video import video_size, generate_video, process_video
from sigal.settings import create_settings, Status
CURRENT_DIR = os.path.dirname(__file__)
TEST_VIDEO = 'stallman software-freedom-day-low.ogv'
TEST_VIDEO = 'example video.ogv'
SRCFILE = os.path.join(CURRENT_DIR, 'sample', 'pictures', 'video', TEST_VIDEO)
def test_video_size():
size_src = video_size(SRCFILE)
assert size_src == (480, 270)
assert size_src == (320, 240)
size_src = video_size('missing/file.mp4')
assert size_src == (0, 0)
@@ -38,14 +38,14 @@ def test_generate_video_fit_height(tmpdir, fmt):
base, ext = os.path.splitext(TEST_VIDEO)
dstfile = str(tmpdir.join(base + '.' + fmt))
settings = create_settings(video_size=(50, 100), video_format=fmt)
settings = create_settings(video_size=(80, 100), video_format=fmt)
generate_video(SRCFILE, dstfile, settings,
options=settings[fmt + '_options'])
size_src = video_size(SRCFILE)
size_dst = video_size(dstfile)
assert size_dst[0] == 50
assert size_dst[0] == 80
# less than 2% error on ratio
assert abs(size_dst[0]/size_dst[1] - size_src[0]/size_src[1]) < 2e-2

View File

@@ -29,9 +29,9 @@ def test_zipped_correctly(tmpdir):
assert os.path.basename(zipped1[0]) == 'archive.zip'
zip_file = zipfile.ZipFile(zipped1[0], 'r')
expected = ('11.jpg', 'archlinux-kiss-1024x640.png',
expected = ('11.jpg', 'CMB_Timeline300_no_WMAP.jpg',
'flickr_jerquiaga_2394751088_cc-by-nc.jpg',
'50a1d0bc-763d-457e-b634-c87f16a64270.gif')
'example.gif')
for filename in zip_file.namelist():
assert filename in expected