From e58ddbfa1a2b99b643f7fb408aa2c129dff173ec Mon Sep 17 00:00:00 2001 From: Angus Gratton Date: Mon, 10 Sep 2018 09:16:25 +1000 Subject: [PATCH] move_art: Remove missing album art Prevents a fatal file system error if the album art has been moved or renamed and the beets library hasn't been manually updated. --- beets/library.py | 6 ++++++ docs/changelog.rst | 3 +++ 2 files changed, 9 insertions(+) diff --git a/beets/library.py b/beets/library.py index d0571ed3a..37f4d33ea 100644 --- a/beets/library.py +++ b/beets/library.py @@ -1030,6 +1030,12 @@ class Album(LibModel): if not old_art: return + if not os.path.exists(old_art): + log.error(u'removing reference to missing album art file {}', + util.displayable_path(old_art)) + self.artpath = None + return + new_art = self.art_destination(old_art) if new_art == old_art: return diff --git a/docs/changelog.rst b/docs/changelog.rst index b0e7a6cab..f1ed720cd 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -86,6 +86,9 @@ Fixes: * Fix a problem when resizing images with PIL/Pillow on Python 3. Thanks to :user:`architek`. :bug:`2504` :bug:`3029` +* Missing album art file during an update no longer causes a fatal exception + (instead, an error is logged and the missing file path is removed from the + library). :bug:`3030` .. _python-itunes: https://github.com/ocelma/python-itunes