Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion beets/util/lyrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ def _split_lines(self) -> list[tuple[str, str]]:
"""
return [
(m[1], m[2]) if (m := self.LINE_PARTS_PAT.match(line)) else ("", "")
for line in self.text.splitlines()
for line in (self.text or "").splitlines()
]
Comment on lines 106 to 109

@cached_property
Expand Down
8 changes: 4 additions & 4 deletions beetsplug/lyrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -398,10 +398,10 @@ def fetch(
for group in self.fetch_candidates(artist, title, album, length):
candidates = [evaluate_item(item) for item in group]
if item := self.pick_best_match(candidates):
lyrics = item.get_text(self.config["synced"].get(bool))
return Lyrics(
lyrics, self.__class__.name, f"{self.GET_URL}/{item.id}"
)
if lyrics := item.get_text(self.config["synced"].get(bool)):
return Lyrics(
lyrics, self.__class__.name, f"{self.GET_URL}/{item.id}"
)
Comment on lines 400 to +404

return None

Expand Down
5 changes: 5 additions & 0 deletions test/plugins/test_lyrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -644,6 +644,11 @@ def test_synced_config_option(
"plain",
id="plain by default",
),
pytest.param(
[lyrics_match(syncedLyrics=None, plainLyrics=None)],
None,
id="no lyrics when both fields are null",
),
pytest.param(
[
lyrics_match(
Expand Down
Loading