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:
Labrys of Knossos 2022-11-28 18:02:40 -05:00
commit 56c6773c6b
385 changed files with 25143 additions and 18080 deletions

View file

@ -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())