Skip to content

Commit ad2ff1f

Browse files
authored
Fix fetchart colors broken by 67e668d (#6273)
Fetchart colors were broken by 67e668d. Since that commit fetchart displays this, with escape codes instead of colorized output: ``` fetchart: Alasdair Fraser & Natalie Haas - Meridians: �[37mhas album art�[39;49;00m ``` This fixes it by using `ui.print_` instead of `Logger`. This seems to be in line with other plugins such as play: https://github.com/beetbox/beets/blob/1a899cc92af57b72a76570fb37d1c4eda0f5e842/beetsplug/play.py#L135
2 parents 1a899cc + b53aff9 commit ad2ff1f

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

beetsplug/fetchart.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1588,7 +1588,7 @@ def batch_fetch_art(
15881588
message = ui.colorize(
15891589
"text_highlight_minor", "has album art"
15901590
)
1591-
self._log.info("{}: {}", album, message)
1591+
ui.print_(f"{album}: {message}")
15921592
else:
15931593
# In ordinary invocations, look for images on the
15941594
# filesystem. When forcing, however, always go to the Web
@@ -1601,4 +1601,4 @@ def batch_fetch_art(
16011601
message = ui.colorize("text_success", "found album art")
16021602
else:
16031603
message = ui.colorize("text_error", "no art found")
1604-
self._log.info("{}: {}", album, message)
1604+
ui.print_(f"{album}: {message}")

docs/changelog.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ New features:
3737
differences in metadata source styles.
3838
- :doc:`plugins/spotify`: Added support for multi-artist albums and tracks,
3939
saving all contributing artists to the respective fields.
40+
- :doc:`plugins/fetchart`: Fix colorized output text.
4041
- :doc:`plugins/ftintitle`: Featured artists are now inserted before brackets
4142
containing remix/edit-related keywords (e.g., "Remix", "Live", "Edit") instead
4243
of being appended at the end. This improves formatting for titles like "Song 1

test/plugins/test_fetchart.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,3 +98,8 @@ def test_filesystem_picks_up_hidden_file(self):
9898
self.run_command("fetchart")
9999
self.album.load()
100100
self.check_cover_is_stored()
101+
102+
def test_colorization(self):
103+
self.config["ui"]["color"] = True
104+
out = self.run_with_output("fetchart")
105+
assert " - the älbum: \x1b[1;31mno art found\x1b[39;49;00m\n" == out

0 commit comments

Comments
 (0)