mirror of
https://github.com/spl0k/supysonic.git
synced 2024-12-22 08:56:17 +00:00
parent
8014c7b2df
commit
3670195719
@ -3,12 +3,13 @@
|
|||||||
# This file is part of Supysonic.
|
# This file is part of Supysonic.
|
||||||
# Supysonic is a Python implementation of the Subsonic server API.
|
# Supysonic is a Python implementation of the Subsonic server API.
|
||||||
#
|
#
|
||||||
# Copyright (C) 2018 Alban 'spl0k' Féron
|
# Copyright (C) 2018-2020 Alban 'spl0k' Féron
|
||||||
#
|
#
|
||||||
# Distributed under terms of the GNU AGPLv3 license.
|
# Distributed under terms of the GNU AGPLv3 license.
|
||||||
|
|
||||||
import os.path
|
import os.path
|
||||||
import re
|
import re
|
||||||
|
import warnings
|
||||||
|
|
||||||
from base64 import b64decode
|
from base64 import b64decode
|
||||||
from mutagen import File, FileType
|
from mutagen import File, FileType
|
||||||
@ -63,8 +64,10 @@ def is_valid_cover(path):
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
try: # Ensure the image can be read
|
try: # Ensure the image can be read
|
||||||
with Image.open(path):
|
with warnings.catch_warnings():
|
||||||
return True
|
warnings.simplefilter("ignore")
|
||||||
|
with Image.open(path):
|
||||||
|
return True
|
||||||
except IOError:
|
except IOError:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user