From 46f382fd9b43da5228a2b2346b6743af69a84e7d Mon Sep 17 00:00:00 2001 From: Adrian Sampson Date: Tue, 14 Apr 2015 11:45:20 -0700 Subject: [PATCH] importadded: Fix in-place singleton imports Fixes #1416. --- beetsplug/importadded.py | 6 +++++- docs/changelog.rst | 2 ++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/beetsplug/importadded.py b/beetsplug/importadded.py index 5893d98a3..de1bcdabc 100644 --- a/beetsplug/importadded.py +++ b/beetsplug/importadded.py @@ -9,6 +9,7 @@ from __future__ import (unicode_literals, absolute_import, print_function, import os from beets import util +from beets import importer from beets.plugins import BeetsPlugin @@ -50,7 +51,10 @@ class ImportAddedPlugin(BeetsPlugin): session.config['link']): self._log.debug(u"In place import detected, recording mtimes from " u"source paths") - for item in task.items: + items = [task.item] \ + if isinstance(task, importer.SingletonImportTask) \ + else task.items + for item in items: self.record_import_mtime(item, item.path, item.path) def record_reimported(self, task, session): diff --git a/docs/changelog.rst b/docs/changelog.rst index 5527730b3..f8f1c00ff 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -27,6 +27,8 @@ Little fixes and improvements: beets would ignore the locale settings and use UTF-8 by default. :bug:`1419` * :doc:`/plugins/discogs`: Better error handling when we can't communicate with Discogs on setup. :bug:`1417` +* :doc:`/plugins/importadded`: Fix a crash when importing singletons in-place. + :bug:`1416` 1.3.11 (April 5, 2015) ----------------------