From 0c596fd163db0957845daf3d09d7d7e4c5f0fac0 Mon Sep 17 00:00:00 2001 From: multikatt Date: Fri, 15 May 2015 14:13:01 -0400 Subject: [PATCH] Break out query into its own function --- beetsplug/ipfs.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/beetsplug/ipfs.py b/beetsplug/ipfs.py index 2d0ba04f8..f830790d4 100644 --- a/beetsplug/ipfs.py +++ b/beetsplug/ipfs.py @@ -152,14 +152,18 @@ class IPFSPlugin(BeetsPlugin): return False 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) + + def query(self, lib, args): lib_root = os.path.dirname(lib.path) remote_libs = lib_root + "/remotes" path = remote_libs + "/joined.db" rlib = library.Library(path) albums = rlib.albums(ui.decargs(args)) - fmt = config['format_album'].get() - for album in albums: - ui.print_(format(album, fmt), " : ", album.ipfs) + return albums def ipfs_added_albums(self, rlib, tmpname): """ Returns a new library with only albums/items added to ipfs