mirror of
https://github.com/beetbox/beets.git
synced 2025-12-25 18:13:17 +01:00
lyrics: search for song title part preceding colon. fix #2205
This commit is contained in:
parent
4b702b338e
commit
8b4f39da42
2 changed files with 8 additions and 0 deletions
|
|
@ -168,6 +168,9 @@ def search_pairs(item):
|
|||
for title in list(titles):
|
||||
titles.add(strip_part(title, pattern))
|
||||
|
||||
# Remove part of the title string after colon ':'
|
||||
titles.add(strip_part(title, r"(.+?)\s*:.*"))
|
||||
|
||||
# Check for a dual song (e.g. Pink Floyd - Speak to Me / Breathe)
|
||||
# and each of them.
|
||||
multi_titles = []
|
||||
|
|
|
|||
|
|
@ -84,6 +84,7 @@ class LyricsPluginTest(unittest.TestCase):
|
|||
self.assertIn(('Alice', ['song']),
|
||||
lyrics.search_pairs(item))
|
||||
|
||||
|
||||
def test_search_pairs_multi_titles(self):
|
||||
item = Item(title='1 / 2', artist='A')
|
||||
self.assertIn(('A', ['1 / 2']), lyrics.search_pairs(item))
|
||||
|
|
@ -118,6 +119,10 @@ class LyricsPluginTest(unittest.TestCase):
|
|||
self.assertNotIn(('A', ['Song']), lyrics.search_pairs(item))
|
||||
self.assertIn(('A', ['Song and B']), lyrics.search_pairs(item))
|
||||
|
||||
item = Item(title='Song: B', artist='A')
|
||||
self.assertIn(('A', ['Song']), lyrics.search_pairs(item))
|
||||
self.assertIn(('A', ['Song: B']), lyrics.search_pairs(item))
|
||||
|
||||
def test_remove_credits(self):
|
||||
self.assertEqual(
|
||||
lyrics.remove_credits("""It's close to midnight
|
||||
|
|
|
|||
Loading…
Reference in a new issue