コード例 #1
0
ファイル: test_settings.py プロジェクト: saimn/sigal
def test_get_thumb(settings):
    """Test the get_thumb function."""
    tests = [('example.jpg', 'thumbnails/example.tn.jpg'),
             ('test/example.jpg', 'test/thumbnails/example.tn.jpg'),
             ('test/t/example.jpg', 'test/t/thumbnails/example.tn.jpg')]
    for src, ref in tests:
        assert get_thumb(settings, src) == ref

    tests = [('example.webm', 'thumbnails/example.tn.jpg'),
             ('test/example.mp4', 'test/thumbnails/example.tn.jpg'),
             ('test/t/example.avi', 'test/t/thumbnails/example.tn.jpg')]
    for src, ref in tests:
        assert get_thumb(settings, src) == ref
コード例 #2
0
def test_get_thumb(settings):
    """Test the get_thumb function."""
    tests = [('example.jpg', 'thumbnails/example.tn.jpg'),
             ('test/example.jpg', 'test/thumbnails/example.tn.jpg'),
             ('test/t/example.jpg', 'test/t/thumbnails/example.tn.jpg')]
    for src, ref in tests:
        assert get_thumb(settings, src) == ref

    tests = [('example.webm', 'thumbnails/example.tn.jpg'),
             ('test/example.mp4', 'test/thumbnails/example.tn.jpg'),
             ('test/t/example.avi', 'test/t/thumbnails/example.tn.jpg')]
    for src, ref in tests:
        assert get_thumb(settings, src) == ref
コード例 #3
0
ファイル: encrypt.py プロジェクト: uchit66/sigal
def get_encrypt_list(settings, media):
    to_encrypt = []
    to_encrypt.append(
        media.filename)  #resized image or in case of "use_orig", the original
    if settings["make_thumbs"]:
        to_encrypt.append(get_thumb(settings, media.filename))  #thumbnail
    if media.big is not None and not settings["use_orig"]:
        to_encrypt.append(media.big)  #original image
    to_encrypt = list(
        map(lambda path: os.path.join(media.path, path), to_encrypt))
    return to_encrypt