Skip to content

Commit

Permalink
Another round of lastgenre logging nitpicks
Browse files Browse the repository at this point in the history
- Printing out album/item in default format could lead to unreadable
  clutter depending on the user's configured formats.
- The album's name and the individual tracks' title should be just
  sufficient to provide context as well readability.
- Log like this while importing as well as in standalone runs.
  • Loading branch information
JOJ0 committed Nov 4, 2023
1 parent 46bca59 commit a8479d2
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions beetsplug/lastgenre/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,9 @@ def lastgenre_func(lib, opts, args):
for album in lib.albums(ui.decargs(args)):
album.genre, src = self._get_genre(album)
self._log.info(
"genre for album {0} ({1}): {0.genre}", album, src
'genre for album "{0.album}" ({1}): {0.genre}',
album,
src,
)
if "track" in self.sources:
album.store(inherit=False)
Expand All @@ -433,7 +435,7 @@ def lastgenre_func(lib, opts, args):
item.genre, src = self._get_genre(item)
item.store()
self._log.info(
"genre for track {0} ({1}): {0.genre}",
'genre for track "{0.title}" ({1}): {0.genre}',
item,
src,
)
Expand All @@ -459,7 +461,7 @@ def imported(self, session, task):
album = task.album
album.genre, src = self._get_genre(album)
self._log.debug(
"added last.fm album genre ({0}): {1}", src, album.genre
'genre for album "{0.album}" ({1}): {0.genre}', album, src
)

# If we're using track-level sources, store the album genre only,
Expand All @@ -469,7 +471,9 @@ def imported(self, session, task):
for item in album.items():
item.genre, src = self._get_genre(item)
self._log.debug(
"added last.fm item genre ({0}): {1}", src, item.genre
'genre for track "{0.title}" ({1}): {0.genre}',
item,
src,
)
item.store()
# Store the album genre and inherit to tracks.
Expand Down

0 comments on commit a8479d2

Please sign in to comment.