code review 1

This commit is contained in:
pants108 2020-05-05 18:39:05 +00:00
parent a553693677
commit 1a79ae5a9f
2 changed files with 8 additions and 10 deletions

View file

@ -210,8 +210,8 @@ class ArtSource(RequestMixin):
def fetch_image(self, candidate, plugin):
raise NotImplementedError()
def cleanup_tmp(self, candidate):
raise NotImplementedError()
def cleanup(self, candidate):
pass
class LocalArtSource(ArtSource):
@ -221,10 +221,6 @@ class LocalArtSource(ArtSource):
def fetch_image(self, candidate, plugin):
pass
def cleanup_tmp(self, candidate):
# local art source does not create tmp files
pass
class RemoteArtSource(ArtSource):
IS_LOCAL = False
@ -298,7 +294,7 @@ class RemoteArtSource(ArtSource):
self._log.debug(u'error fetching art: {}', exc)
return
def cleanup_tmp(self, candidate):
def cleanup(self, candidate):
if candidate.path:
try:
util.remove(path=candidate.path)
@ -1031,8 +1027,8 @@ class FetchArtPlugin(plugins.BeetsPlugin, RequestMixin):
u'using {0.LOC_STR} image {1}'.format(
source, util.displayable_path(out.path)))
break
# else: remove tmp images created by this invalid candidate
source.cleanup_tmp(candidate)
# Remove temporary files for invalid candidates.
source.cleanup(candidate)
if out:
break

View file

@ -122,9 +122,11 @@ New features:
Fixes:
* :doc:`/plugins/fetchart`: Fixed a bug that caused fetchart to not take
* :doc:`/plugins/fetchart`: Fixed a bug that caused fetchart to not take
environment variables such as proxy servers into account when making requests
:bug:`3450`
* :doc:`/plugins/fetchart`: Temporary files for fetched album art that fail
validation are now removed
* :doc:`/plugins/inline`: In function-style field definitions that refer to
flexible attributes, values could stick around from one function invocation
to the next. This meant that, when displaying a list of objects, later