mirror of
https://github.com/clinton-hall/nzbToMedia.git
synced 2025-08-14 02:26:53 -07:00
Update vendored beets to 1.6.0
Updates colorama to 0.4.6 Adds confuse version 1.7.0 Updates jellyfish to 0.9.0 Adds mediafile 0.10.1 Updates munkres to 1.1.4 Updates musicbrainzngs to 0.7.1 Updates mutagen to 1.46.0 Updates pyyaml to 6.0 Updates unidecode to 1.3.6
This commit is contained in:
parent
5073ec0c6f
commit
56c6773c6b
385 changed files with 25143 additions and 18080 deletions
|
@ -1,4 +1,3 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# This file is part of beets.
|
||||
# Copyright 2016, Blemjhoo Tezoulbr <baobab@heresiarch.info>.
|
||||
#
|
||||
|
@ -15,23 +14,21 @@
|
|||
|
||||
""" Clears tag fields in media files."""
|
||||
|
||||
from __future__ import division, absolute_import, print_function
|
||||
import six
|
||||
|
||||
import re
|
||||
|
||||
from beets.plugins import BeetsPlugin
|
||||
from beets.mediafile import MediaFile
|
||||
from mediafile import MediaFile
|
||||
from beets.importer import action
|
||||
from beets.ui import Subcommand, decargs, input_yn
|
||||
from beets.util import confit
|
||||
import confuse
|
||||
|
||||
__author__ = 'baobab@heresiarch.info'
|
||||
|
||||
|
||||
class ZeroPlugin(BeetsPlugin):
|
||||
def __init__(self):
|
||||
super(ZeroPlugin, self).__init__()
|
||||
super().__init__()
|
||||
|
||||
self.register_listener('write', self.write_event)
|
||||
self.register_listener('import_task_choice',
|
||||
|
@ -56,7 +53,7 @@ class ZeroPlugin(BeetsPlugin):
|
|||
"""
|
||||
if self.config['fields'] and self.config['keep_fields']:
|
||||
self._log.warning(
|
||||
u'cannot blacklist and whitelist at the same time'
|
||||
'cannot blacklist and whitelist at the same time'
|
||||
)
|
||||
# Blacklist mode.
|
||||
elif self.config['fields']:
|
||||
|
@ -75,7 +72,7 @@ class ZeroPlugin(BeetsPlugin):
|
|||
|
||||
def zero_fields(lib, opts, args):
|
||||
if not decargs(args) and not input_yn(
|
||||
u"Remove fields for all items? (Y/n)",
|
||||
"Remove fields for all items? (Y/n)",
|
||||
True):
|
||||
return
|
||||
for item in lib.items(decargs(args)):
|
||||
|
@ -89,22 +86,22 @@ class ZeroPlugin(BeetsPlugin):
|
|||
Do some sanity checks then compile the regexes.
|
||||
"""
|
||||
if field not in MediaFile.fields():
|
||||
self._log.error(u'invalid field: {0}', field)
|
||||
self._log.error('invalid field: {0}', field)
|
||||
elif field in ('id', 'path', 'album_id'):
|
||||
self._log.warning(u'field \'{0}\' ignored, zeroing '
|
||||
u'it would be dangerous', field)
|
||||
self._log.warning('field \'{0}\' ignored, zeroing '
|
||||
'it would be dangerous', field)
|
||||
else:
|
||||
try:
|
||||
for pattern in self.config[field].as_str_seq():
|
||||
prog = re.compile(pattern, re.IGNORECASE)
|
||||
self.fields_to_progs.setdefault(field, []).append(prog)
|
||||
except confit.NotFoundError:
|
||||
except confuse.NotFoundError:
|
||||
# Matches everything
|
||||
self.fields_to_progs[field] = []
|
||||
|
||||
def import_task_choice_event(self, session, task):
|
||||
if task.choice_flag == action.ASIS and not self.warned:
|
||||
self._log.warning(u'cannot zero in \"as-is\" mode')
|
||||
self._log.warning('cannot zero in \"as-is\" mode')
|
||||
self.warned = True
|
||||
# TODO request write in as-is mode
|
||||
|
||||
|
@ -122,7 +119,7 @@ class ZeroPlugin(BeetsPlugin):
|
|||
fields_set = False
|
||||
|
||||
if not self.fields_to_progs:
|
||||
self._log.warning(u'no fields, nothing to do')
|
||||
self._log.warning('no fields, nothing to do')
|
||||
return False
|
||||
|
||||
for field, progs in self.fields_to_progs.items():
|
||||
|
@ -135,7 +132,7 @@ class ZeroPlugin(BeetsPlugin):
|
|||
|
||||
if match:
|
||||
fields_set = True
|
||||
self._log.debug(u'{0}: {1} -> None', field, value)
|
||||
self._log.debug('{0}: {1} -> None', field, value)
|
||||
tags[field] = None
|
||||
if self.config['update_database']:
|
||||
item[field] = None
|
||||
|
@ -158,6 +155,6 @@ def _match_progs(value, progs):
|
|||
if not progs:
|
||||
return True
|
||||
for prog in progs:
|
||||
if prog.search(six.text_type(value)):
|
||||
if prog.search(str(value)):
|
||||
return True
|
||||
return False
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue