mirror of
https://github.com/beetbox/beets.git
synced 2026-02-25 00:32:50 +01:00
All plugins use unicode_literals
Given that part of them has no test I may have broke them
This commit is contained in:
parent
53c21330c2
commit
a5026100a3
41 changed files with 92 additions and 52 deletions
|
|
@ -15,7 +15,7 @@
|
|||
"""A namespace package for beets plugins."""
|
||||
|
||||
# Make this a namespace package.
|
||||
from __future__ import division, absolute_import, print_function
|
||||
from __future__ import absolute_import
|
||||
|
||||
from pkgutil import extend_path
|
||||
__path__ = extend_path(__path__, __name__)
|
||||
|
|
|
|||
|
|
@ -17,7 +17,8 @@ Beets library. Attempts to implement a compatible protocol to allow
|
|||
use of the wide range of MPD clients.
|
||||
"""
|
||||
|
||||
from __future__ import division, absolute_import, print_function
|
||||
from __future__ import (division, absolute_import, print_function,
|
||||
unicode_literals)
|
||||
|
||||
import re
|
||||
from string import Template
|
||||
|
|
|
|||
|
|
@ -16,7 +16,8 @@
|
|||
music player.
|
||||
"""
|
||||
|
||||
from __future__ import division, absolute_import, print_function
|
||||
from __future__ import (division, absolute_import, print_function,
|
||||
unicode_literals)
|
||||
|
||||
import sys
|
||||
import time
|
||||
|
|
|
|||
|
|
@ -14,7 +14,8 @@
|
|||
|
||||
"""Determine BPM by pressing a key to the rhythm."""
|
||||
|
||||
from __future__ import division, absolute_import, print_function
|
||||
from __future__ import (division, absolute_import, print_function,
|
||||
unicode_literals)
|
||||
|
||||
import time
|
||||
|
||||
|
|
|
|||
|
|
@ -15,7 +15,8 @@
|
|||
"""Provides the %bucket{} function for path formatting.
|
||||
"""
|
||||
|
||||
from __future__ import division, absolute_import, print_function
|
||||
from __future__ import (division, absolute_import, print_function,
|
||||
unicode_literals)
|
||||
|
||||
from datetime import datetime
|
||||
import re
|
||||
|
|
|
|||
|
|
@ -15,7 +15,8 @@
|
|||
"""Adds Chromaprint/Acoustid acoustic fingerprinting support to the
|
||||
autotagger. Requires the pyacoustid library.
|
||||
"""
|
||||
from __future__ import division, absolute_import, print_function
|
||||
from __future__ import (division, absolute_import, print_function,
|
||||
unicode_literals)
|
||||
|
||||
from beets import plugins
|
||||
from beets import ui
|
||||
|
|
|
|||
|
|
@ -14,7 +14,8 @@
|
|||
|
||||
"""Converts tracks or albums to external directory
|
||||
"""
|
||||
from __future__ import division, absolute_import, print_function
|
||||
from __future__ import (division, absolute_import, print_function,
|
||||
unicode_literals)
|
||||
|
||||
import os
|
||||
import threading
|
||||
|
|
@ -45,7 +46,7 @@ def replace_ext(path, ext):
|
|||
|
||||
The new extension must not contain a leading dot.
|
||||
"""
|
||||
return os.path.splitext(path)[0] + '.' + ext
|
||||
return os.path.splitext(path)[0] + b'.' + ext
|
||||
|
||||
|
||||
def get_format(format=None):
|
||||
|
|
@ -177,8 +178,8 @@ class ConvertPlugin(BeetsPlugin):
|
|||
args = shlex.split(command)
|
||||
for i, arg in enumerate(args):
|
||||
args[i] = Template(arg).safe_substitute({
|
||||
'source': source,
|
||||
'dest': dest,
|
||||
'source': source.decode('utf8'),
|
||||
'dest': dest.decode('utf8'),
|
||||
})
|
||||
|
||||
if pretend:
|
||||
|
|
|
|||
|
|
@ -15,7 +15,8 @@
|
|||
"""Adds Discogs album search support to the autotagger. Requires the
|
||||
discogs-client library.
|
||||
"""
|
||||
from __future__ import division, absolute_import, print_function
|
||||
from __future__ import (division, absolute_import, print_function,
|
||||
unicode_literals)
|
||||
|
||||
import beets.ui
|
||||
from beets import logging
|
||||
|
|
|
|||
|
|
@ -14,7 +14,8 @@
|
|||
|
||||
"""List duplicate tracks or albums.
|
||||
"""
|
||||
from __future__ import division, absolute_import, print_function
|
||||
from __future__ import (division, absolute_import, print_function,
|
||||
unicode_literals)
|
||||
|
||||
import shlex
|
||||
|
||||
|
|
|
|||
|
|
@ -14,7 +14,8 @@
|
|||
|
||||
"""Fetch a variety of acoustic metrics from The Echo Nest.
|
||||
"""
|
||||
from __future__ import division, absolute_import, print_function
|
||||
from __future__ import (division, absolute_import, print_function,
|
||||
unicode_literals)
|
||||
|
||||
import time
|
||||
import socket
|
||||
|
|
|
|||
|
|
@ -13,7 +13,8 @@
|
|||
# included in all copies or substantial portions of the Software.
|
||||
|
||||
"""Allows beets to embed album art into file metadata."""
|
||||
from __future__ import division, absolute_import, print_function
|
||||
from __future__ import (division, absolute_import, print_function,
|
||||
unicode_literals)
|
||||
|
||||
import os.path
|
||||
import imghdr
|
||||
|
|
|
|||
|
|
@ -14,7 +14,8 @@
|
|||
|
||||
"""Fetches album art.
|
||||
"""
|
||||
from __future__ import division, absolute_import, print_function
|
||||
from __future__ import (division, absolute_import, print_function,
|
||||
unicode_literals)
|
||||
|
||||
from contextlib import closing
|
||||
import os
|
||||
|
|
@ -182,14 +183,14 @@ class FileSystem(ArtSource):
|
|||
images = []
|
||||
for fn in os.listdir(path):
|
||||
for ext in IMAGE_EXTENSIONS:
|
||||
if fn.lower().endswith('.' + ext) and \
|
||||
if fn.lower().endswith(b'.' + ext.encode('utf8')) and \
|
||||
os.path.isfile(os.path.join(path, fn)):
|
||||
images.append(fn)
|
||||
|
||||
# Look for "preferred" filenames.
|
||||
images = sorted(images,
|
||||
key=lambda x: self.filename_priority(x, cover_names))
|
||||
cover_pat = r"(\b|_)({0})(\b|_)".format('|'.join(cover_names))
|
||||
cover_pat = br"(\b|_)({0})(\b|_)".format(b'|'.join(cover_names))
|
||||
for fn in images:
|
||||
if re.search(cover_pat, os.path.splitext(fn)[0], re.I):
|
||||
self._log.debug(u'using well-named art file {0}',
|
||||
|
|
|
|||
|
|
@ -15,7 +15,8 @@
|
|||
"""Creates freedesktop.org-compliant .directory files on an album level.
|
||||
"""
|
||||
|
||||
from __future__ import division, absolute_import, print_function
|
||||
from __future__ import (division, absolute_import, print_function,
|
||||
unicode_literals)
|
||||
|
||||
from beets.plugins import BeetsPlugin
|
||||
from beets.ui import Subcommand
|
||||
|
|
|
|||
|
|
@ -15,7 +15,8 @@
|
|||
"""If the title is empty, try to extract track and title from the
|
||||
filename.
|
||||
"""
|
||||
from __future__ import division, absolute_import, print_function
|
||||
from __future__ import (division, absolute_import, print_function,
|
||||
unicode_literals)
|
||||
|
||||
from beets import plugins
|
||||
from beets.util import displayable_path
|
||||
|
|
|
|||
|
|
@ -14,7 +14,8 @@
|
|||
|
||||
"""Moves "featured" artists to the title from the artist field.
|
||||
"""
|
||||
from __future__ import division, absolute_import, print_function
|
||||
from __future__ import (division, absolute_import, print_function,
|
||||
unicode_literals)
|
||||
|
||||
import re
|
||||
|
||||
|
|
|
|||
|
|
@ -15,7 +15,8 @@
|
|||
"""Provides a fuzzy matching query.
|
||||
"""
|
||||
|
||||
from __future__ import division, absolute_import, print_function
|
||||
from __future__ import (division, absolute_import, print_function,
|
||||
unicode_literals)
|
||||
|
||||
from beets.plugins import BeetsPlugin
|
||||
from beets.dbcore.query import StringFieldQuery
|
||||
|
|
|
|||
|
|
@ -12,7 +12,8 @@
|
|||
# The above copyright notice and this permission notice shall be
|
||||
# included in all copies or substantial portions of the Software.
|
||||
|
||||
from __future__ import division, absolute_import, print_function
|
||||
from __future__ import (division, absolute_import, print_function,
|
||||
unicode_literals)
|
||||
|
||||
"""Warns you about things you hate (or even blocks import)."""
|
||||
|
||||
|
|
|
|||
|
|
@ -12,7 +12,8 @@
|
|||
# The above copyright notice and this permission notice shall be
|
||||
# included in all copies or substantial portions of the Software.
|
||||
|
||||
from __future__ import division, absolute_import, print_function
|
||||
from __future__ import (division, absolute_import, print_function,
|
||||
unicode_literals)
|
||||
|
||||
"""Write paths of imported files in various formats to ease later import in a
|
||||
music player. Also allow printing the new file locations to stdout in case
|
||||
|
|
|
|||
|
|
@ -15,7 +15,8 @@
|
|||
"""Shows file metadata.
|
||||
"""
|
||||
|
||||
from __future__ import division, absolute_import, print_function
|
||||
from __future__ import (division, absolute_import, print_function,
|
||||
unicode_literals)
|
||||
|
||||
import os
|
||||
|
||||
|
|
|
|||
|
|
@ -14,7 +14,8 @@
|
|||
|
||||
"""Allows inline path template customization code in the config file.
|
||||
"""
|
||||
from __future__ import division, absolute_import, print_function
|
||||
from __future__ import (division, absolute_import, print_function,
|
||||
unicode_literals)
|
||||
|
||||
import traceback
|
||||
import itertools
|
||||
|
|
|
|||
|
|
@ -15,7 +15,8 @@
|
|||
"""Uses the `KeyFinder` program to add the `initial_key` field.
|
||||
"""
|
||||
|
||||
from __future__ import division, absolute_import, print_function
|
||||
from __future__ import (division, absolute_import, print_function,
|
||||
unicode_literals)
|
||||
|
||||
import subprocess
|
||||
|
||||
|
|
|
|||
|
|
@ -12,7 +12,8 @@
|
|||
# The above copyright notice and this permission notice shall be
|
||||
# included in all copies or substantial portions of the Software.
|
||||
|
||||
from __future__ import division, absolute_import, print_function
|
||||
from __future__ import (division, absolute_import, print_function,
|
||||
unicode_literals)
|
||||
|
||||
"""Gets genres for imported music based on Last.fm tags.
|
||||
|
||||
|
|
|
|||
|
|
@ -12,7 +12,8 @@
|
|||
# The above copyright notice and this permission notice shall be
|
||||
# included in all copies or substantial portions of the Software.
|
||||
|
||||
from __future__ import division, absolute_import, print_function
|
||||
from __future__ import (division, absolute_import, print_function,
|
||||
unicode_literals)
|
||||
|
||||
import requests
|
||||
from beets import ui
|
||||
|
|
|
|||
|
|
@ -12,7 +12,8 @@
|
|||
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
from __future__ import division, absolute_import, print_function
|
||||
from __future__ import (division, absolute_import, print_function,
|
||||
unicode_literals)
|
||||
|
||||
from beets.plugins import BeetsPlugin
|
||||
from beets.ui import Subcommand
|
||||
|
|
|
|||
|
|
@ -14,7 +14,8 @@
|
|||
|
||||
"""Update library's tags using MusicBrainz.
|
||||
"""
|
||||
from __future__ import division, absolute_import, print_function
|
||||
from __future__ import (division, absolute_import, print_function,
|
||||
unicode_literals)
|
||||
|
||||
from beets.plugins import BeetsPlugin
|
||||
from beets import autotag, library, ui, util
|
||||
|
|
|
|||
|
|
@ -14,7 +14,8 @@
|
|||
|
||||
"""List missing tracks.
|
||||
"""
|
||||
from __future__ import division, absolute_import, print_function
|
||||
from __future__ import (division, absolute_import, print_function,
|
||||
unicode_literals)
|
||||
|
||||
from beets.autotag import hooks
|
||||
from beets.library import Item
|
||||
|
|
|
|||
|
|
@ -13,7 +13,8 @@
|
|||
# The above copyright notice and this permission notice shall be
|
||||
# included in all copies or substantial portions of the Software.
|
||||
|
||||
from __future__ import division, absolute_import, print_function
|
||||
from __future__ import (division, absolute_import, print_function,
|
||||
unicode_literals)
|
||||
|
||||
import mpd
|
||||
import socket
|
||||
|
|
|
|||
|
|
@ -20,7 +20,8 @@ Put something like the following in your config.yaml to configure:
|
|||
port: 6600
|
||||
password: seekrit
|
||||
"""
|
||||
from __future__ import division, absolute_import, print_function
|
||||
from __future__ import (division, absolute_import, print_function,
|
||||
unicode_literals)
|
||||
|
||||
from beets.plugins import BeetsPlugin
|
||||
import os
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
from __future__ import division, absolute_import, print_function
|
||||
from __future__ import (division, absolute_import, print_function,
|
||||
unicode_literals)
|
||||
|
||||
"""Fixes file permissions after the file gets written on import. Put something
|
||||
like the following in your config.yaml to configure:
|
||||
|
|
|
|||
|
|
@ -14,7 +14,8 @@
|
|||
|
||||
"""Send the results of a query to the configured music player as a playlist.
|
||||
"""
|
||||
from __future__ import division, absolute_import, print_function
|
||||
from __future__ import (division, absolute_import, print_function,
|
||||
unicode_literals)
|
||||
|
||||
from functools import partial
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,8 @@ Put something like the following in your config.yaml to configure:
|
|||
host: localhost
|
||||
port: 32400
|
||||
"""
|
||||
from __future__ import division, absolute_import, print_function
|
||||
from __future__ import (division, absolute_import, print_function,
|
||||
unicode_literals)
|
||||
|
||||
import requests
|
||||
from urlparse import urljoin
|
||||
|
|
|
|||
|
|
@ -14,7 +14,8 @@
|
|||
|
||||
"""Get a random song or album from the library.
|
||||
"""
|
||||
from __future__ import division, absolute_import, print_function
|
||||
from __future__ import (division, absolute_import, print_function,
|
||||
unicode_literals)
|
||||
|
||||
from beets.plugins import BeetsPlugin
|
||||
from beets.ui import Subcommand, decargs, print_obj
|
||||
|
|
|
|||
|
|
@ -12,7 +12,8 @@
|
|||
# The above copyright notice and this permission notice shall be
|
||||
# included in all copies or substantial portions of the Software.
|
||||
|
||||
from __future__ import division, absolute_import, print_function
|
||||
from __future__ import (division, absolute_import, print_function,
|
||||
unicode_literals)
|
||||
|
||||
import subprocess
|
||||
import os
|
||||
|
|
@ -197,9 +198,9 @@ class CommandBackend(Backend):
|
|||
containing information about each analyzed file.
|
||||
"""
|
||||
out = []
|
||||
for line in text.split('\n')[1:num_lines + 1]:
|
||||
parts = line.split('\t')
|
||||
if len(parts) != 6 or parts[0] == 'File':
|
||||
for line in text.split(b'\n')[1:num_lines + 1]:
|
||||
parts = line.split(b'\t')
|
||||
if len(parts) != 6 or parts[0] == b'File':
|
||||
self._log.debug(u'bad tool output: {0}', text)
|
||||
raise ReplayGainError('mp3gain failed')
|
||||
d = {
|
||||
|
|
|
|||
|
|
@ -15,7 +15,8 @@
|
|||
"""Uses user-specified rewriting rules to canonicalize names for path
|
||||
formats.
|
||||
"""
|
||||
from __future__ import division, absolute_import, print_function
|
||||
from __future__ import (division, absolute_import, print_function,
|
||||
unicode_literals)
|
||||
|
||||
import re
|
||||
from collections import defaultdict
|
||||
|
|
|
|||
|
|
@ -16,7 +16,8 @@
|
|||
automatically whenever tags are written.
|
||||
"""
|
||||
|
||||
from __future__ import division, absolute_import, print_function
|
||||
from __future__ import (division, absolute_import, print_function,
|
||||
unicode_literals)
|
||||
|
||||
from beets.plugins import BeetsPlugin
|
||||
from beets import ui
|
||||
|
|
|
|||
|
|
@ -15,7 +15,8 @@
|
|||
"""Generates smart playlists based on beets queries.
|
||||
"""
|
||||
|
||||
from __future__ import division, absolute_import, print_function
|
||||
from __future__ import (division, absolute_import, print_function,
|
||||
unicode_literals)
|
||||
|
||||
from beets.plugins import BeetsPlugin
|
||||
from beets import ui
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
from __future__ import division, absolute_import, print_function
|
||||
from __future__ import (division, absolute_import, print_function,
|
||||
unicode_literals)
|
||||
|
||||
import re
|
||||
import webbrowser
|
||||
|
|
|
|||
|
|
@ -14,7 +14,8 @@
|
|||
|
||||
"""Moves patterns in path formats (suitable for moving articles)."""
|
||||
|
||||
from __future__ import division, absolute_import, print_function
|
||||
from __future__ import (division, absolute_import, print_function,
|
||||
unicode_literals)
|
||||
|
||||
import re
|
||||
from beets.plugins import BeetsPlugin
|
||||
|
|
|
|||
|
|
@ -12,7 +12,8 @@
|
|||
# The above copyright notice and this permission notice shall be
|
||||
# included in all copies or substantial portions of the Software.
|
||||
|
||||
from __future__ import division, absolute_import, print_function
|
||||
from __future__ import (division, absolute_import, print_function,
|
||||
unicode_literals)
|
||||
|
||||
from beets.plugins import BeetsPlugin
|
||||
from beets.dbcore import types
|
||||
|
|
|
|||
|
|
@ -13,7 +13,8 @@
|
|||
# included in all copies or substantial portions of the Software.
|
||||
|
||||
"""A Web interface to beets."""
|
||||
from __future__ import division, absolute_import, print_function
|
||||
from __future__ import (division, absolute_import, print_function,
|
||||
unicode_literals)
|
||||
|
||||
from beets.plugins import BeetsPlugin
|
||||
from beets import ui
|
||||
|
|
@ -89,7 +90,7 @@ def resource(name):
|
|||
)
|
||||
else:
|
||||
return flask.abort(404)
|
||||
responder.__name__ = 'get_%s' % name
|
||||
responder.__name__ = b'get_%s' % name.encode('utf8')
|
||||
return responder
|
||||
return make_responder
|
||||
|
||||
|
|
@ -103,7 +104,7 @@ def resource_query(name):
|
|||
json_generator(query_func(queries), root='results'),
|
||||
mimetype='application/json'
|
||||
)
|
||||
responder.__name__ = 'query_%s' % name
|
||||
responder.__name__ = b'query_%s' % name.encode('utf8')
|
||||
return responder
|
||||
return make_responder
|
||||
|
||||
|
|
@ -118,7 +119,7 @@ def resource_list(name):
|
|||
json_generator(list_all(), root=name),
|
||||
mimetype='application/json'
|
||||
)
|
||||
responder.__name__ = 'all_%s' % name
|
||||
responder.__name__ = b'all_%s' % name.encode('utf8')
|
||||
return responder
|
||||
return make_responder
|
||||
|
||||
|
|
|
|||
|
|
@ -14,7 +14,8 @@
|
|||
|
||||
""" Clears tag fields in media files."""
|
||||
|
||||
from __future__ import division, absolute_import, print_function
|
||||
from __future__ import (division, absolute_import, print_function,
|
||||
unicode_literals)
|
||||
|
||||
import re
|
||||
from beets.plugins import BeetsPlugin
|
||||
|
|
|
|||
Loading…
Reference in a new issue