From 8f209d85b9874999906f83fe390ebab960353312 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=A0ar=C5=ABnas=20Nejus?= Date: Mon, 14 Apr 2025 02:58:58 +0100 Subject: [PATCH] Tidy up mbsync logs No need to call `format` since this is done automatically at the point the object is logged (if required). --- beetsplug/mbsync.py | 34 +++++++++++++--------------------- 1 file changed, 13 insertions(+), 21 deletions(-) diff --git a/beetsplug/mbsync.py b/beetsplug/mbsync.py index 5a17473c5..2e62b7b7e 100644 --- a/beetsplug/mbsync.py +++ b/beetsplug/mbsync.py @@ -74,18 +74,15 @@ class MBSyncPlugin(BeetsPlugin): query. """ for item in lib.items(query + ["singleton:true"]): - item_formatted = format(item) if not item.mb_trackid: self._log.info( - "Skipping singleton with no mb_trackid: {0}", item_formatted + "Skipping singleton with no mb_trackid: {}", item ) continue if not (track_info := hooks.track_for_id(item.mb_trackid)): self._log.info( - "Recording ID not found: {0} for track {0}", - item.mb_trackid, - item_formatted, + "Recording ID not found: {0.mb_trackid} for track {0}", item ) continue @@ -99,20 +96,14 @@ class MBSyncPlugin(BeetsPlugin): query and their items. """ # Process matching albums. - for a in lib.albums(query): - album_formatted = format(a) - if not a.mb_albumid: - self._log.info( - "Skipping album with no mb_albumid: {0}", album_formatted - ) + for album in lib.albums(query): + if not album.mb_albumid: + self._log.info("Skipping album with no mb_albumid: {}", album) continue - items = list(a.items()) - if not (album_info := hooks.album_for_id(a.mb_albumid)): + if not (album_info := hooks.album_for_id(album.mb_albumid)): self._log.info( - "Release ID {0} not found for album {1}", - a.mb_albumid, - album_formatted, + "Release ID {0.mb_albumid} not found for album {0}", album ) continue @@ -129,6 +120,7 @@ class MBSyncPlugin(BeetsPlugin): # first, if available, and recording MBIDs otherwise). This should # work for albums that have missing or extra tracks. mapping = {} + items = list(album.items()) for item in items: if ( item.mb_releasetrackid @@ -151,7 +143,7 @@ class MBSyncPlugin(BeetsPlugin): break # Apply. - self._log.debug("applying changes to {}", album_formatted) + self._log.debug("applying changes to {}", album) with lib.transaction(): autotag.apply_metadata(album_info, mapping) changed = False @@ -171,10 +163,10 @@ class MBSyncPlugin(BeetsPlugin): if not pretend: # Update album structure to reflect an item in it. for key in library.Album.item_keys: - a[key] = any_changed_item[key] - a.store() + album[key] = any_changed_item[key] + album.store() # Move album art (and any inconsistent items). if move and lib.directory in util.ancestry(items[0].path): - self._log.debug("moving album {0}", album_formatted) - a.move() + self._log.debug("moving album {}", album) + album.move()