mirror of
https://github.com/clinton-hall/nzbToMedia.git
synced 2025-08-20 21:33:13 -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, Heinz Wiesinger.
|
||||
#
|
||||
|
@ -16,15 +15,13 @@
|
|||
"""Synchronize information from music player libraries
|
||||
"""
|
||||
|
||||
from __future__ import division, absolute_import, print_function
|
||||
|
||||
from abc import abstractmethod, ABCMeta
|
||||
from importlib import import_module
|
||||
|
||||
from beets.util.confit import ConfigValueError
|
||||
from confuse import ConfigValueError
|
||||
from beets import ui
|
||||
from beets.plugins import BeetsPlugin
|
||||
import six
|
||||
|
||||
|
||||
METASYNC_MODULE = 'beetsplug.metasync'
|
||||
|
@ -36,7 +33,7 @@ SOURCES = {
|
|||
}
|
||||
|
||||
|
||||
class MetaSource(six.with_metaclass(ABCMeta, object)):
|
||||
class MetaSource(metaclass=ABCMeta):
|
||||
def __init__(self, config, log):
|
||||
self.item_types = {}
|
||||
self.config = config
|
||||
|
@ -77,7 +74,7 @@ class MetaSyncPlugin(BeetsPlugin):
|
|||
item_types = load_item_types()
|
||||
|
||||
def __init__(self):
|
||||
super(MetaSyncPlugin, self).__init__()
|
||||
super().__init__()
|
||||
|
||||
def commands(self):
|
||||
cmd = ui.Subcommand('metasync',
|
||||
|
@ -108,7 +105,7 @@ class MetaSyncPlugin(BeetsPlugin):
|
|||
|
||||
# Avoid needlessly instantiating meta sources (can be expensive)
|
||||
if not items:
|
||||
self._log.info(u'No items found matching query')
|
||||
self._log.info('No items found matching query')
|
||||
return
|
||||
|
||||
# Instantiate the meta sources
|
||||
|
@ -116,18 +113,18 @@ class MetaSyncPlugin(BeetsPlugin):
|
|||
try:
|
||||
cls = META_SOURCES[player]
|
||||
except KeyError:
|
||||
self._log.error(u'Unknown metadata source \'{0}\''.format(
|
||||
self._log.error('Unknown metadata source \'{}\''.format(
|
||||
player))
|
||||
|
||||
try:
|
||||
meta_source_instances[player] = cls(self.config, self._log)
|
||||
except (ImportError, ConfigValueError) as e:
|
||||
self._log.error(u'Failed to instantiate metadata source '
|
||||
u'\'{0}\': {1}'.format(player, e))
|
||||
self._log.error('Failed to instantiate metadata source '
|
||||
'\'{}\': {}'.format(player, e))
|
||||
|
||||
# Avoid needlessly iterating over items
|
||||
if not meta_source_instances:
|
||||
self._log.error(u'No valid metadata sources found')
|
||||
self._log.error('No valid metadata sources found')
|
||||
return
|
||||
|
||||
# Sync the items with all of the meta sources
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# This file is part of beets.
|
||||
# Copyright 2016, Heinz Wiesinger.
|
||||
#
|
||||
|
@ -16,7 +15,6 @@
|
|||
"""Synchronize information from amarok's library via dbus
|
||||
"""
|
||||
|
||||
from __future__ import division, absolute_import, print_function
|
||||
|
||||
from os.path import basename
|
||||
from datetime import datetime
|
||||
|
@ -49,14 +47,14 @@ class Amarok(MetaSource):
|
|||
'amarok_lastplayed': DateType(),
|
||||
}
|
||||
|
||||
queryXML = u'<query version="1.0"> \
|
||||
query_xml = '<query version="1.0"> \
|
||||
<filters> \
|
||||
<and><include field="filename" value=%s /></and> \
|
||||
</filters> \
|
||||
</query>'
|
||||
|
||||
def __init__(self, config, log):
|
||||
super(Amarok, self).__init__(config, log)
|
||||
super().__init__(config, log)
|
||||
|
||||
if not dbus:
|
||||
raise ImportError('failed to import dbus')
|
||||
|
@ -72,7 +70,7 @@ class Amarok(MetaSource):
|
|||
# of the result set. So query for the filename and then try to match
|
||||
# the correct item from the results we get back
|
||||
results = self.collection.Query(
|
||||
self.queryXML % quoteattr(basename(path))
|
||||
self.query_xml % quoteattr(basename(path))
|
||||
)
|
||||
for result in results:
|
||||
if result['xesam:url'] != path:
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# This file is part of beets.
|
||||
# Copyright 2016, Tom Jaspers.
|
||||
#
|
||||
|
@ -16,7 +15,6 @@
|
|||
"""Synchronize information from iTunes's library
|
||||
"""
|
||||
|
||||
from __future__ import division, absolute_import, print_function
|
||||
|
||||
from contextlib import contextmanager
|
||||
import os
|
||||
|
@ -24,13 +22,13 @@ import shutil
|
|||
import tempfile
|
||||
import plistlib
|
||||
|
||||
from six.moves.urllib.parse import urlparse, unquote
|
||||
from urllib.parse import urlparse, unquote
|
||||
from time import mktime
|
||||
|
||||
from beets import util
|
||||
from beets.dbcore import types
|
||||
from beets.library import DateType
|
||||
from beets.util.confit import ConfigValueError
|
||||
from confuse import ConfigValueError
|
||||
from beetsplug.metasync import MetaSource
|
||||
|
||||
|
||||
|
@ -63,15 +61,16 @@ def _norm_itunes_path(path):
|
|||
class Itunes(MetaSource):
|
||||
|
||||
item_types = {
|
||||
'itunes_rating': types.INTEGER, # 0..100 scale
|
||||
'itunes_playcount': types.INTEGER,
|
||||
'itunes_skipcount': types.INTEGER,
|
||||
'itunes_lastplayed': DateType(),
|
||||
'itunes_rating': types.INTEGER, # 0..100 scale
|
||||
'itunes_playcount': types.INTEGER,
|
||||
'itunes_skipcount': types.INTEGER,
|
||||
'itunes_lastplayed': DateType(),
|
||||
'itunes_lastskipped': DateType(),
|
||||
'itunes_dateadded': DateType(),
|
||||
}
|
||||
|
||||
def __init__(self, config, log):
|
||||
super(Itunes, self).__init__(config, log)
|
||||
super().__init__(config, log)
|
||||
|
||||
config.add({'itunes': {
|
||||
'library': '~/Music/iTunes/iTunes Library.xml'
|
||||
|
@ -82,19 +81,20 @@ class Itunes(MetaSource):
|
|||
|
||||
try:
|
||||
self._log.debug(
|
||||
u'loading iTunes library from {0}'.format(library_path))
|
||||
f'loading iTunes library from {library_path}')
|
||||
with create_temporary_copy(library_path) as library_copy:
|
||||
raw_library = plistlib.readPlist(library_copy)
|
||||
except IOError as e:
|
||||
raise ConfigValueError(u'invalid iTunes library: ' + e.strerror)
|
||||
with open(library_copy, 'rb') as library_copy_f:
|
||||
raw_library = plistlib.load(library_copy_f)
|
||||
except OSError as e:
|
||||
raise ConfigValueError('invalid iTunes library: ' + e.strerror)
|
||||
except Exception:
|
||||
# It's likely the user configured their '.itl' library (<> xml)
|
||||
if os.path.splitext(library_path)[1].lower() != '.xml':
|
||||
hint = u': please ensure that the configured path' \
|
||||
u' points to the .XML library'
|
||||
hint = ': please ensure that the configured path' \
|
||||
' points to the .XML library'
|
||||
else:
|
||||
hint = ''
|
||||
raise ConfigValueError(u'invalid iTunes library' + hint)
|
||||
raise ConfigValueError('invalid iTunes library' + hint)
|
||||
|
||||
# Make the iTunes library queryable using the path
|
||||
self.collection = {_norm_itunes_path(track['Location']): track
|
||||
|
@ -105,7 +105,7 @@ class Itunes(MetaSource):
|
|||
result = self.collection.get(util.bytestring_path(item.path).lower())
|
||||
|
||||
if not result:
|
||||
self._log.warning(u'no iTunes match found for {0}'.format(item))
|
||||
self._log.warning(f'no iTunes match found for {item}')
|
||||
return
|
||||
|
||||
item.itunes_rating = result.get('Rating')
|
||||
|
@ -119,3 +119,7 @@ class Itunes(MetaSource):
|
|||
if result.get('Skip Date'):
|
||||
item.itunes_lastskipped = mktime(
|
||||
result.get('Skip Date').timetuple())
|
||||
|
||||
if result.get('Date Added'):
|
||||
item.itunes_dateadded = mktime(
|
||||
result.get('Date Added').timetuple())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue