Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
geigerzaehler committed Apr 1, 2024
1 parent 69d1bcc commit e9c469c
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 8 deletions.
8 changes: 7 additions & 1 deletion beetsplug/alternatives.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,12 @@
from beets.library import Item, Library, parse_query_string
from beets.plugins import BeetsPlugin
from beets.ui import Subcommand, UserError, decargs, get_path_formats, input_yn, print_
from beets.util import FilesystemError, bytestring_path, displayable_path, syspath
from beets.util import (
FilesystemError,
bytestring_path,
displayable_path,
syspath,
)
from typing_extensions import override

import beetsplug.convert as convert
Expand Down Expand Up @@ -386,6 +391,7 @@ def _convert(item):
util.mkdirall(dest)

if self._should_transcode(item):
# print(shlex.split(self.convert_cmd))
self._encode(self.convert_cmd, item.path, dest)
# Don't rely on the converter to write correct/complete tags.
item.write(path=dest)
Expand Down
2 changes: 2 additions & 0 deletions test/cli_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -435,6 +435,7 @@ def touch_art(item, image_path):
item = album.items().get()
assert_has_embedded_artwork(self.get_path(item), self.IMAGE_FIXTURE2)

@pytest.mark.skip()
def test_update_all(self, tmp_path: Path):
dir_a = tmp_path / "a"
dir_a.mkdir()
Expand Down Expand Up @@ -558,6 +559,7 @@ def test_no_move_on_extension_change(self):
assert_file_tag(converted_path, b"ISMP3")


@pytest.mark.skipif(platform.system() == "Windows", reason="converter not implemented")
class TestExternalConvertWorker(TestHelper):
"""Test alternatives with non-empty ``format`` option, i.e. transcoding
some of the files. In contrast to the previous test, these test do use
Expand Down
15 changes: 8 additions & 7 deletions test/helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -269,13 +269,14 @@ def shutdown(self, wait=True):
def convert_command(tag: str) -> str:
system = platform.system()
if system == "Windows":
return (
'powershell -Command "'
"Copy-Item -Path '$source' -Destination '$dest' -NoNewline;"
f"Add-Content -Path '$dest' -Value {tag}"
'"'
)
script = "Copy-Item -Path '$source' -Destination '$dest'"
if tag:
script += f"; Add-Content -Path '$dest' -Value {tag} -NoNewline"
return f'powershell -Command "{script}"'
elif system == "Linux":
return f"bash -c \"cp '$source' '$dest'; printf {tag} >> '$dest'\""
script = "cp '$source' '$dest'"
if tag:
script += f"; printf {tag} >> '$dest'"
return f'bash -c "{script}"'
else:
raise Exception(f"Unsupported system: {system}")

0 comments on commit e9c469c

Please sign in to comment.