test(analyzer): fix wrong bit_rate values
Mutagen >=1.46 properly compute the bit_rate for wav files.
This commit is contained in:
parent
019b4686ae
commit
d726a097b0
|
@ -201,7 +201,7 @@ FILES_TAGGED = [
|
||||||
here / "s1-mono-tagged.wav",
|
here / "s1-mono-tagged.wav",
|
||||||
{
|
{
|
||||||
**meta,
|
**meta,
|
||||||
"bit_rate": approx(96000, abs=1e2),
|
"bit_rate": approx(768000, abs=1e2),
|
||||||
"channels": 1,
|
"channels": 1,
|
||||||
"mime": "audio/wav",
|
"mime": "audio/wav",
|
||||||
},
|
},
|
||||||
|
@ -210,7 +210,7 @@ FILES_TAGGED = [
|
||||||
here / "s1-stereo-tagged.wav",
|
here / "s1-stereo-tagged.wav",
|
||||||
{
|
{
|
||||||
**meta,
|
**meta,
|
||||||
"bit_rate": approx(384000, abs=1e2),
|
"bit_rate": approx(1536000, abs=1e2),
|
||||||
"channels": 2,
|
"channels": 2,
|
||||||
"mime": "audio/wav",
|
"mime": "audio/wav",
|
||||||
},
|
},
|
||||||
|
@ -333,7 +333,7 @@ FILES_TAGGED += [
|
||||||
here / "s1-mono-tagged-utf8.wav",
|
here / "s1-mono-tagged-utf8.wav",
|
||||||
{
|
{
|
||||||
**meta,
|
**meta,
|
||||||
"bit_rate": approx(96000, abs=1e2),
|
"bit_rate": approx(768000, abs=1e2),
|
||||||
"channels": 1,
|
"channels": 1,
|
||||||
"mime": "audio/wav",
|
"mime": "audio/wav",
|
||||||
},
|
},
|
||||||
|
@ -342,7 +342,7 @@ FILES_TAGGED += [
|
||||||
here / "s1-stereo-tagged-utf8.wav",
|
here / "s1-stereo-tagged-utf8.wav",
|
||||||
{
|
{
|
||||||
**meta,
|
**meta,
|
||||||
"bit_rate": approx(384000, abs=1e2),
|
"bit_rate": approx(1536000, abs=1e2),
|
||||||
"channels": 2,
|
"channels": 2,
|
||||||
"mime": "audio/wav",
|
"mime": "audio/wav",
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
|
import distro
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from libretime_analyzer.pipeline.analyze_metadata import analyze_metadata
|
from libretime_analyzer.pipeline.analyze_metadata import analyze_metadata
|
||||||
|
@ -27,6 +28,12 @@ def test_analyze_metadata(filepath: Path, metadata: dict):
|
||||||
del metadata["length"]
|
del metadata["length"]
|
||||||
del found["length"]
|
del found["length"]
|
||||||
|
|
||||||
|
# Mutagen <1.46 computes a wrong bit_rate for wav files, this version
|
||||||
|
# of mutagen is only installed on bionic (python <3.7)
|
||||||
|
if filepath.suffix == ".wav" and distro.codename() == "bionic":
|
||||||
|
del metadata["bit_rate"]
|
||||||
|
del found["bit_rate"]
|
||||||
|
|
||||||
# mp3,ogg,flac files does not support comments yet
|
# mp3,ogg,flac files does not support comments yet
|
||||||
if not filepath.suffix == ".m4a":
|
if not filepath.suffix == ".m4a":
|
||||||
if "comment" in metadata:
|
if "comment" in metadata:
|
||||||
|
|
Loading…
Reference in New Issue