From 2e2e0b291973b0bb42eec5f6bfe179dbe370de05 Mon Sep 17 00:00:00 2001 From: Adrian Sampson Date: Sat, 5 Oct 2013 11:06:08 -0700 Subject: [PATCH] get_album (and evalute_template) with non-DB items Alternative fix for #403. --- beets/library.py | 6 ++++-- beetsplug/missing.py | 2 -- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/beets/library.py b/beets/library.py index 638e0febb..ecfb241e0 100644 --- a/beets/library.py +++ b/beets/library.py @@ -475,9 +475,11 @@ class Item(LibModel): def get_album(self): """Get the Album object that this item belongs to, if any, or - None if the item is a singleton. + None if the item is a singleton or is not associated with a + library. """ - self._check_db() + if not self._lib: + return None return self._lib.get_album(self) diff --git a/beetsplug/missing.py b/beetsplug/missing.py index d2776ccbc..0b12ebde6 100644 --- a/beetsplug/missing.py +++ b/beetsplug/missing.py @@ -153,8 +153,6 @@ class MissingPlugin(BeetsPlugin): else: for item in _missing(album): - item._lib = lib - item.id = '-1' print_obj(item, lib, fmt=fmt) self._command.func = _miss