From 44fda7ca0ad28243c0ce9b07e9bd43db976c2323 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=A0ar=C5=ABnas=20Nejus?= Date: Sat, 2 Aug 2025 10:39:36 +0100 Subject: [PATCH] lyrics: use another beatles song for Lyricsmode MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Lady Madonna apparently is gone from this website. ¯\_(ツ)_/¯ --- beetsplug/lyrics.py | 6 ++--- test/plugins/lyrics_pages.py | 49 ++++++++++++++++++++---------------- 2 files changed, 31 insertions(+), 24 deletions(-) diff --git a/beetsplug/lyrics.py b/beetsplug/lyrics.py index bd451db59..f492ab3cc 100644 --- a/beetsplug/lyrics.py +++ b/beetsplug/lyrics.py @@ -644,7 +644,7 @@ class Google(SearchBackend): re.IGNORECASE | re.VERBOSE, ) #: Split cleaned up URL title into artist and title parts. - URL_TITLE_PARTS_RE = re.compile(r" +(?:[ :|-]+|par|by) +") + URL_TITLE_PARTS_RE = re.compile(r" +(?:[ :|-]+|par|by) +|, ") SOURCE_DIST_FACTOR = {"www.azlyrics.com": 0.5, "www.songlyrics.com": 0.6} @@ -702,8 +702,8 @@ class Google(SearchBackend): result_artist, result_title = "", parts[0] else: # sort parts by their similarity to the artist - parts.sort(key=lambda p: cls.get_part_dist(artist, title, p)) - result_artist, result_title = parts[0], " ".join(parts[1:]) + result_artist = min(parts, key=lambda p: string_dist(artist, p)) + result_title = min(parts, key=lambda p: string_dist(title, p)) return SearchResult(result_artist, result_title, item["link"]) diff --git a/test/plugins/lyrics_pages.py b/test/plugins/lyrics_pages.py index e1806b167..9d84c5327 100644 --- a/test/plugins/lyrics_pages.py +++ b/test/plugins/lyrics_pages.py @@ -128,6 +128,7 @@ lyrics_pages = [ artist="Atlanta", track_title="Mergaitės Nori Mylėt", url_title="Mergaitės nori mylėt – Atlanta | Dainų Žodžiai", + marks=[xfail_on_ci("Expired SSL certificate")], ), LyricsPage.make( "https://genius.com/The-beatles-lady-madonna-lyrics", @@ -328,34 +329,40 @@ lyrics_pages = [ url_title="The Beatles - Lady Madonna Lyrics", ), LyricsPage.make( - "https://www.lyricsmode.com/lyrics/b/beatles/lady_madonna.html", + "https://www.lyricsmode.com/lyrics/b/beatles/mother_natures_son.html", """ - Lady Madonna, children at your feet. - Wonder how you manage to make ends meet. - Who finds the money? When you pay the rent? - Did you think that money was heaven sent? + Born a poor young country boy, Mother Nature's son + All day long I'm sitting singing songs for everyone - Friday night arrives without a suitcase. - Sunday morning creep in like a nun. - Mondays child has learned to tie his bootlace. - See how they run. + Sit beside a mountain stream, see her waters rise + Listen to the pretty sound of music as she flies - Lady Madonna, baby at your breast. - Wonder how you manage to feed the rest. + Doo doo doo doo doo doo doo doo doo doo doo + Doo doo doo doo doo doo doo doo doo + Doo doo doo - See how they run. - Lady Madonna, lying on the bed, - Listen to the music playing in your head. + Find me in my field of grass, Mother Nature's son + Swaying daises sing a lazy song beneath the sun - Tuesday afternoon is never ending. - Wednesday morning papers didn't come. - Thursday night you stockings needed mending. - See how they run. + Doo doo doo doo doo doo doo doo doo doo doo + Doo doo doo doo doo doo doo doo doo + Doo doo doo doo doo doo + Yeah yeah yeah - Lady Madonna, children at your feet. - Wonder how you manage to make ends meet. + Mm mm mm mm mm mm mm + Mm mm mm, ooh ooh ooh + Mm mm mm mm mm mm mm + Mm mm mm mm, wah wah wah + + Wah, Mother Nature's son """, - url_title="Lady Madonna lyrics by The Beatles - original song full text. Official Lady Madonna lyrics, 2024 version | LyricsMode.com", # noqa: E501 + artist="The Beatles", + track_title="Mother Nature's Son", + url_title=( + "Mother Nature's Son lyrics by The Beatles - original song full" + " text. Official Mother Nature's Son lyrics, 2025 version" + " | LyricsMode.com" + ), ), LyricsPage.make( "https://www.lyricsontop.com/amy-winehouse-songs/jazz-n-blues-lyrics.html",