From dd053d77237c5bf58c023ee7ba96659041a96b23 Mon Sep 17 00:00:00 2001 From: Adrian Sampson Date: Sun, 6 Apr 2014 17:59:30 -0700 Subject: [PATCH] changelog and style fixes for #665 --- beetsplug/fetchart.py | 7 ++++--- docs/changelog.rst | 7 +++++-- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/beetsplug/fetchart.py b/beetsplug/fetchart.py index 5b517c05a..9fe8e980b 100644 --- a/beetsplug/fetchart.py +++ b/beetsplug/fetchart.py @@ -47,13 +47,14 @@ def _fetch_image(url): log.debug(u'fetchart: downloading art: {0}'.format(url)) try: with closing(requests_session.get(url, stream=True)) as resp: - if not 'Content-Type' in resp.headers \ - or not resp.headers['Content-Type'] in CONTENT_TYPES: + if 'Content-Type' not in resp.headers \ + or resp.headers['Content-Type'] not in CONTENT_TYPES: log.debug(u'fetchart: not an image') return # Generate a temporary file with the correct extension. - with NamedTemporaryFile(suffix=DOWNLOAD_EXTENSION, delete=False) as fh: + with NamedTemporaryFile(suffix=DOWNLOAD_EXTENSION, delete=False) \ + as fh: for chunk in resp.iter_content(): fh.write(chunk) log.debug(u'fetchart: downloaded art to: {0}'.format( diff --git a/docs/changelog.rst b/docs/changelog.rst index 0f23e37f2..365becd65 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -4,8 +4,6 @@ Changelog 1.3.5 (in development) ---------------------- -Changelog goes here! - New stuff: * :doc:`/plugins/replaygain`: Added support for calcuating ReplayGain values with @@ -13,6 +11,11 @@ New stuff: calculation for practially all formats. The upgraded plugin is backward compatible configuration-wise. +Fixes: + +* :doc:`/plugins/fetchart`: Fix a crash when the server does not specify a + content type. Thanks to Lee Reinhardt. + 1.3.4 (April 5, 2014) ---------------------