mirror of
https://github.com/beetbox/beets.git
synced 2025-12-06 08:39:17 +01:00
replace deprecated log.warn() with log.warning()
This commit is contained in:
parent
5abbd3e590
commit
fcbfce3984
14 changed files with 55 additions and 53 deletions
|
|
@ -362,8 +362,8 @@ class ImportSession(object):
|
|||
# Either accept immediately or prompt for input to decide.
|
||||
if self.want_resume is True or \
|
||||
self.should_resume(toppath):
|
||||
log.warn(u'Resuming interrupted import of {0}',
|
||||
util.displayable_path(toppath))
|
||||
log.warning(u'Resuming interrupted import of {0}',
|
||||
util.displayable_path(toppath))
|
||||
self._is_resuming[toppath] = True
|
||||
else:
|
||||
# Clear progress; we're starting from the top.
|
||||
|
|
@ -1148,8 +1148,8 @@ class ImportTaskFactory(object):
|
|||
|
||||
if not (self.session.config['move'] or
|
||||
self.session.config['copy']):
|
||||
log.warn(u"Archive importing requires either "
|
||||
u"'copy' or 'move' to be enabled.")
|
||||
log.warning(u"Archive importing requires either "
|
||||
u"'copy' or 'move' to be enabled.")
|
||||
return
|
||||
|
||||
log.debug(u'Extracting archive: {0}',
|
||||
|
|
@ -1179,7 +1179,7 @@ class ImportTaskFactory(object):
|
|||
# Silently ignore non-music files.
|
||||
pass
|
||||
elif isinstance(exc.reason, mediafile.UnreadableFileError):
|
||||
log.warn(u'unreadable file: {0}', displayable_path(path))
|
||||
log.warning(u'unreadable file: {0}', displayable_path(path))
|
||||
else:
|
||||
log.error(u'error reading {0}: {1}',
|
||||
displayable_path(path), exc)
|
||||
|
|
@ -1204,8 +1204,8 @@ def read_tasks(session):
|
|||
skipped += task_factory.skipped
|
||||
|
||||
if not task_factory.imported:
|
||||
log.warn(u'No files imported from {0}',
|
||||
displayable_path(toppath))
|
||||
log.warning(u'No files imported from {0}',
|
||||
displayable_path(toppath))
|
||||
|
||||
# Show skipped directories (due to incremental/resume).
|
||||
if skipped:
|
||||
|
|
|
|||
|
|
@ -255,7 +255,7 @@ def load_plugins(names=()):
|
|||
except ImportError as exc:
|
||||
# Again, this is hacky:
|
||||
if exc.args[0].endswith(' ' + name):
|
||||
log.warn(u'** plugin {0} not found', name)
|
||||
log.warning(u'** plugin {0} not found', name)
|
||||
else:
|
||||
raise
|
||||
else:
|
||||
|
|
@ -265,7 +265,7 @@ def load_plugins(names=()):
|
|||
_classes.add(obj)
|
||||
|
||||
except:
|
||||
log.warn(
|
||||
log.warning(
|
||||
u'** error loading plugin {}:\n{}',
|
||||
name,
|
||||
traceback.format_exc(),
|
||||
|
|
|
|||
|
|
@ -823,8 +823,8 @@ class TerminalImportSession(importer.ImportSession):
|
|||
"""Decide what to do when a new album or item seems similar to one
|
||||
that's already in the library.
|
||||
"""
|
||||
log.warn(u"This {0} is already in the library!",
|
||||
(u"album" if task.is_album else u"item"))
|
||||
log.warning(u"This {0} is already in the library!",
|
||||
(u"album" if task.is_album else u"item"))
|
||||
|
||||
if config['import']['quiet']:
|
||||
# In quiet mode, don't prompt -- just skip.
|
||||
|
|
@ -902,9 +902,9 @@ class TerminalImportSession(importer.ImportSession):
|
|||
# Keep the first of the choices, removing the rest.
|
||||
dup_choices = [c for c in all_choices if c.short == short]
|
||||
for c in dup_choices[1:]:
|
||||
log.warn(u"Prompt choice '{0}' removed due to conflict "
|
||||
u"with '{1}' (short letter: '{2}')",
|
||||
c.long, dup_choices[0].long, c.short)
|
||||
log.warning(u"Prompt choice '{0}' removed due to conflict "
|
||||
u"with '{1}' (short letter: '{2}')",
|
||||
c.long, dup_choices[0].long, c.short)
|
||||
extra_choices.remove(c)
|
||||
return extra_choices
|
||||
|
||||
|
|
@ -1667,8 +1667,8 @@ def print_completion(*args):
|
|||
for line in completion_script(default_commands + plugins.commands()):
|
||||
print_(line, end=u'')
|
||||
if not any(map(os.path.isfile, BASH_COMPLETION_PATHS)):
|
||||
log.warn(u'Warning: Unable to find the bash-completion package. '
|
||||
u'Command line completion might not work.')
|
||||
log.warning(u'Warning: Unable to find the bash-completion package. '
|
||||
u'Command line completion might not work.')
|
||||
|
||||
BASH_COMPLETION_PATHS = map(syspath, [
|
||||
u'/etc/bash_completion',
|
||||
|
|
|
|||
|
|
@ -169,7 +169,7 @@ def sorted_walk(path, ignore=(), ignore_hidden=False, logger=None):
|
|||
contents = os.listdir(syspath(path))
|
||||
except OSError as exc:
|
||||
if logger:
|
||||
logger.warn(u'could not list directory {0}: {1}'.format(
|
||||
logger.warning(u'could not list directory {0}: {1}'.format(
|
||||
displayable_path(path), exc.strerror
|
||||
))
|
||||
return
|
||||
|
|
|
|||
|
|
@ -96,8 +96,8 @@ def im_resize(maxwidth, path_in, path_out=None):
|
|||
util.syspath(path_out, prefix=False),
|
||||
])
|
||||
except subprocess.CalledProcessError:
|
||||
log.warn(u'artresizer: IM convert failed for {0}',
|
||||
util.displayable_path(path_in))
|
||||
log.warning(u'artresizer: IM convert failed for {0}',
|
||||
util.displayable_path(path_in))
|
||||
return path_in
|
||||
return path_out
|
||||
|
||||
|
|
@ -124,7 +124,7 @@ def im_getsize(path_in):
|
|||
try:
|
||||
out = util.command_output(cmd)
|
||||
except subprocess.CalledProcessError as exc:
|
||||
log.warn(u'ImageMagick size query failed')
|
||||
log.warning(u'ImageMagick size query failed')
|
||||
log.debug(
|
||||
u'`convert` exited with (status {}) when '
|
||||
u'getting size with command {}:\n{}',
|
||||
|
|
@ -134,7 +134,7 @@ def im_getsize(path_in):
|
|||
try:
|
||||
return tuple(map(int, out.split(b' ')))
|
||||
except IndexError:
|
||||
log.warn(u'Could not understand IM output: {0!r}', out)
|
||||
log.warning(u'Could not understand IM output: {0!r}', out)
|
||||
|
||||
|
||||
BACKEND_GET_SIZE = {
|
||||
|
|
|
|||
|
|
@ -236,7 +236,7 @@ def submit_items(log, userkey, items, chunksize=64):
|
|||
try:
|
||||
acoustid.submit(API_KEY, userkey, data)
|
||||
except acoustid.AcoustidError as exc:
|
||||
log.warn(u'acoustid submission error: {0}', exc)
|
||||
log.warning(u'acoustid submission error: {0}', exc)
|
||||
del data[:]
|
||||
|
||||
for item in items:
|
||||
|
|
|
|||
|
|
@ -319,8 +319,8 @@ class EditPlugin(plugins.BeetsPlugin):
|
|||
are temporary.
|
||||
"""
|
||||
if len(old_data) != len(new_data):
|
||||
self._log.warn(u'number of objects changed from {} to {}',
|
||||
len(old_data), len(new_data))
|
||||
self._log.warning(u'number of objects changed from {} to {}',
|
||||
len(old_data), len(new_data))
|
||||
|
||||
obj_by_id = {o.id: o for o in objs}
|
||||
ignore_fields = self.config['ignore_fields'].as_str_seq()
|
||||
|
|
@ -330,7 +330,7 @@ class EditPlugin(plugins.BeetsPlugin):
|
|||
forbidden = False
|
||||
for key in ignore_fields:
|
||||
if old_dict.get(key) != new_dict.get(key):
|
||||
self._log.warn(u'ignoring object whose {} changed', key)
|
||||
self._log.warning(u'ignoring object whose {} changed', key)
|
||||
forbidden = True
|
||||
break
|
||||
if forbidden:
|
||||
|
|
|
|||
|
|
@ -265,10 +265,10 @@ class RemoteArtSource(ArtSource):
|
|||
ext = b'.' + CONTENT_TYPES[real_ct][0]
|
||||
|
||||
if real_ct != ct:
|
||||
self._log.warn(u'Server specified {}, but returned a '
|
||||
u'{} image. Correcting the extension '
|
||||
u'to {}',
|
||||
ct, real_ct, ext)
|
||||
self._log.warning(u'Server specified {}, but returned a '
|
||||
u'{} image. Correcting the extension '
|
||||
u'to {}',
|
||||
ct, real_ct, ext)
|
||||
|
||||
suffix = py3_path(ext)
|
||||
with NamedTemporaryFile(suffix=suffix, delete=False) as fh:
|
||||
|
|
|
|||
|
|
@ -624,9 +624,9 @@ class LyricsPlugin(plugins.BeetsPlugin):
|
|||
u'no API key configured.')
|
||||
sources.remove('google')
|
||||
elif not HAS_BEAUTIFUL_SOUP:
|
||||
self._log.warn(u'To use the google lyrics source, you must '
|
||||
u'install the beautifulsoup4 module. See the '
|
||||
u'documentation for further details.')
|
||||
self._log.warning(u'To use the google lyrics source, you must '
|
||||
u'install the beautifulsoup4 module. See '
|
||||
u'the documentation for further details.')
|
||||
sources.remove('google')
|
||||
|
||||
self.config['bing_lang_from'] = [
|
||||
|
|
@ -634,9 +634,9 @@ class LyricsPlugin(plugins.BeetsPlugin):
|
|||
self.bing_auth_token = None
|
||||
|
||||
if not HAS_LANGDETECT and self.config['bing_client_secret'].get():
|
||||
self._log.warn(u'To use bing translations, you need to '
|
||||
u'install the langdetect module. See the '
|
||||
u'documentation for further details.')
|
||||
self._log.warning(u'To use bing translations, you need to '
|
||||
u'install the langdetect module. See the '
|
||||
u'documentation for further details.')
|
||||
|
||||
self.backends = [self.SOURCE_BACKENDS[source](self.config, self._log)
|
||||
for source in sources]
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ def assert_permissions(path, permission, log):
|
|||
`check_permissions`.
|
||||
"""
|
||||
if not check_permissions(util.syspath(path), permission):
|
||||
log.warn(
|
||||
log.warning(
|
||||
u'could not set permissions on {}',
|
||||
util.displayable_path(path),
|
||||
)
|
||||
|
|
|
|||
|
|
@ -98,7 +98,7 @@ class SmartPlaylistPlugin(BeetsPlugin):
|
|||
|
||||
for playlist in self.config['playlists'].get(list):
|
||||
if 'name' not in playlist:
|
||||
self._log.warn(u"playlist configuration is missing name")
|
||||
self._log.warning(u"playlist configuration is missing name")
|
||||
continue
|
||||
|
||||
playlist_data = (playlist['name'],)
|
||||
|
|
@ -134,8 +134,8 @@ class SmartPlaylistPlugin(BeetsPlugin):
|
|||
playlist_data += (query_and_sort,)
|
||||
|
||||
except ParsingError as exc:
|
||||
self._log.warn(u"invalid query in playlist {}: {}",
|
||||
playlist['name'], exc)
|
||||
self._log.warning(u"invalid query in playlist {}: {}",
|
||||
playlist['name'], exc)
|
||||
continue
|
||||
|
||||
self._unmatched_playlists.add(playlist_data)
|
||||
|
|
|
|||
|
|
@ -63,8 +63,8 @@ class SpotifyPlugin(BeetsPlugin):
|
|||
self.config['show_failures'].set(True)
|
||||
|
||||
if self.config['mode'].get() not in ['list', 'open']:
|
||||
self._log.warn(u'{0} is not a valid mode',
|
||||
self.config['mode'].get())
|
||||
self._log.warning(u'{0} is not a valid mode',
|
||||
self.config['mode'].get())
|
||||
return False
|
||||
|
||||
self.opts = opts
|
||||
|
|
@ -154,9 +154,9 @@ class SpotifyPlugin(BeetsPlugin):
|
|||
self._log.info(u'track: {0}', track)
|
||||
self._log.info(u'')
|
||||
else:
|
||||
self._log.warn(u'{0} track(s) did not match a Spotify ID;\n'
|
||||
u'use --show-failures to display',
|
||||
failure_count)
|
||||
self._log.warning(u'{0} track(s) did not match a Spotify ID;\n'
|
||||
u'use --show-failures to display',
|
||||
failure_count)
|
||||
|
||||
return results
|
||||
|
||||
|
|
@ -172,4 +172,4 @@ class SpotifyPlugin(BeetsPlugin):
|
|||
for item in ids:
|
||||
print(self.open_url + item)
|
||||
else:
|
||||
self._log.warn(u'No Spotify tracks found from beets query')
|
||||
self._log.warning(u'No Spotify tracks found from beets query')
|
||||
|
|
|
|||
|
|
@ -54,14 +54,14 @@ class ThePlugin(BeetsPlugin):
|
|||
self._log.error(u'invalid pattern: {0}', p)
|
||||
else:
|
||||
if not (p.startswith('^') or p.endswith('$')):
|
||||
self._log.warn(u'warning: \"{0}\" will not '
|
||||
u'match string start/end', p)
|
||||
self._log.warning(u'warning: \"{0}\" will not '
|
||||
u'match string start/end', p)
|
||||
if self.config['a']:
|
||||
self.patterns = [PATTERN_A] + self.patterns
|
||||
if self.config['the']:
|
||||
self.patterns = [PATTERN_THE] + self.patterns
|
||||
if not self.patterns:
|
||||
self._log.warn(u'no patterns defined!')
|
||||
self._log.warning(u'no patterns defined!')
|
||||
|
||||
def unthe(self, text, pattern):
|
||||
"""Moves pattern in the path format string or strips it
|
||||
|
|
|
|||
|
|
@ -51,7 +51,9 @@ class ZeroPlugin(BeetsPlugin):
|
|||
|
||||
# We'll only handle `fields` or `keep_fields`, but not both.
|
||||
if self.config['fields'] and self.config['keep_fields']:
|
||||
self._log.warn(u'cannot blacklist and whitelist at the same time')
|
||||
self._log.warning(
|
||||
u'cannot blacklist and whitelist at the same time'
|
||||
)
|
||||
|
||||
# Blacklist mode.
|
||||
if self.config['fields']:
|
||||
|
|
@ -84,8 +86,8 @@ class ZeroPlugin(BeetsPlugin):
|
|||
self._log.error(u'invalid field: {0}', field)
|
||||
continue
|
||||
if mode == 'fields' and field in ('id', 'path', 'album_id'):
|
||||
self._log.warn(u'field \'{0}\' ignored, zeroing '
|
||||
u'it would be dangerous', field)
|
||||
self._log.warning(u'field \'{0}\' ignored, zeroing '
|
||||
u'it would be dangerous', field)
|
||||
continue
|
||||
|
||||
def set_pattern(self, field):
|
||||
|
|
@ -102,7 +104,7 @@ class ZeroPlugin(BeetsPlugin):
|
|||
def import_task_choice_event(self, session, task):
|
||||
"""Listen for import_task_choice event."""
|
||||
if task.choice_flag == action.ASIS and not self.warned:
|
||||
self._log.warn(u'cannot zero in \"as-is\" mode')
|
||||
self._log.warning(u'cannot zero in \"as-is\" mode')
|
||||
self.warned = True
|
||||
# TODO request write in as-is mode
|
||||
|
||||
|
|
@ -123,7 +125,7 @@ class ZeroPlugin(BeetsPlugin):
|
|||
by `self.patterns`.
|
||||
"""
|
||||
if not self.patterns:
|
||||
self._log.warn(u'no fields, nothing to do')
|
||||
self._log.warning(u'no fields, nothing to do')
|
||||
return
|
||||
|
||||
for field, patterns in self.patterns.items():
|
||||
|
|
|
|||
Loading…
Reference in a new issue