mirror of
https://github.com/beetbox/beets.git
synced 2025-12-06 08:39:17 +01:00
Apply formatting
This commit is contained in:
parent
dae525741b
commit
83242fd7cf
14 changed files with 40 additions and 37 deletions
|
|
@ -122,8 +122,7 @@ class NamedQuery(Query):
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@abstractmethod
|
@abstractmethod
|
||||||
def __init__(self, pattern):
|
def __init__(self, pattern): ...
|
||||||
...
|
|
||||||
|
|
||||||
|
|
||||||
P = TypeVar("P")
|
P = TypeVar("P")
|
||||||
|
|
|
||||||
|
|
@ -35,8 +35,7 @@ if TYPE_CHECKING and sys.version_info >= (3, 8):
|
||||||
given type.
|
given type.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, value: Any = None):
|
def __init__(self, value: Any = None): ...
|
||||||
...
|
|
||||||
|
|
||||||
else:
|
else:
|
||||||
# No structural subtyping in Python < 3.8...
|
# No structural subtyping in Python < 3.8...
|
||||||
|
|
|
||||||
|
|
@ -216,12 +216,14 @@ def get_singleton_disambig_fields(info: hooks.TrackInfo) -> Sequence[str]:
|
||||||
calculated_values = {
|
calculated_values = {
|
||||||
"index": "Index {}".format(str(info.index)),
|
"index": "Index {}".format(str(info.index)),
|
||||||
"track_alt": "Track {}".format(info.track_alt),
|
"track_alt": "Track {}".format(info.track_alt),
|
||||||
"album": "[{}]".format(info.album)
|
"album": (
|
||||||
if (
|
"[{}]".format(info.album)
|
||||||
config["import"]["singleton_album_disambig"].get()
|
if (
|
||||||
and info.get("album")
|
config["import"]["singleton_album_disambig"].get()
|
||||||
)
|
and info.get("album")
|
||||||
else "",
|
)
|
||||||
|
else ""
|
||||||
|
),
|
||||||
}
|
}
|
||||||
|
|
||||||
for field in chosen_fields:
|
for field in chosen_fields:
|
||||||
|
|
@ -240,9 +242,11 @@ def get_album_disambig_fields(info: hooks.AlbumInfo) -> Sequence[str]:
|
||||||
out = []
|
out = []
|
||||||
chosen_fields = config["match"]["album_disambig_fields"].as_str_seq()
|
chosen_fields = config["match"]["album_disambig_fields"].as_str_seq()
|
||||||
calculated_values = {
|
calculated_values = {
|
||||||
"media": "{}x{}".format(info.mediums, info.media)
|
"media": (
|
||||||
if (info.mediums and info.mediums > 1)
|
"{}x{}".format(info.mediums, info.media)
|
||||||
else info.media,
|
if (info.mediums and info.mediums > 1)
|
||||||
|
else info.media
|
||||||
|
),
|
||||||
}
|
}
|
||||||
|
|
||||||
for field in chosen_fields:
|
for field in chosen_fields:
|
||||||
|
|
@ -1160,9 +1164,11 @@ class TerminalImportSession(importer.ImportSession):
|
||||||
print_(
|
print_(
|
||||||
"Old: "
|
"Old: "
|
||||||
+ summarize_items(
|
+ summarize_items(
|
||||||
list(duplicate.items())
|
(
|
||||||
if task.is_album
|
list(duplicate.items())
|
||||||
else [duplicate],
|
if task.is_album
|
||||||
|
else [duplicate]
|
||||||
|
),
|
||||||
not task.is_album,
|
not task.is_album,
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -74,7 +74,7 @@ class ExportPlugin(BeetsPlugin):
|
||||||
"xml": {
|
"xml": {
|
||||||
# XML module formatting options.
|
# XML module formatting options.
|
||||||
"formatting": {}
|
"formatting": {}
|
||||||
}
|
},
|
||||||
# TODO: Use something like the edit plugin
|
# TODO: Use something like the edit plugin
|
||||||
# 'item_fields': []
|
# 'item_fields': []
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ like the following in your config.yaml to configure:
|
||||||
file: 644
|
file: 644
|
||||||
dir: 755
|
dir: 755
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import stat
|
import stat
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -819,9 +819,9 @@ class GStreamerBackend(Backend):
|
||||||
self._files = [i.path for i in items]
|
self._files = [i.path for i in items]
|
||||||
|
|
||||||
# FIXME: Turn this into DefaultDict[bytes, Gain]
|
# FIXME: Turn this into DefaultDict[bytes, Gain]
|
||||||
self._file_tags: DefaultDict[
|
self._file_tags: DefaultDict[bytes, Dict[str, float]] = (
|
||||||
bytes, Dict[str, float]
|
collections.defaultdict(dict)
|
||||||
] = collections.defaultdict(dict)
|
)
|
||||||
|
|
||||||
self._rg.set_property("reference-level", target_level)
|
self._rg.set_property("reference-level", target_level)
|
||||||
|
|
||||||
|
|
@ -930,9 +930,9 @@ class GStreamerBackend(Backend):
|
||||||
tag
|
tag
|
||||||
)[1]
|
)[1]
|
||||||
elif tag == self.Gst.TAG_REFERENCE_LEVEL:
|
elif tag == self.Gst.TAG_REFERENCE_LEVEL:
|
||||||
self._file_tags[self._file][
|
self._file_tags[self._file]["REFERENCE_LEVEL"] = (
|
||||||
"REFERENCE_LEVEL"
|
taglist.get_double(tag)[1]
|
||||||
] = taglist.get_double(tag)[1]
|
)
|
||||||
|
|
||||||
tags.foreach(handle_tag, None)
|
tags.foreach(handle_tag, None)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
"""Tests for the 'ihate' plugin"""
|
"""Tests for the 'ihate' plugin"""
|
||||||
|
|
||||||
|
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
from beets import importer
|
from beets import importer
|
||||||
|
|
|
||||||
|
|
@ -89,12 +89,16 @@ class LyricsPluginTest(unittest.TestCase):
|
||||||
("CHVRCHΞS", ["song"]), list(lyrics.search_pairs(item))[0]
|
("CHVRCHΞS", ["song"]), list(lyrics.search_pairs(item))[0]
|
||||||
)
|
)
|
||||||
|
|
||||||
item = Item(artist="横山克", title="song", artist_sort="Masaru Yokoyama")
|
item = Item(
|
||||||
|
artist="横山克", title="song", artist_sort="Masaru Yokoyama"
|
||||||
|
)
|
||||||
self.assertIn(("横山克", ["song"]), lyrics.search_pairs(item))
|
self.assertIn(("横山克", ["song"]), lyrics.search_pairs(item))
|
||||||
self.assertIn(("Masaru Yokoyama", ["song"]), lyrics.search_pairs(item))
|
self.assertIn(("Masaru Yokoyama", ["song"]), lyrics.search_pairs(item))
|
||||||
|
|
||||||
# Make sure that the original artist name is still the first entry
|
# Make sure that the original artist name is still the first entry
|
||||||
self.assertEqual(("横山克", ["song"]), list(lyrics.search_pairs(item))[0])
|
self.assertEqual(
|
||||||
|
("横山克", ["song"]), list(lyrics.search_pairs(item))[0]
|
||||||
|
)
|
||||||
|
|
||||||
def test_search_pairs_multi_titles(self):
|
def test_search_pairs_multi_titles(self):
|
||||||
item = Item(title="1 / 2", artist="A")
|
item = Item(title="1 / 2", artist="A")
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
"""Tests for the 'spotify' plugin"""
|
"""Tests for the 'spotify' plugin"""
|
||||||
|
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import unittest
|
import unittest
|
||||||
from urllib.parse import parse_qs, urlparse
|
from urllib.parse import parse_qs, urlparse
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
"""Tests for the 'subsonic' plugin."""
|
"""Tests for the 'subsonic' plugin."""
|
||||||
|
|
||||||
|
|
||||||
import unittest
|
import unittest
|
||||||
from urllib.parse import parse_qs, urlparse
|
from urllib.parse import parse_qs, urlparse
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
"""Tests for the 'the' plugin"""
|
"""Tests for the 'the' plugin"""
|
||||||
|
|
||||||
|
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
from beets import config
|
from beets import config
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
"""Tests for the 'web' plugin"""
|
"""Tests for the 'web' plugin"""
|
||||||
|
|
||||||
|
|
||||||
import json
|
import json
|
||||||
import os.path
|
import os.path
|
||||||
import platform
|
import platform
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
"""Tests for the 'zero' plugin"""
|
"""Tests for the 'zero' plugin"""
|
||||||
|
|
||||||
|
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
from mediafile import MediaFile
|
from mediafile import MediaFile
|
||||||
|
|
|
||||||
|
|
@ -71,12 +71,12 @@ class MetaSyncTest(_common.TestCase, TestHelper):
|
||||||
items[1].album = "An Awesome Wave"
|
items[1].album = "An Awesome Wave"
|
||||||
|
|
||||||
if _is_windows():
|
if _is_windows():
|
||||||
items[
|
items[0].path = (
|
||||||
0
|
"G:\\Music\\Alt-J\\An Awesome Wave\\03 Tessellate.mp3"
|
||||||
].path = "G:\\Music\\Alt-J\\An Awesome Wave\\03 Tessellate.mp3"
|
)
|
||||||
items[
|
items[1].path = (
|
||||||
1
|
"G:\\Music\\Alt-J\\An Awesome Wave\\04 Breezeblocks.mp3"
|
||||||
].path = "G:\\Music\\Alt-J\\An Awesome Wave\\04 Breezeblocks.mp3"
|
)
|
||||||
else:
|
else:
|
||||||
items[0].path = "/Music/Alt-J/An Awesome Wave/03 Tessellate.mp3"
|
items[0].path = "/Music/Alt-J/An Awesome Wave/03 Tessellate.mp3"
|
||||||
items[1].path = "/Music/Alt-J/An Awesome Wave/04 Breezeblocks.mp3"
|
items[1].path = "/Music/Alt-J/An Awesome Wave/04 Breezeblocks.mp3"
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue