mirror of
https://github.com/beetbox/beets.git
synced 2026-02-12 02:12:10 +01:00
Removed unicode_literals from library, logging and mediafile
This commit is contained in:
parent
4b7b96128a
commit
43572f50b0
3 changed files with 18 additions and 20 deletions
|
|
@ -15,8 +15,7 @@
|
|||
|
||||
"""The core data store and collection logic for beets.
|
||||
"""
|
||||
from __future__ import (division, absolute_import, print_function,
|
||||
unicode_literals)
|
||||
from __future__ import (division, absolute_import, print_function)
|
||||
|
||||
import os
|
||||
import sys
|
||||
|
|
@ -627,7 +626,7 @@ class Item(LibModel):
|
|||
self.write(path, tags)
|
||||
return True
|
||||
except FileOperationError as exc:
|
||||
log.error("{0}", exc)
|
||||
log.error(u"{0}", exc)
|
||||
return False
|
||||
|
||||
def try_sync(self, write, move, with_album=True):
|
||||
|
|
@ -647,7 +646,7 @@ class Item(LibModel):
|
|||
if move:
|
||||
# Check whether this file is inside the library directory.
|
||||
if self._db and self._db.directory in util.ancestry(self.path):
|
||||
log.debug('moving {0} to synchronize path',
|
||||
log.debug(u'moving {0} to synchronize path',
|
||||
util.displayable_path(self.path))
|
||||
self.move(with_album=with_album)
|
||||
self.store()
|
||||
|
|
@ -796,7 +795,7 @@ class Item(LibModel):
|
|||
if query == PF_KEY_DEFAULT:
|
||||
break
|
||||
else:
|
||||
assert False, "no default path format"
|
||||
assert False, u"no default path format"
|
||||
if isinstance(path_format, Template):
|
||||
subpath_tmpl = path_format
|
||||
else:
|
||||
|
|
@ -826,9 +825,10 @@ class Item(LibModel):
|
|||
if fellback:
|
||||
# Print an error message if legalization fell back to
|
||||
# default replacements because of the maximum length.
|
||||
log.warning('Fell back to default replacements when naming '
|
||||
'file {}. Configure replacements to avoid lengthening '
|
||||
'the filename.', subpath)
|
||||
log.warning(
|
||||
u'Fell back to default replacements when naming '
|
||||
u'file {}. Configure replacements to avoid lengthening '
|
||||
u'the filename.', subpath)
|
||||
|
||||
if fragment:
|
||||
return subpath
|
||||
|
|
@ -1016,7 +1016,7 @@ class Album(LibModel):
|
|||
"""
|
||||
item = self.items().get()
|
||||
if not item:
|
||||
raise ValueError('empty album')
|
||||
raise ValueError(u'empty album')
|
||||
return os.path.dirname(item.path)
|
||||
|
||||
def _albumtotal(self):
|
||||
|
|
@ -1170,7 +1170,7 @@ def parse_query_string(s, model_cls):
|
|||
|
||||
The string is split into components using shell-like syntax.
|
||||
"""
|
||||
assert isinstance(s, unicode), "Query is not unicode: {0!r}".format(s)
|
||||
assert isinstance(s, unicode), u"Query is not unicode: {0!r}".format(s)
|
||||
try:
|
||||
parts = util.shlex_split(s)
|
||||
except ValueError as exc:
|
||||
|
|
|
|||
|
|
@ -21,8 +21,7 @@ that when getLogger(name) instantiates a logger that logger uses
|
|||
{}-style formatting.
|
||||
"""
|
||||
|
||||
from __future__ import (division, absolute_import, print_function,
|
||||
unicode_literals)
|
||||
from __future__ import (division, absolute_import, print_function)
|
||||
|
||||
from copy import copy
|
||||
from logging import * # noqa
|
||||
|
|
|
|||
|
|
@ -33,8 +33,7 @@ Internally ``MediaFile`` uses ``MediaField`` descriptors to access the
|
|||
data from the tags. In turn ``MediaField`` uses a number of
|
||||
``StorageStyle`` strategies to handle format specific logic.
|
||||
"""
|
||||
from __future__ import (division, absolute_import, print_function,
|
||||
unicode_literals)
|
||||
from __future__ import (division, absolute_import, print_function)
|
||||
|
||||
import mutagen
|
||||
import mutagen.mp3
|
||||
|
|
@ -645,13 +644,13 @@ class MP4BoolStorageStyle(MP4StorageStyle):
|
|||
return None
|
||||
|
||||
def get_list(self, mutagen_file):
|
||||
raise NotImplementedError('MP4 bool storage does not support lists')
|
||||
raise NotImplementedError(u'MP4 bool storage does not support lists')
|
||||
|
||||
def set(self, mutagen_file, value):
|
||||
mutagen_file[self.key] = value
|
||||
|
||||
def set_list(self, mutagen_file, values):
|
||||
raise NotImplementedError('MP4 bool storage does not support lists')
|
||||
raise NotImplementedError(u'MP4 bool storage does not support lists')
|
||||
|
||||
|
||||
class MP4ImageStorageStyle(MP4ListStorageStyle):
|
||||
|
|
@ -669,7 +668,7 @@ class MP4ImageStorageStyle(MP4ListStorageStyle):
|
|||
elif image.mime_type == 'image/jpeg':
|
||||
kind = mutagen.mp4.MP4Cover.FORMAT_JPEG
|
||||
else:
|
||||
raise ValueError('MP4 files only supports PNG and JPEG images')
|
||||
raise ValueError(u'MP4 files only supports PNG and JPEG images')
|
||||
return mutagen.mp4.MP4Cover(image.data, kind)
|
||||
|
||||
|
||||
|
|
@ -1359,11 +1358,11 @@ class MediaFile(object):
|
|||
# anywhere else.
|
||||
raise
|
||||
else:
|
||||
log.debug('{}', traceback.format_exc())
|
||||
log.debug(u'{}', traceback.format_exc())
|
||||
raise MutagenError(path, exc)
|
||||
except Exception as exc:
|
||||
# Isolate bugs in Mutagen.
|
||||
log.debug('{}', traceback.format_exc())
|
||||
log.debug(u'{}', traceback.format_exc())
|
||||
log.error(u'uncaught Mutagen exception in open: {0}', exc)
|
||||
raise MutagenError(path, exc)
|
||||
|
||||
|
|
@ -1436,7 +1435,7 @@ class MediaFile(object):
|
|||
# Propagate these through: they don't represent Mutagen bugs.
|
||||
raise
|
||||
except Exception as exc:
|
||||
log.debug('{}', traceback.format_exc())
|
||||
log.debug(u'{}', traceback.format_exc())
|
||||
log.error(u'uncaught Mutagen exception in save: {0}', exc)
|
||||
raise MutagenError(self.path, exc)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue