From 420b0724a041f633f5beb2f2b4bc39aa1196982b Mon Sep 17 00:00:00 2001 From: Jack Wilsdon Date: Sun, 6 Sep 2015 21:45:10 +0100 Subject: [PATCH] Add `remove_art_file` configuration property --- beetsplug/embedart.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/beetsplug/embedart.py b/beetsplug/embedart.py index 99be2180f..9a68fe820 100644 --- a/beetsplug/embedart.py +++ b/beetsplug/embedart.py @@ -37,6 +37,7 @@ class EmbedCoverArtPlugin(BeetsPlugin): 'auto': True, 'compare_threshold': 0, 'ifempty': False, + 'remove_art_file': False }) if self.config['maxwidth'].get(int) and not ArtResizer.shared.local: @@ -62,6 +63,7 @@ class EmbedCoverArtPlugin(BeetsPlugin): maxwidth = self.config['maxwidth'].get(int) compare_threshold = self.config['compare_threshold'].get(int) ifempty = self.config['ifempty'].get(bool) + remove_art_file = self.config['remove_art_file'].get(bool) def embed_func(lib, opts, args): if opts.file: @@ -78,6 +80,11 @@ class EmbedCoverArtPlugin(BeetsPlugin): art.embed_album(self._log, album, maxwidth, False, compare_threshold, ifempty) + if remove_art_file and album.artpath is not None: + if os.path.isfile(album.artpath): + self._log.debug(u'Removing album art file for {0}', album) + os.remove(album.artpath) + embed_cmd.func = embed_func # Extract command.