From 269d0e5403471b8dd96da5eb4d797ce7d538d9fe Mon Sep 17 00:00:00 2001 From: reiv Date: Sat, 31 Oct 2015 20:07:13 +0100 Subject: [PATCH 1/5] fetchart: Check if album art file actually exists Fixes #1126. --- beetsplug/fetchart.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/beetsplug/fetchart.py b/beetsplug/fetchart.py index b807891e0..5ab07ce96 100644 --- a/beetsplug/fetchart.py +++ b/beetsplug/fetchart.py @@ -567,7 +567,7 @@ class FetchArtPlugin(plugins.BeetsPlugin, RequestMixin): fetchart CLI command. """ for album in albums: - if album.artpath and not force: + if album.artpath and not force and os.path.isfile(album.artpath): message = ui.colorize('text_highlight_minor', 'has album art') else: # In ordinary invocations, look for images on the From d0cfb3e990452c6b44754c9b02a7dd539a962723 Mon Sep 17 00:00:00 2001 From: reiv Date: Mon, 2 Nov 2015 02:20:09 +0100 Subject: [PATCH 2/5] fetchart: add test for re-fetching deleted art This test addresses #1126. --- test/test_art.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/test/test_art.py b/test/test_art.py index 3cc24a7a4..1a24209cf 100644 --- a/test/test_art.py +++ b/test/test_art.py @@ -30,6 +30,7 @@ from beets import library from beets import importer from beets import config from beets import logging +from beets import util from beets.util.artresizer import ArtResizer, WEBPROXY @@ -357,6 +358,18 @@ class ArtImporterTest(UseThePlugin): self.afa_response = artdest self._fetch_art(True) + def test_fetch_art_if_imported_file_deleted(self): + # See #1126. Test the following scenario: + # - Album art imported, `album.artpath` set. + # - Imported album art file subsequently deleted (by user or other + # program). + # `fetchart` should import album art again instead of printing the + # message " has album art". + self._fetch_art(True) + util.remove(self.album.artpath) + self.plugin.batch_fetch_art(self.lib, self.lib.albums(), force=False) + self.assertExists(self.album.artpath) + class ArtForAlbumTest(UseThePlugin): """ Tests that fetchart.art_for_album respects the size From b76597bc43f43fe0d48d52a74d8e5917a2982815 Mon Sep 17 00:00:00 2001 From: reiv Date: Mon, 2 Nov 2015 02:36:15 +0100 Subject: [PATCH 3/5] Changelog for #1126 --- docs/changelog.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs/changelog.rst b/docs/changelog.rst index 4eafe9c90..8b821174f 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -16,6 +16,9 @@ Fixes: when there were not. :bug:`1652` * :doc:`plugins/lastgenre`: Clean up the reggae related genres somewhat. Thanks to :user:`Freso`. :bug:`1661` +* :doc:`plugins/fetchart`: Fix a bug where a database reference to a + non-existent album art file would prevent the command from fetching new art. + :bug:`1126` 1.3.15 (October 17, 2015) From a18506f4713d98e7ff189befe9b690a1c58a8026 Mon Sep 17 00:00:00 2001 From: Adrian Sampson Date: Mon, 2 Nov 2015 11:03:43 -0800 Subject: [PATCH 4/5] Fix #1686: thumbnails using unicode paths --- beetsplug/thumbnails.py | 4 ++-- docs/changelog.rst | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/beetsplug/thumbnails.py b/beetsplug/thumbnails.py index ce3382fc8..6fd8c8cbe 100644 --- a/beetsplug/thumbnails.py +++ b/beetsplug/thumbnails.py @@ -39,8 +39,8 @@ from beets.util.artresizer import ArtResizer, has_IM, has_PIL BASE_DIR = os.path.join(BaseDirectory.xdg_cache_home, "thumbnails") -NORMAL_DIR = os.path.join(BASE_DIR, "normal") -LARGE_DIR = os.path.join(BASE_DIR, "large") +NORMAL_DIR = util.bytestring_path(os.path.join(BASE_DIR, "normal")) +LARGE_DIR = util.bytestring_path(os.path.join(BASE_DIR, "large")) class ThumbnailsPlugin(BeetsPlugin): diff --git a/docs/changelog.rst b/docs/changelog.rst index 8b821174f..070dfeaf7 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -19,6 +19,7 @@ Fixes: * :doc:`plugins/fetchart`: Fix a bug where a database reference to a non-existent album art file would prevent the command from fetching new art. :bug:`1126` +* :doc:`/plugins/thumbnails`: Fix a crash with Unicode paths. :bug:`1686` 1.3.15 (October 17, 2015) From 69b0ae974599a9e00339a8eeeccc1ccbb03feb4d Mon Sep 17 00:00:00 2001 From: Adrian Sampson Date: Mon, 2 Nov 2015 14:40:00 -0800 Subject: [PATCH 5/5] Add an FAQ about changing music directories --- docs/faq.rst | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/docs/faq.rst b/docs/faq.rst index 447be45e1..050461587 100644 --- a/docs/faq.rst +++ b/docs/faq.rst @@ -208,6 +208,23 @@ Use the ``%asciify{}`` function in your path formats. See :ref:`template-functions`. +.. _move-dir: + +…point beets at a new music directory? +-------------------------------------- + +If you want to move your music from one directory to another, the best way is +to let beets do it for you. First, edit your configuration and set the +``directory`` setting to the new place. Then, type ``beet move`` to have beets +move all your files. + +If you've already moved your music *outside* of beets, you have a few options: + +- Move the music back (with an ordinary ``mv``) and then use the above steps. +- Delete your database and re-create it from the new paths using ``beet import -AWMC``. +- Resort to manually modifying the SQLite database (not recommended). + + Why does beets… ===============