Skip to content

Commit

Permalink
Create function remove_artfile
Browse files Browse the repository at this point in the history
Damn it, that was really hard for me:D. First time seriously using python. Please review it carefuly.
  • Loading branch information
kooimens committed Nov 2, 2015
1 parent 0257b10 commit bcef3a7
Showing 1 changed file with 10 additions and 15 deletions.
25 changes: 10 additions & 15 deletions beetsplug/embedart.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,14 +79,7 @@ def embed_func(lib, opts, args):
for album in lib.albums(decargs(args)):
art.embed_album(self._log, album, maxwidth, False,
compare_threshold, ifempty)

if 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()
self.remove_artfile(album)

embed_cmd.func = embed_func

Expand Down Expand Up @@ -141,10 +134,12 @@ 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()
self.remove_artfile(album)
def remove_artfile(self, album)
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()

0 comments on commit bcef3a7

Please sign in to comment.