X-Git-Url: https://git.kaliko.me/?a=blobdiff_plain;f=sima%2Futils%2Fblcli.py;h=4442abef59931cd4dc74362c42424bff7009ca24;hb=3b4178f;hp=5f0d14a9c1bae797d6f9f68e1b347c9f3dc08678;hpb=703c89bb8361c1d5bc7456ef47a91b5e63dcb74b;p=mpd-sima.git diff --git a/sima/utils/blcli.py b/sima/utils/blcli.py index 5f0d14a..4442abe 100644 --- a/sima/utils/blcli.py +++ b/sima/utils/blcli.py @@ -21,7 +21,7 @@ import atexit import sys # local import -from ..mpdclient import MPD, PlayerError, Artist, Album +from ..mpdclient import MPD, Artist, Album from ..lib.simadb import SimaDB @@ -35,25 +35,21 @@ class BLCli(MPD): cmd = options.get('command', None) if not cmd or not cmd.startswith('bl-'): return - try: - getattr(self, cmd.replace('-', '_'))() - except PlayerError as err: - self.log.error(err) - sys.exit(1) + getattr(self, cmd.replace('-', '_'))() def bl_view(self): blocklist = self.sdb.view_bl() for entry in ['artist', 'album', 'title']: header = False - for bl in blocklist: - art = bl.get(entry, '') - mbid = bl.get(f'musicbrainz_{entry}', '') - if art or mbid: + for blitem in blocklist: + val = blitem.get(entry, '') + mbid = blitem.get(f'musicbrainz_{entry}', '') + if val or mbid: if not header: header = True self.log.info(f'{entry.capitalize()}' '(id name musicbranzID):') - self.log.info(f'{bl["id"]} "{art}"\t\t{mbid}') + self.log.info(f'{blitem["id"]} "{val}"\t\t{mbid}') def bl_add_artist(self): artist = self.options.get('artist', None)