mirror of
https://github.com/beetbox/beets.git
synced 2025-12-06 08:39:17 +01:00
Better error handling when theres nothing imported
yet
This commit is contained in:
parent
a80b402f2f
commit
5bb976d8f4
1 changed files with 9 additions and 7 deletions
|
|
@ -162,19 +162,21 @@ class IPFSPlugin(BeetsPlugin):
|
|||
|
||||
def ipfs_list(self, lib, args):
|
||||
fmt = config['format_album'].get()
|
||||
albums = self.query(lib, args)
|
||||
if albums:
|
||||
for album in albums:
|
||||
ui.print_(format(album, fmt), " : ", album.ipfs)
|
||||
else:
|
||||
ui.print_("No imported albums yet.")
|
||||
try:
|
||||
albums = self.query(lib, args)
|
||||
except IOError:
|
||||
ui.print_("No imported libraries yet.")
|
||||
return
|
||||
|
||||
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"
|
||||
if not os.path.isfile(path):
|
||||
return False
|
||||
raise IOError
|
||||
rlib = library.Library(path)
|
||||
albums = rlib.albums(ui.decargs(args))
|
||||
return albums
|
||||
|
|
|
|||
Loading…
Reference in a new issue