mirror of
https://github.com/beetbox/beets.git
synced 2025-12-06 16:42:42 +01:00
Remove unused platform parameter in item.destination
This commit is contained in:
parent
06dd2738bb
commit
d3186859ac
2 changed files with 8 additions and 6 deletions
|
|
@ -1077,7 +1077,6 @@ class Item(LibModel):
|
||||||
self,
|
self,
|
||||||
relative_to_libdir=False,
|
relative_to_libdir=False,
|
||||||
basedir=None,
|
basedir=None,
|
||||||
platform=None,
|
|
||||||
path_formats=None,
|
path_formats=None,
|
||||||
) -> bytes:
|
) -> bytes:
|
||||||
"""Return the path in the library directory designated for the item
|
"""Return the path in the library directory designated for the item
|
||||||
|
|
@ -1087,7 +1086,6 @@ class Item(LibModel):
|
||||||
library's base directory for the destination.
|
library's base directory for the destination.
|
||||||
"""
|
"""
|
||||||
db = self._check_db()
|
db = self._check_db()
|
||||||
platform = platform or sys.platform
|
|
||||||
basedir = basedir or db.directory
|
basedir = basedir or db.directory
|
||||||
path_formats = path_formats or db.path_formats
|
path_formats = path_formats or db.path_formats
|
||||||
|
|
||||||
|
|
@ -1117,7 +1115,7 @@ class Item(LibModel):
|
||||||
subpath = self.evaluate_template(subpath_tmpl, True)
|
subpath = self.evaluate_template(subpath_tmpl, True)
|
||||||
|
|
||||||
# Prepare path for output: normalize Unicode characters.
|
# Prepare path for output: normalize Unicode characters.
|
||||||
if platform == "darwin":
|
if sys.platform == "darwin":
|
||||||
subpath = unicodedata.normalize("NFD", subpath)
|
subpath = unicodedata.normalize("NFD", subpath)
|
||||||
else:
|
else:
|
||||||
subpath = unicodedata.normalize("NFC", subpath)
|
subpath = unicodedata.normalize("NFC", subpath)
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,7 @@ import sys
|
||||||
import time
|
import time
|
||||||
import unicodedata
|
import unicodedata
|
||||||
import unittest
|
import unittest
|
||||||
|
from unittest.mock import patch
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
from mediafile import MediaFile, UnreadableFileError
|
from mediafile import MediaFile, UnreadableFileError
|
||||||
|
|
@ -411,13 +412,15 @@ class DestinationTest(BeetsTestCase):
|
||||||
def test_unicode_normalized_nfd_on_mac(self):
|
def test_unicode_normalized_nfd_on_mac(self):
|
||||||
instr = unicodedata.normalize("NFC", "caf\xe9")
|
instr = unicodedata.normalize("NFC", "caf\xe9")
|
||||||
self.lib.path_formats = [("default", instr)]
|
self.lib.path_formats = [("default", instr)]
|
||||||
dest = self.i.destination(platform="darwin", relative_to_libdir=True)
|
with patch("sys.platform", "darwin"):
|
||||||
|
dest = self.i.destination(relative_to_libdir=True)
|
||||||
assert as_string(dest) == unicodedata.normalize("NFD", instr)
|
assert as_string(dest) == unicodedata.normalize("NFD", instr)
|
||||||
|
|
||||||
def test_unicode_normalized_nfc_on_linux(self):
|
def test_unicode_normalized_nfc_on_linux(self):
|
||||||
instr = unicodedata.normalize("NFD", "caf\xe9")
|
instr = unicodedata.normalize("NFD", "caf\xe9")
|
||||||
self.lib.path_formats = [("default", instr)]
|
self.lib.path_formats = [("default", instr)]
|
||||||
dest = self.i.destination(platform="linux", relative_to_libdir=True)
|
with patch("sys.platform", "linux"):
|
||||||
|
dest = self.i.destination(relative_to_libdir=True)
|
||||||
assert as_string(dest) == unicodedata.normalize("NFC", instr)
|
assert as_string(dest) == unicodedata.normalize("NFC", instr)
|
||||||
|
|
||||||
def test_non_mbcs_characters_on_windows(self):
|
def test_non_mbcs_characters_on_windows(self):
|
||||||
|
|
@ -436,7 +439,8 @@ class DestinationTest(BeetsTestCase):
|
||||||
def test_unicode_extension_in_fragment(self):
|
def test_unicode_extension_in_fragment(self):
|
||||||
self.lib.path_formats = [("default", "foo")]
|
self.lib.path_formats = [("default", "foo")]
|
||||||
self.i.path = util.bytestring_path("bar.caf\xe9")
|
self.i.path = util.bytestring_path("bar.caf\xe9")
|
||||||
dest = self.i.destination(platform="linux", relative_to_libdir=True)
|
with patch("sys.platform", "linux"):
|
||||||
|
dest = self.i.destination(relative_to_libdir=True)
|
||||||
assert as_string(dest) == "foo.caf\xe9"
|
assert as_string(dest) == "foo.caf\xe9"
|
||||||
|
|
||||||
def test_asciify_and_replace(self):
|
def test_asciify_and_replace(self):
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue