mirror of
https://github.com/beetbox/beets.git
synced 2026-01-03 06:22:48 +01:00
Improve thumbnails logging
No info message printed twice per cover art (once for the normal thumbnail and once for the big one)
This commit is contained in:
parent
a78cc65826
commit
9bdeb01689
2 changed files with 12 additions and 9 deletions
|
|
@ -117,11 +117,15 @@ class ThumbnailsPlugin(BeetsPlugin):
|
|||
album.artpath)
|
||||
return
|
||||
|
||||
wrote = True
|
||||
if max(size) >= 256:
|
||||
self.make_cover_thumbnail(album, 256, LARGE_DIR)
|
||||
self.make_cover_thumbnail(album, 128, NORMAL_DIR)
|
||||
wrote &= self.make_cover_thumbnail(album, 256, LARGE_DIR)
|
||||
wrote &= self.make_cover_thumbnail(album, 128, NORMAL_DIR)
|
||||
|
||||
self._log.info(u'wrote thumbnail for {0}', album)
|
||||
if wrote:
|
||||
self._log.info('wrote thumbnail for {0}', album)
|
||||
else:
|
||||
self._log.info('nothing to do for {0}', album)
|
||||
|
||||
def make_cover_thumbnail(self, album, size, target_dir):
|
||||
"""Make a thumbnail of given size for `album` and put it in
|
||||
|
|
@ -136,15 +140,14 @@ class ThumbnailsPlugin(BeetsPlugin):
|
|||
self._log.debug("found a suitable thumbnail for {0}, "
|
||||
"forcing regeneration", album)
|
||||
else:
|
||||
self._log.info("thumbnail for {0} exists and is recent enough",
|
||||
album)
|
||||
return
|
||||
self._log.debug("thumbnail for {0} exists and is recent "
|
||||
"enough", album)
|
||||
return False
|
||||
resized = ArtResizer.shared.resize(size, album.artpath,
|
||||
util.syspath(target))
|
||||
|
||||
self.add_tags(album, util.syspath(resized))
|
||||
|
||||
shutil.move(resized, target)
|
||||
return True
|
||||
|
||||
@staticmethod
|
||||
def thumbnail_file_name(path):
|
||||
|
|
|
|||
|
|
@ -192,7 +192,7 @@ class ThumbnailsTest(unittest.TestCase, TestHelper):
|
|||
get_size = mock_artresizer.shared.get_size
|
||||
|
||||
plugin = ThumbnailsPlugin()
|
||||
make_cover = plugin.make_cover_thumbnail = Mock()
|
||||
make_cover = plugin.make_cover_thumbnail = Mock(return_value=True)
|
||||
make_dolphin = plugin.make_dolphin_cover_thumbnail = Mock()
|
||||
|
||||
# no art
|
||||
|
|
|
|||
Loading…
Reference in a new issue