Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Embedart: remove_art_file on import #1675

Merged
merged 3 commits into from
Nov 3, 2015
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 8 additions & 1 deletion beetsplug/embedart.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def embed_func(lib, opts, args):
art.embed_album(self._log, album, maxwidth, False,
compare_threshold, ifempty)

if remove_art_file and album.artpath is not None:
if remove_art_file and album.artpath:
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Kraymer, I assume this line can be changed as well?

if os.path.isfile(album.artpath):
self._log.debug(u'Removing album art file '
u'for {0}', album)
Expand Down Expand Up @@ -141,3 +141,10 @@ def process_album(self, album):
art.embed_album(self._log, album, max_width, True,
self.config['compare_threshold'].get(int),
self.config['ifempty'].get(bool))
if self.config['remove_art_file'] and album.artpath:
if os.path.isfile(album.artpath):
self._log.debug(u'Removing album art file '
u'for {0}', album)
os.remove(album.artpath)
album.artpath = None
album.store()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please move this stanza into a function so that we don't need to copy & paste the same code?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1