Skip to content

Commit 6852ab5

Browse files
committed
Removed unicode_literals from plugins
* acousticbrainz * badfiles * bpm
1 parent 95e940b commit 6852ab5

File tree

3 files changed

+22
-25
lines changed

3 files changed

+22
-25
lines changed

beetsplug/acousticbrainz.py

+8-9
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@
1515

1616
"""Fetch various AcousticBrainz metadata using MBID.
1717
"""
18-
from __future__ import (division, absolute_import, print_function,
19-
unicode_literals)
18+
from __future__ import (division, absolute_import, print_function)
2019

2120
import requests
2221
import operator
@@ -38,7 +37,7 @@ def __init__(self):
3837

3938
def commands(self):
4039
cmd = ui.Subcommand('acousticbrainz',
41-
help="fetch metadata from AcousticBrainz")
40+
help=u"fetch metadata from AcousticBrainz")
4241

4342
def func(lib, opts, args):
4443
items = lib.items(ui.decargs(args))
@@ -63,32 +62,32 @@ def get_value(*map_path):
6362
try:
6463
return reduce(operator.getitem, map_path, data)
6564
except KeyError:
66-
log.debug('Invalid Path: {}', map_path)
65+
log.debug(u'Invalid Path: {}', map_path)
6766

6867
for item in items:
6968
if item.mb_trackid:
70-
log.info('getting data for: {}', item)
69+
log.info(u'getting data for: {}', item)
7170

7271
# Fetch the data from the AB API.
7372
urls = [generate_url(item.mb_trackid, path) for path in LEVELS]
74-
log.debug('fetching URLs: {}', ' '.join(urls))
73+
log.debug(u'fetching URLs: {}', ' '.join(urls))
7574
try:
7675
res = [requests.get(url) for url in urls]
7776
except requests.RequestException as exc:
78-
log.info('request error: {}', exc)
77+
log.info(u'request error: {}', exc)
7978
continue
8079

8180
# Check for missing tracks.
8281
if any(r.status_code == 404 for r in res):
83-
log.info('recording ID {} not found', item.mb_trackid)
82+
log.info(u'recording ID {} not found', item.mb_trackid)
8483
continue
8584

8685
# Parse the JSON response.
8786
try:
8887
data = res[0].json()
8988
data.update(res[1].json())
9089
except ValueError:
91-
log.debug('Invalid Response: {} & {}', [r.text for r in res])
90+
log.debug(u'Invalid Response: {} & {}', [r.text for r in res])
9291

9392
# Get each field and assign it on the item.
9493
item.danceable = get_value(

beetsplug/badfiles.py

+10-11
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@
1616
"""Use command-line tools to check for audio file corruption.
1717
"""
1818

19-
from __future__ import (division, absolute_import, print_function,
20-
unicode_literals)
19+
from __future__ import (division, absolute_import, print_function)
2120

2221
from beets.plugins import BeetsPlugin
2322
from beets.ui import Subcommand
@@ -32,7 +31,7 @@
3231

3332
class BadFiles(BeetsPlugin):
3433
def run_command(self, cmd):
35-
self._log.debug("running command: {}",
34+
self._log.debug(u"running command: {}",
3635
displayable_path(list2cmdline(cmd)))
3736
try:
3837
output = check_output(cmd, stderr=STDOUT)
@@ -44,7 +43,7 @@ def run_command(self, cmd):
4443
status = e.returncode
4544
except OSError as e:
4645
if e.errno == errno.ENOENT:
47-
ui.print_("command not found: {}".format(cmd[0]))
46+
ui.print_(u"command not found: {}".format(cmd[0]))
4847
sys.exit(1)
4948
else:
5049
raise
@@ -87,9 +86,9 @@ def check_bad(self, lib, opts, args):
8786
# First, check whether the path exists. If not, the user
8887
# should probably run `beet update` to cleanup your library.
8988
dpath = displayable_path(item.path)
90-
self._log.debug("checking path: {}", dpath)
89+
self._log.debug(u"checking path: {}", dpath)
9190
if not os.path.exists(item.path):
92-
ui.print_("{}: file does not exist".format(
91+
ui.print_(u"{}: file does not exist".format(
9392
ui.colorize('text_error', dpath)))
9493

9594
# Run the checker against the file if one is found
@@ -102,20 +101,20 @@ def check_bad(self, lib, opts, args):
102101
path = item.path.decode(sys.getfilesystemencoding())
103102
status, errors, output = checker(path)
104103
if status > 0:
105-
ui.print_("{}: checker exited withs status {}"
104+
ui.print_(u"{}: checker exited withs status {}"
106105
.format(ui.colorize('text_error', dpath), status))
107106
for line in output:
108107
ui.print_(" {}".format(displayable_path(line)))
109108
elif errors > 0:
110-
ui.print_("{}: checker found {} errors or warnings"
109+
ui.print_(u"{}: checker found {} errors or warnings"
111110
.format(ui.colorize('text_warning', dpath), errors))
112111
for line in output:
113-
ui.print_(" {}".format(displayable_path(line)))
112+
ui.print_(u" {}".format(displayable_path(line)))
114113
else:
115-
ui.print_("{}: ok".format(ui.colorize('text_success', dpath)))
114+
ui.print_(u"{}: ok".format(ui.colorize('text_success', dpath)))
116115

117116
def commands(self):
118117
bad_command = Subcommand('bad',
119-
help='check for corrupt or missing files')
118+
help=u'check for corrupt or missing files')
120119
bad_command.func = self.check_bad
121120
return [bad_command]

beetsplug/bpm.py

+4-5
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@
1515

1616
"""Determine BPM by pressing a key to the rhythm."""
1717

18-
from __future__ import (division, absolute_import, print_function,
19-
unicode_literals)
18+
from __future__ import (division, absolute_import, print_function)
2019

2120
import time
2221

@@ -59,8 +58,8 @@ def __init__(self):
5958

6059
def commands(self):
6160
cmd = ui.Subcommand('bpm',
62-
help='determine bpm of a song by pressing \
63-
a key to the rhythm')
61+
help=u'determine bpm of a song by pressing '
62+
u'a key to the rhythm')
6463
cmd.func = self.command
6564
return [cmd]
6665

@@ -70,7 +69,7 @@ def command(self, lib, opts, args):
7069
def get_bpm(self, items, write=False):
7170
overwrite = self.config['overwrite'].get(bool)
7271
if len(items) > 1:
73-
raise ValueError('Can only get bpm of one song at time')
72+
raise ValueError(u'Can only get bpm of one song at time')
7473

7574
item = items[0]
7675
if item['bpm']:

0 commit comments

Comments
 (0)