Add support for PNG photos. #361 (#383)

This commit is contained in:
Jaisen Mathai 2020-10-09 00:55:14 -07:00 committed by GitHub
parent 579d94c7af
commit ed4b58aa0d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 3 additions and 1 deletions

View File

@ -28,7 +28,7 @@ class Photo(Media):
__name__ = 'Photo' __name__ = 'Photo'
#: Valid extensions for photo files. #: Valid extensions for photo files.
extensions = ('arw', 'cr2', 'dng', 'gif', 'heic', 'jpeg', 'jpg', 'nef', 'rw2') extensions = ('arw', 'cr2', 'dng', 'gif', 'heic', 'jpeg', 'jpg', 'nef', 'png', 'rw2')
def __init__(self, source=None): def __init__(self, source=None):
super(Photo, self).__init__(source) super(Photo, self).__init__(source)

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

View File

@ -35,6 +35,7 @@ def test_photo_extensions():
assert 'jpg' in extensions assert 'jpg' in extensions
assert 'jpeg' in extensions assert 'jpeg' in extensions
assert 'nef' in extensions assert 'nef' in extensions
assert 'png' in extensions
assert 'rw2' in extensions assert 'rw2' in extensions
valid_extensions = Photo.get_valid_extensions() valid_extensions = Photo.get_valid_extensions()
@ -355,6 +356,7 @@ def test_various_types():
'dng': (2009, 10, 20, 9, 10, 46, 1, 293, 0), 'dng': (2009, 10, 20, 9, 10, 46, 1, 293, 0),
'heic': (2019, 5, 26, 10, 33, 20, 6, 146, 0), 'heic': (2019, 5, 26, 10, 33, 20, 6, 146, 0),
'nef': (2008, 10, 24, 9, 12, 56, 4, 298, 0), 'nef': (2008, 10, 24, 9, 12, 56, 4, 298, 0),
'png': (2015, 1, 18, 12, 1, 1, 6, 18, 0),
'rw2': (2014, 11, 19, 23, 7, 44, 2, 323, 0) 'rw2': (2014, 11, 19, 23, 7, 44, 2, 323, 0)
} }