get_album (and evalute_template) with non-DB items

Alternative fix for #403.
This commit is contained in:
Adrian Sampson 2013-10-05 11:06:08 -07:00
parent 89c0e2c8b7
commit 2e2e0b2919
2 changed files with 4 additions and 4 deletions

View file

@ -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)

View file

@ -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