From d3ec3117217e755c2e39c66ddbadbe52f6e57243 Mon Sep 17 00:00:00 2001 From: multikatt Date: Sun, 31 May 2015 00:32:03 -0400 Subject: [PATCH] Dont fail if theres no imported albums --- beetsplug/ipfs.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/beetsplug/ipfs.py b/beetsplug/ipfs.py index dc749dcdf..3d2f6eed7 100644 --- a/beetsplug/ipfs.py +++ b/beetsplug/ipfs.py @@ -163,13 +163,18 @@ class IPFSPlugin(BeetsPlugin): def ipfs_list(self, lib, args): fmt = config['format_album'].get() albums = self.query(lib, args) - for album in albums: - ui.print_(format(album, fmt), " : ", album.ipfs) + if albums: + for album in albums: + ui.print_(format(album, fmt), " : ", album.ipfs) + else: + ui.print_("No imported albums yet.") def query(self, lib, args): lib_root = os.path.dirname(lib.path) remote_libs = lib_root + "/remotes" path = remote_libs + "/joined.db" + if not os.path.isfile(path): + return False rlib = library.Library(path) albums = rlib.albums(ui.decargs(args)) return albums