Commit bf7ee7ba authored by interfect's avatar interfect
Browse files

Round transcoded lengths and note VBR Opus

parent 5977f155
Pipeline #13163 failed with stages
in 59 seconds
......@@ -29,7 +29,7 @@ def test_guess_mimetype_try_using_extension_if_fail(wrong, factories, mocker):
("sample.flac", {"bitrate": 1608000, "length": 0.001}),
("test.mp3", {"bitrate": 8000, "length": 267.70285714285717}),
("test.ogg", {"bitrate": 112000, "length": 1}),
("test.opus", {"bitrate": 112000, "length": 1}),
("test.opus", {"bitrate": 0, "length": 1}), # This Opus file lacks a bitrate
],
)
def test_get_audio_file_data(name, expected):
......@@ -116,10 +116,10 @@ def test_get_dirs_and_files(path, expected, tmpdir):
@pytest.mark.parametrize(
"name, expected",
[
("sample.flac", {"bitrate": 1608000, "length": 0.001}),
("test.mp3", {"bitrate": 8000, "length": 267.70285714285717}),
("test.ogg", {"bitrate": 112000, "length": 1}),
("test.opus", {"bitrate": 112000, "length": 1}),
("sample.flac", {"bitrate": 128000, "length": 0}),
("test.mp3", {"bitrate": 16000, "length": 268}),
("test.ogg", {"bitrate": 128000, "length": 1}),
("test.opus", {"bitrate": 128000, "length": 1}),
],
)
def test_transcode_file(name, expected):
......@@ -127,6 +127,6 @@ def test_transcode_file(name, expected):
with tempfile.NamedTemporaryFile() as dest:
utils.transcode_file(path, pathlib.Path(dest.name))
with open(dest.name, "rb") as f:
result = utils.get_audio_file_data(f)
result = {k: round(v) for k, v in utils.get_audio_file_data(f).items()}
assert result == expected
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment