Ejemplo n.º 1
0
    def __call__(self, url, filename=None):
        self.fetched = url
        fn = url_to_filename(url)
        with open(fn, 'r') as f:
            content = f.read()
        return content


def is_lyrics_content_ok(title, text):
    """Compare lyrics text to expected lyrics for given title"""

    keywords = LYRICS_TEXTS[google.slugify(title)]
    return all(x in text.lower() for x in keywords)

LYRICS_ROOT_DIR = os.path.join(_common.RSRC, 'lyrics')
LYRICS_TEXTS = confit.load_yaml(os.path.join(_common.RSRC, 'lyricstext.yaml'))
DEFAULT_SONG = dict(artist=u'The Beatles', title=u'Lady Madonna')

DEFAULT_SOURCES = [
    dict(DEFAULT_SONG, url=u'http://lyrics.wikia.com/',
         path=u'The_Beatles:Lady_Madonna'),
    dict(artist=u'Santana', title=u'Black magic woman',
         url='http://www.lyrics.com/',
         path=u'black-magic-woman-lyrics-santana.html'),
    dict(DEFAULT_SONG, url='https://www.musixmatch.com/',
         path=u'lyrics/The-Beatles/Lady-Madonna'),
]

# Every source entered in default beets google custom search engine
# must be listed below.
# Use default query when possible, or override artist and title fields
Ejemplo n.º 2
0
    def __call__(self, url, filename=None):
        self.fetched = url
        fn = url_to_filename(url)
        with open(fn, 'r') as f:
            content = f.read()
        return content


def is_lyrics_content_ok(title, text):
    """Compare lyrics text to expected lyrics for given title"""

    keywords = LYRICS_TEXTS[google.slugify(title)]
    return all(x in text.lower() for x in keywords)

LYRICS_ROOT_DIR = os.path.join(_common.RSRC, 'lyrics')
LYRICS_TEXTS = confit.load_yaml(os.path.join(_common.RSRC, 'lyricstext.yaml'))
DEFAULT_SONG = dict(artist=u'The Beatles', title=u'Lady Madonna')

DEFAULT_SOURCES = [
    dict(DEFAULT_SONG, url=u'http://lyrics.wikia.com/',
         path=u'The_Beatles:Lady_Madonna'),
    dict(artist=u'Santana', title=u'Black magic woman',
         url='http://www.lyrics.com/',
         path=u'black-magic-woman-lyrics-santana.html'),
    dict(DEFAULT_SONG, url='https://www.musixmatch.com/',
         path=u'lyrics/The-Beatles/Lady-Madonna'),
]

# Every source entered in default beets google custom search engine
# must be listed below.
# Use default query when possible, or override artist and title fields