mirror of
https://github.com/beetbox/beets.git
synced 2026-02-22 07:14:24 +01:00
code review 1
This commit is contained in:
parent
a553693677
commit
1a79ae5a9f
2 changed files with 8 additions and 10 deletions
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in a new issue