lyrics: search for song title part preceding colon. fix #2205

This commit is contained in:
Fabrice Laporte 2016-09-23 22:23:32 +02:00
parent 4b702b338e
commit 8b4f39da42
2 changed files with 8 additions and 0 deletions

View file

@ -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 = []

View file

@ -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