From af468f5259f51408958d8d997e12bfc00ab23247 Mon Sep 17 00:00:00 2001 From: Fabrice Laporte Date: Sat, 26 Apr 2014 19:26:28 +0200 Subject: [PATCH] Move lyrics listings from .py to .yaml file --- test/lyrics_sources.py | 10 +-- test/rsrc/lyricstext.yaml | 155 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 159 insertions(+), 6 deletions(-) create mode 100644 test/rsrc/lyricstext.yaml diff --git a/test/lyrics_sources.py b/test/lyrics_sources.py index 16cb920b0..58be4eb4d 100644 --- a/test/lyrics_sources.py +++ b/test/lyrics_sources.py @@ -16,15 +16,15 @@ import os import logging +import _common from _common import unittest -import _lyricstext from beetsplug import lyrics from beets import config from beets.util import confit from bs4 import BeautifulSoup -from nose.plugins.attrib import attr log = logging.getLogger('beets') +LYRICS_TEXTS = confit.load_yaml(os.path.join(_common.RSRC, 'lyricstext.yaml')) try: googlekey = config['lyrics']['google_API_key'].get(unicode) @@ -54,7 +54,7 @@ class MockFetchUrl(object): def is_lyrics_content_ok(title, text): """Compare lyrics text to expected lyrics for given title""" - setexpected = set(_lyricstext.texts[title].split()) + setexpected = set(LYRICS_TEXTS[lyrics.slugify(title)].split()) settext = set(text.split()) setinter = setexpected.intersection(settext) # consider lyrics ok if they share 50% or more with the reference @@ -80,11 +80,9 @@ class LyricsPluginTest(unittest.TestCase): self.assertTrue(is_lyrics_content_ok(definfo['title'], res)) def test_missing_lyrics(self): - for msg in _lyricstext.missing_texts: - self.assertFalse(lyrics.is_lyrics(msg), msg) + self.assertFalse(lyrics.is_lyrics(LYRICS_TEXTS['missing_texts'])) -@attr('slow') class LyricsScrapingPluginTest(unittest.TestCase): # Every source entered in default beets google custom search engine diff --git a/test/rsrc/lyricstext.yaml b/test/rsrc/lyricstext.yaml new file mode 100644 index 000000000..8bc40d30a --- /dev/null +++ b/test/rsrc/lyricstext.yaml @@ -0,0 +1,155 @@ +Lady_Madonna: | + 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? + Friday night arrives without a suitcase + Sunday morning creep in like a nun + Monday's child has learned to tie his bootlace + See how they run + + Lady Madonna, baby at your breast + Wonder how you manage to feed the rest + + See how they run + + Lady Madonna, lying on the bed + Listen to the music playing in your head + + Tuesday afternoon is never ending + Wednesday morning papers didn't come + Thursday night you stockings needed mending + See how they run + + Lady Madonna, children at your feet + Wonder how you manage to make ends meet + +Jazz_n_blues: | + It's always gone within two days. + Follow my father, his extravagant ways. + So if I got it I will spend it all, + Camden and Parkway 'til I hit a wall. + + I cross my fingers at the cash machine, + As I check my balance I kiss the screen. + I love it when it says I got the means, + To go to Miss Sixty and pick up my new jeans. + + Chorus: (x2) + Never lasts me long, + Handle finance wrong, + Blow it all on bags and shoes, + Jazz 'n blues. + + Standin' too deep at the bar today, + Wait with impatience to throw my cash away. + Four white Russians a JD and Coke, + Buy their drinks all night and now I am broke. + But that's cool 'cause I can borrow more from you, + And I didn't forget about that fifty pound, too. + Tell you what, my advance is comin' through, + I'll take you out shoppin', + Can you wait 'til next June? Yeah. + + Chorus: + Never lasts me long, + Handle finance wrong (handle it wrong), + Blow it all on bags and shoes, + Jazz 'n blues (jazz and blues). + Never lasts me long (long), + Handle finance wrong (wrong), + Blow it all on bags and shoes (blow it all), + Jazz 'n blues. + +I_could_beat_myself: | + oooh ahh, I'm hurting, bad + oooh ahh I'm hurting bad! + + I did not see what I was supposed to see + taking it easy when a friend told me I was in + danger, so much danger. + Underestimating my woman, not taking her + out, working too hard and now she's gone off + with a stranger, someone I don't even know. + + I should have taken her out, every once and a + while, taken her to dinner on the finer side, shown + her a life that was all worth while, now I guese I gotta + walk an extra mile! I could beat myself! Ahh yeah. + + Now I'm gonna feel funny out there in the crowd + when my friends all ask me, where is your woman? + long time I don't see. Now I've got to think fast gotta + use my head, give a good story and make sure they + buy my version of the situation. + + All the while I wouldn't lie I'm gonna do this once + see my reputation sinking in the distance, if they + knew the truth that really existed...then my little sanity + would be wasted! I could beat myself ahh yes..I could + beat myself!!! Ohh lord lord. + + oooh ooh I'm hurting, hurting inside + oooh ooh I'm hurting + + Now I really want to hear a little news now and + then, this is not what I expect to hear from my + friend I'm dissapointed. He should realize that its + gonna destroy my position (remember I'm a name + brand) now I've gotta see....I should have held her tight + every once and a while, gotten it together on the finer style + shown her a life that was all worth while, now it seems I gotta + walk an extra mile....I could beat myself..ahh yes, I could beat myself + ooh lord + + ooh I'm hurting + ooooh I'm hurting,hurting inside + + I don't know what I wanna tell you + but I wanna tell you something real, real good yes + someting to make you + wanna shiver + +Hey_it_s_ok: | + Mama, Papa, please forget the times + I wet my bed + I swear not to do it again + Please forgive the way I looked + when I was fourteen + I didn't know who I wanted to be + + Hey It's OK, It's OK + Cause I've found what i wanted + Hey It's OK, I'ts Ok + Cause I've found what i wanted + + Friends and lovers please forgive + the mean things I've said + I swear not to do again + Please forgive the way I act when + I've had too much to drink + I'm fighting against myself + + Hey It's OK, It's OK + Cause I've found what i wanted + Hey It's OK, I'ts Ok + + Cause I've found what i wanted + + And I swear not to do anything funny anymore + yes I swear not to do anything funny anymore + + Hey It's OK, It's OK + Cause I've found what i wanted + Hey It's OK, I'ts Ok + Cause I've found what i wanted + Hey It's OK, It's OK + Cause I've found what i wanted + Hey It's OK, I'ts Ok + Cause I've found what i wanted + +missing_texts: | + Lyricsmania staff is working hard for you to add $TITLE lyrics as soon + as they'll be released by $ARTIST, check back soon! + In case you have the lyrics to $TITLE and want to send them to us, fill out + the following form.