bytestringify test_lyrics

This commit is contained in:
Johnny Robeson 2016-06-16 21:28:41 -04:00
parent cb5db71a61
commit 36b3b20422

View file

@ -27,7 +27,7 @@ from mock import MagicMock
from test._common import unittest
from beetsplug import lyrics
from beets.library import Item
from beets.util import confit
from beets.util import confit, bytestring_path
from beets import logging
log = logging.getLogger('beets.test_lyrics')
@ -179,7 +179,9 @@ def url_to_filename(url):
url = re.sub(r'https?://|www.', '', url)
fn = "".join(x for x in url if (x.isalnum() or x == '/'))
fn = fn.split('/')
fn = os.path.join(LYRICS_ROOT_DIR, fn[0], fn[-1]) + '.txt'
fn = os.path.join(LYRICS_ROOT_DIR,
bytestring_path(fn[0]),
bytestring_path(fn[-1] + '.txt'))
return fn
@ -211,8 +213,8 @@ def is_lyrics_content_ok(title, text):
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'))
LYRICS_ROOT_DIR = os.path.join(_common.RSRC, b'lyrics')
LYRICS_TEXTS = confit.load_yaml(os.path.join(_common.RSRC, b'lyricstext.yaml'))
DEFAULT_SONG = dict(artist=u'The Beatles', title=u'Lady Madonna')
DEFAULT_SOURCES = [