From 6852ab5472adf8822afef10afc074a5e166d346f Mon Sep 17 00:00:00 2001
From: Peter Kessen
Date: Sat, 20 Feb 2016 11:49:10 +0100
Subject: [PATCH] Removed unicode_literals from plugins
* acousticbrainz
* badfiles
* bpm
---
beetsplug/acousticbrainz.py | 17 ++++++++---------
beetsplug/badfiles.py | 21 ++++++++++-----------
beetsplug/bpm.py | 9 ++++-----
3 files changed, 22 insertions(+), 25 deletions(-)
diff --git a/beetsplug/acousticbrainz.py b/beetsplug/acousticbrainz.py
index 49f01ea21..d4b5aa9b4 100644
--- a/beetsplug/acousticbrainz.py
+++ b/beetsplug/acousticbrainz.py
@@ -15,8 +15,7 @@
"""Fetch various AcousticBrainz metadata using MBID.
"""
-from __future__ import (division, absolute_import, print_function,
- unicode_literals)
+from __future__ import (division, absolute_import, print_function)
import requests
import operator
@@ -38,7 +37,7 @@ class AcousticPlugin(plugins.BeetsPlugin):
def commands(self):
cmd = ui.Subcommand('acousticbrainz',
- help="fetch metadata from AcousticBrainz")
+ help=u"fetch metadata from AcousticBrainz")
def func(lib, opts, args):
items = lib.items(ui.decargs(args))
@@ -63,24 +62,24 @@ def fetch_info(log, items, write):
try:
return reduce(operator.getitem, map_path, data)
except KeyError:
- log.debug('Invalid Path: {}', map_path)
+ log.debug(u'Invalid Path: {}', map_path)
for item in items:
if item.mb_trackid:
- log.info('getting data for: {}', item)
+ log.info(u'getting data for: {}', item)
# Fetch the data from the AB API.
urls = [generate_url(item.mb_trackid, path) for path in LEVELS]
- log.debug('fetching URLs: {}', ' '.join(urls))
+ log.debug(u'fetching URLs: {}', ' '.join(urls))
try:
res = [requests.get(url) for url in urls]
except requests.RequestException as exc:
- log.info('request error: {}', exc)
+ log.info(u'request error: {}', exc)
continue
# Check for missing tracks.
if any(r.status_code == 404 for r in res):
- log.info('recording ID {} not found', item.mb_trackid)
+ log.info(u'recording ID {} not found', item.mb_trackid)
continue
# Parse the JSON response.
@@ -88,7 +87,7 @@ def fetch_info(log, items, write):
data = res[0].json()
data.update(res[1].json())
except ValueError:
- log.debug('Invalid Response: {} & {}', [r.text for r in res])
+ log.debug(u'Invalid Response: {} & {}', [r.text for r in res])
# Get each field and assign it on the item.
item.danceable = get_value(
diff --git a/beetsplug/badfiles.py b/beetsplug/badfiles.py
index c6877205c..43df51cce 100644
--- a/beetsplug/badfiles.py
+++ b/beetsplug/badfiles.py
@@ -16,8 +16,7 @@
"""Use command-line tools to check for audio file corruption.
"""
-from __future__ import (division, absolute_import, print_function,
- unicode_literals)
+from __future__ import (division, absolute_import, print_function)
from beets.plugins import BeetsPlugin
from beets.ui import Subcommand
@@ -32,7 +31,7 @@ import sys
class BadFiles(BeetsPlugin):
def run_command(self, cmd):
- self._log.debug("running command: {}",
+ self._log.debug(u"running command: {}",
displayable_path(list2cmdline(cmd)))
try:
output = check_output(cmd, stderr=STDOUT)
@@ -44,7 +43,7 @@ class BadFiles(BeetsPlugin):
status = e.returncode
except OSError as e:
if e.errno == errno.ENOENT:
- ui.print_("command not found: {}".format(cmd[0]))
+ ui.print_(u"command not found: {}".format(cmd[0]))
sys.exit(1)
else:
raise
@@ -87,9 +86,9 @@ class BadFiles(BeetsPlugin):
# First, check whether the path exists. If not, the user
# should probably run `beet update` to cleanup your library.
dpath = displayable_path(item.path)
- self._log.debug("checking path: {}", dpath)
+ self._log.debug(u"checking path: {}", dpath)
if not os.path.exists(item.path):
- ui.print_("{}: file does not exist".format(
+ ui.print_(u"{}: file does not exist".format(
ui.colorize('text_error', dpath)))
# Run the checker against the file if one is found
@@ -102,20 +101,20 @@ class BadFiles(BeetsPlugin):
path = item.path.decode(sys.getfilesystemencoding())
status, errors, output = checker(path)
if status > 0:
- ui.print_("{}: checker exited withs status {}"
+ ui.print_(u"{}: checker exited withs status {}"
.format(ui.colorize('text_error', dpath), status))
for line in output:
ui.print_(" {}".format(displayable_path(line)))
elif errors > 0:
- ui.print_("{}: checker found {} errors or warnings"
+ ui.print_(u"{}: checker found {} errors or warnings"
.format(ui.colorize('text_warning', dpath), errors))
for line in output:
- ui.print_(" {}".format(displayable_path(line)))
+ ui.print_(u" {}".format(displayable_path(line)))
else:
- ui.print_("{}: ok".format(ui.colorize('text_success', dpath)))
+ ui.print_(u"{}: ok".format(ui.colorize('text_success', dpath)))
def commands(self):
bad_command = Subcommand('bad',
- help='check for corrupt or missing files')
+ help=u'check for corrupt or missing files')
bad_command.func = self.check_bad
return [bad_command]
diff --git a/beetsplug/bpm.py b/beetsplug/bpm.py
index e0fc7f4f8..65ebc0712 100644
--- a/beetsplug/bpm.py
+++ b/beetsplug/bpm.py
@@ -15,8 +15,7 @@
"""Determine BPM by pressing a key to the rhythm."""
-from __future__ import (division, absolute_import, print_function,
- unicode_literals)
+from __future__ import (division, absolute_import, print_function)
import time
@@ -59,8 +58,8 @@ class BPMPlugin(BeetsPlugin):
def commands(self):
cmd = ui.Subcommand('bpm',
- help='determine bpm of a song by pressing \
- a key to the rhythm')
+ help=u'determine bpm of a song by pressing '
+ u'a key to the rhythm')
cmd.func = self.command
return [cmd]
@@ -70,7 +69,7 @@ class BPMPlugin(BeetsPlugin):
def get_bpm(self, items, write=False):
overwrite = self.config['overwrite'].get(bool)
if len(items) > 1:
- raise ValueError('Can only get bpm of one song at time')
+ raise ValueError(u'Can only get bpm of one song at time')
item = items[0]
if item['bpm']: