From 3670195719881088ecac2beb909441daa15656d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alban=20F=C3=A9ron?= Date: Sat, 25 Apr 2020 16:32:57 +0200 Subject: [PATCH] Suppress warnings from cover files Ref #184 --- supysonic/covers.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/supysonic/covers.py b/supysonic/covers.py index 720fe6a..e749f9d 100644 --- a/supysonic/covers.py +++ b/supysonic/covers.py @@ -3,12 +3,13 @@ # This file is part of Supysonic. # 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. import os.path import re +import warnings from base64 import b64decode from mutagen import File, FileType @@ -63,8 +64,10 @@ def is_valid_cover(path): return False try: # Ensure the image can be read - with Image.open(path): - return True + with warnings.catch_warnings(): + warnings.simplefilter("ignore") + with Image.open(path): + return True except IOError: return False