Format code using black
This commit is contained in:
parent
efe4fa027e
commit
c27f020d73
85 changed files with 3238 additions and 2243 deletions
|
@ -2,12 +2,14 @@
|
|||
from nose.tools import *
|
||||
import airtime_analyzer
|
||||
|
||||
|
||||
def setup():
|
||||
pass
|
||||
|
||||
|
||||
def teardown():
|
||||
pass
|
||||
|
||||
|
||||
def test_basic():
|
||||
pass
|
||||
|
||||
|
|
|
@ -8,48 +8,58 @@ import datetime
|
|||
from airtime_analyzer.analyzer_pipeline import AnalyzerPipeline
|
||||
from airtime_analyzer import config_file
|
||||
|
||||
DEFAULT_AUDIO_FILE = u'tests/test_data/44100Hz-16bit-mono.mp3'
|
||||
DEFAULT_IMPORT_DEST = u'Test Artist/Test Album/44100Hz-16bit-mono.mp3'
|
||||
DEFAULT_AUDIO_FILE = u"tests/test_data/44100Hz-16bit-mono.mp3"
|
||||
DEFAULT_IMPORT_DEST = u"Test Artist/Test Album/44100Hz-16bit-mono.mp3"
|
||||
|
||||
|
||||
def setup():
|
||||
pass
|
||||
|
||||
|
||||
def teardown():
|
||||
#Move the file back
|
||||
# Move the file back
|
||||
shutil.move(DEFAULT_IMPORT_DEST, DEFAULT_AUDIO_FILE)
|
||||
assert os.path.exists(DEFAULT_AUDIO_FILE)
|
||||
|
||||
|
||||
def test_basic():
|
||||
filename = os.path.basename(DEFAULT_AUDIO_FILE)
|
||||
q = Queue()
|
||||
file_prefix = u''
|
||||
file_prefix = u""
|
||||
storage_backend = "file"
|
||||
#This actually imports the file into the "./Test Artist" directory.
|
||||
AnalyzerPipeline.run_analysis(q, DEFAULT_AUDIO_FILE, u'.', filename, storage_backend, file_prefix)
|
||||
# This actually imports the file into the "./Test Artist" directory.
|
||||
AnalyzerPipeline.run_analysis(
|
||||
q, DEFAULT_AUDIO_FILE, u".", filename, storage_backend, file_prefix
|
||||
)
|
||||
metadata = q.get()
|
||||
assert metadata['track_title'] == u'Test Title'
|
||||
assert metadata['artist_name'] == u'Test Artist'
|
||||
assert metadata['album_title'] == u'Test Album'
|
||||
assert metadata['year'] == u'1999'
|
||||
assert metadata['genre'] == u'Test Genre'
|
||||
assert metadata['mime'] == 'audio/mp3' # Not unicode because MIMEs aren't.
|
||||
assert abs(metadata['length_seconds'] - 3.9) < 0.1
|
||||
assert metadata["length"] == str(datetime.timedelta(seconds=metadata["length_seconds"]))
|
||||
assert metadata["track_title"] == u"Test Title"
|
||||
assert metadata["artist_name"] == u"Test Artist"
|
||||
assert metadata["album_title"] == u"Test Album"
|
||||
assert metadata["year"] == u"1999"
|
||||
assert metadata["genre"] == u"Test Genre"
|
||||
assert metadata["mime"] == "audio/mp3" # Not unicode because MIMEs aren't.
|
||||
assert abs(metadata["length_seconds"] - 3.9) < 0.1
|
||||
assert metadata["length"] == str(
|
||||
datetime.timedelta(seconds=metadata["length_seconds"])
|
||||
)
|
||||
assert os.path.exists(DEFAULT_IMPORT_DEST)
|
||||
|
||||
|
||||
@raises(TypeError)
|
||||
def test_wrong_type_queue_param():
|
||||
AnalyzerPipeline.run_analysis(Queue(), u'', u'', u'')
|
||||
AnalyzerPipeline.run_analysis(Queue(), u"", u"", u"")
|
||||
|
||||
|
||||
@raises(TypeError)
|
||||
def test_wrong_type_string_param2():
|
||||
AnalyzerPipeline.run_analysis(Queue(), '', u'', u'')
|
||||
AnalyzerPipeline.run_analysis(Queue(), "", u"", u"")
|
||||
|
||||
|
||||
@raises(TypeError)
|
||||
def test_wrong_type_string_param3():
|
||||
AnalyzerPipeline.run_analysis(Queue(), u'', '', u'')
|
||||
AnalyzerPipeline.run_analysis(Queue(), u"", "", u"")
|
||||
|
||||
|
||||
@raises(TypeError)
|
||||
def test_wrong_type_string_param4():
|
||||
AnalyzerPipeline.run_analysis(Queue(), u'', u'', '')
|
||||
|
||||
AnalyzerPipeline.run_analysis(Queue(), u"", u"", "")
|
||||
|
|
|
@ -2,13 +2,16 @@
|
|||
from nose.tools import *
|
||||
from airtime_analyzer.analyzer import Analyzer
|
||||
|
||||
|
||||
def setup():
|
||||
pass
|
||||
|
||||
|
||||
def teardown():
|
||||
pass
|
||||
|
||||
|
||||
@raises(NotImplementedError)
|
||||
def test_analyze():
|
||||
abstract_analyzer = Analyzer()
|
||||
abstract_analyzer.analyze(u'foo', dict())
|
||||
abstract_analyzer.analyze(u"foo", dict())
|
||||
|
|
|
@ -2,63 +2,97 @@
|
|||
from nose.tools import *
|
||||
from airtime_analyzer.cuepoint_analyzer import CuePointAnalyzer
|
||||
|
||||
|
||||
def check_default_metadata(metadata):
|
||||
''' Check that the values extract by Silan/CuePointAnalyzer on our test audio files match what we expect.
|
||||
"""Check that the values extract by Silan/CuePointAnalyzer on our test audio files match what we expect.
|
||||
:param metadata: a metadata dictionary
|
||||
:return: Nothing
|
||||
'''
|
||||
"""
|
||||
# We give silan some leeway here by specifying a tolerance
|
||||
tolerance_seconds = 0.1
|
||||
length_seconds = 3.9
|
||||
assert abs(metadata['length_seconds'] - length_seconds) < tolerance_seconds
|
||||
assert abs(float(metadata['cuein'])) < tolerance_seconds
|
||||
assert abs(float(metadata['cueout']) - length_seconds) < tolerance_seconds
|
||||
assert abs(metadata["length_seconds"] - length_seconds) < tolerance_seconds
|
||||
assert abs(float(metadata["cuein"])) < tolerance_seconds
|
||||
assert abs(float(metadata["cueout"]) - length_seconds) < tolerance_seconds
|
||||
|
||||
|
||||
def test_missing_silan():
|
||||
old_silan = CuePointAnalyzer.SILAN_EXECUTABLE
|
||||
CuePointAnalyzer.SILAN_EXECUTABLE = 'foosdaf'
|
||||
metadata = CuePointAnalyzer.analyze(u'tests/test_data/44100Hz-16bit-stereo-utf8.mp3', dict())
|
||||
CuePointAnalyzer.SILAN_EXECUTABLE = old_silan # Need to put this back
|
||||
CuePointAnalyzer.SILAN_EXECUTABLE = "foosdaf"
|
||||
metadata = CuePointAnalyzer.analyze(
|
||||
u"tests/test_data/44100Hz-16bit-stereo-utf8.mp3", dict()
|
||||
)
|
||||
CuePointAnalyzer.SILAN_EXECUTABLE = old_silan # Need to put this back
|
||||
|
||||
|
||||
def test_invalid_filepath():
|
||||
metadata = CuePointAnalyzer.analyze(u'non-existent-file', dict())
|
||||
metadata = CuePointAnalyzer.analyze(u"non-existent-file", dict())
|
||||
|
||||
|
||||
def test_mp3_utf8():
|
||||
metadata = CuePointAnalyzer.analyze(u'tests/test_data/44100Hz-16bit-stereo-utf8.mp3', dict())
|
||||
metadata = CuePointAnalyzer.analyze(
|
||||
u"tests/test_data/44100Hz-16bit-stereo-utf8.mp3", dict()
|
||||
)
|
||||
check_default_metadata(metadata)
|
||||
|
||||
|
||||
def test_mp3_dualmono():
|
||||
metadata = CuePointAnalyzer.analyze(u'tests/test_data/44100Hz-16bit-dualmono.mp3', dict())
|
||||
metadata = CuePointAnalyzer.analyze(
|
||||
u"tests/test_data/44100Hz-16bit-dualmono.mp3", dict()
|
||||
)
|
||||
check_default_metadata(metadata)
|
||||
|
||||
|
||||
def test_mp3_jointstereo():
|
||||
metadata = CuePointAnalyzer.analyze(u'tests/test_data/44100Hz-16bit-jointstereo.mp3', dict())
|
||||
metadata = CuePointAnalyzer.analyze(
|
||||
u"tests/test_data/44100Hz-16bit-jointstereo.mp3", dict()
|
||||
)
|
||||
check_default_metadata(metadata)
|
||||
|
||||
|
||||
def test_mp3_simplestereo():
|
||||
metadata = CuePointAnalyzer.analyze(u'tests/test_data/44100Hz-16bit-simplestereo.mp3', dict())
|
||||
metadata = CuePointAnalyzer.analyze(
|
||||
u"tests/test_data/44100Hz-16bit-simplestereo.mp3", dict()
|
||||
)
|
||||
check_default_metadata(metadata)
|
||||
|
||||
|
||||
def test_mp3_stereo():
|
||||
metadata = CuePointAnalyzer.analyze(u'tests/test_data/44100Hz-16bit-stereo.mp3', dict())
|
||||
metadata = CuePointAnalyzer.analyze(
|
||||
u"tests/test_data/44100Hz-16bit-stereo.mp3", dict()
|
||||
)
|
||||
check_default_metadata(metadata)
|
||||
|
||||
|
||||
def test_mp3_mono():
|
||||
metadata = CuePointAnalyzer.analyze(u'tests/test_data/44100Hz-16bit-mono.mp3', dict())
|
||||
metadata = CuePointAnalyzer.analyze(
|
||||
u"tests/test_data/44100Hz-16bit-mono.mp3", dict()
|
||||
)
|
||||
check_default_metadata(metadata)
|
||||
|
||||
|
||||
def test_ogg_stereo():
|
||||
metadata = CuePointAnalyzer.analyze(u'tests/test_data/44100Hz-16bit-stereo.ogg', dict())
|
||||
metadata = CuePointAnalyzer.analyze(
|
||||
u"tests/test_data/44100Hz-16bit-stereo.ogg", dict()
|
||||
)
|
||||
check_default_metadata(metadata)
|
||||
|
||||
|
||||
def test_invalid_wma():
|
||||
metadata = CuePointAnalyzer.analyze(u'tests/test_data/44100Hz-16bit-stereo-invalid.wma', dict())
|
||||
metadata = CuePointAnalyzer.analyze(
|
||||
u"tests/test_data/44100Hz-16bit-stereo-invalid.wma", dict()
|
||||
)
|
||||
|
||||
|
||||
def test_m4a_stereo():
|
||||
metadata = CuePointAnalyzer.analyze(u'tests/test_data/44100Hz-16bit-stereo.m4a', dict())
|
||||
metadata = CuePointAnalyzer.analyze(
|
||||
u"tests/test_data/44100Hz-16bit-stereo.m4a", dict()
|
||||
)
|
||||
check_default_metadata(metadata)
|
||||
|
||||
|
||||
def test_wav_stereo():
|
||||
metadata = CuePointAnalyzer.analyze(u'tests/test_data/44100Hz-16bit-stereo.wav', dict())
|
||||
metadata = CuePointAnalyzer.analyze(
|
||||
u"tests/test_data/44100Hz-16bit-stereo.wav", dict()
|
||||
)
|
||||
check_default_metadata(metadata)
|
||||
|
|
|
@ -8,109 +8,125 @@ import mock
|
|||
from pprint import pprint
|
||||
from airtime_analyzer.filemover_analyzer import FileMoverAnalyzer
|
||||
|
||||
DEFAULT_AUDIO_FILE = u'tests/test_data/44100Hz-16bit-mono.mp3'
|
||||
DEFAULT_IMPORT_DEST = u'Test Artist/Test Album/44100Hz-16bit-mono.mp3'
|
||||
DEFAULT_AUDIO_FILE = u"tests/test_data/44100Hz-16bit-mono.mp3"
|
||||
DEFAULT_IMPORT_DEST = u"Test Artist/Test Album/44100Hz-16bit-mono.mp3"
|
||||
|
||||
|
||||
def setup():
|
||||
pass
|
||||
|
||||
|
||||
def teardown():
|
||||
pass
|
||||
|
||||
|
||||
@raises(Exception)
|
||||
def test_dont_use_analyze():
|
||||
FileMoverAnalyzer.analyze(u'foo', dict())
|
||||
FileMoverAnalyzer.analyze(u"foo", dict())
|
||||
|
||||
|
||||
@raises(TypeError)
|
||||
def test_move_wrong_string_param1():
|
||||
FileMoverAnalyzer.move(42, '', '', dict())
|
||||
FileMoverAnalyzer.move(42, "", "", dict())
|
||||
|
||||
|
||||
@raises(TypeError)
|
||||
def test_move_wrong_string_param2():
|
||||
FileMoverAnalyzer.move(u'', 23, u'', dict())
|
||||
FileMoverAnalyzer.move(u"", 23, u"", dict())
|
||||
|
||||
|
||||
@raises(TypeError)
|
||||
def test_move_wrong_string_param3():
|
||||
FileMoverAnalyzer.move('', '', 5, dict())
|
||||
FileMoverAnalyzer.move("", "", 5, dict())
|
||||
|
||||
|
||||
@raises(TypeError)
|
||||
def test_move_wrong_dict_param():
|
||||
FileMoverAnalyzer.move('', '', '', 12345)
|
||||
FileMoverAnalyzer.move("", "", "", 12345)
|
||||
|
||||
|
||||
@raises(FileNotFoundError)
|
||||
def test_move_wrong_string_param3():
|
||||
FileMoverAnalyzer.move('', '', '', dict())
|
||||
FileMoverAnalyzer.move("", "", "", dict())
|
||||
|
||||
|
||||
def test_basic():
|
||||
filename = os.path.basename(DEFAULT_AUDIO_FILE)
|
||||
FileMoverAnalyzer.move(DEFAULT_AUDIO_FILE, u'.', filename, dict())
|
||||
#Move the file back
|
||||
FileMoverAnalyzer.move(DEFAULT_AUDIO_FILE, u".", filename, dict())
|
||||
# Move the file back
|
||||
shutil.move("./" + filename, DEFAULT_AUDIO_FILE)
|
||||
assert os.path.exists(DEFAULT_AUDIO_FILE)
|
||||
|
||||
|
||||
def test_basic_samefile():
|
||||
filename = os.path.basename(DEFAULT_AUDIO_FILE)
|
||||
FileMoverAnalyzer.move(DEFAULT_AUDIO_FILE, u'tests/test_data', filename, dict())
|
||||
FileMoverAnalyzer.move(DEFAULT_AUDIO_FILE, u"tests/test_data", filename, dict())
|
||||
assert os.path.exists(DEFAULT_AUDIO_FILE)
|
||||
|
||||
|
||||
def test_duplicate_file():
|
||||
filename = os.path.basename(DEFAULT_AUDIO_FILE)
|
||||
#Import the file once
|
||||
FileMoverAnalyzer.move(DEFAULT_AUDIO_FILE, u'.', filename, dict())
|
||||
#Copy it back to the original location
|
||||
# Import the file once
|
||||
FileMoverAnalyzer.move(DEFAULT_AUDIO_FILE, u".", filename, dict())
|
||||
# Copy it back to the original location
|
||||
shutil.copy("./" + filename, DEFAULT_AUDIO_FILE)
|
||||
#Import it again. It shouldn't overwrite the old file and instead create a new
|
||||
# Import it again. It shouldn't overwrite the old file and instead create a new
|
||||
metadata = dict()
|
||||
metadata = FileMoverAnalyzer.move(DEFAULT_AUDIO_FILE, u'.', filename, metadata)
|
||||
#Cleanup: move the file (eg. 44100Hz-16bit-mono.mp3) back
|
||||
metadata = FileMoverAnalyzer.move(DEFAULT_AUDIO_FILE, u".", filename, metadata)
|
||||
# Cleanup: move the file (eg. 44100Hz-16bit-mono.mp3) back
|
||||
shutil.move("./" + filename, DEFAULT_AUDIO_FILE)
|
||||
#Remove the renamed duplicate, eg. 44100Hz-16bit-mono_03-26-2014-11-58.mp3
|
||||
# Remove the renamed duplicate, eg. 44100Hz-16bit-mono_03-26-2014-11-58.mp3
|
||||
os.remove(metadata["full_path"])
|
||||
assert os.path.exists(DEFAULT_AUDIO_FILE)
|
||||
|
||||
''' If you import three copies of the same file, the behaviour is:
|
||||
|
||||
""" If you import three copies of the same file, the behaviour is:
|
||||
- The filename is of the first file preserved.
|
||||
- The filename of the second file has the timestamp attached to it.
|
||||
- The filename of the third file has a UUID placed after the timestamp, but ONLY IF
|
||||
it's imported within 1 second of the second file (ie. if the timestamp is the same).
|
||||
'''
|
||||
"""
|
||||
|
||||
|
||||
def test_double_duplicate_files():
|
||||
# Here we use mock to patch out the time.localtime() function so that it
|
||||
# always returns the same value. This allows us to consistently simulate this test cases
|
||||
# where the last two of the three files are imported at the same time as the timestamp.
|
||||
with mock.patch('airtime_analyzer.filemover_analyzer.time') as mock_time:
|
||||
mock_time.localtime.return_value = time.localtime()#date(2010, 10, 8)
|
||||
with mock.patch("airtime_analyzer.filemover_analyzer.time") as mock_time:
|
||||
mock_time.localtime.return_value = time.localtime() # date(2010, 10, 8)
|
||||
mock_time.side_effect = lambda *args, **kw: time(*args, **kw)
|
||||
|
||||
filename = os.path.basename(DEFAULT_AUDIO_FILE)
|
||||
#Import the file once
|
||||
FileMoverAnalyzer.move(DEFAULT_AUDIO_FILE, u'.', filename, dict())
|
||||
#Copy it back to the original location
|
||||
# Import the file once
|
||||
FileMoverAnalyzer.move(DEFAULT_AUDIO_FILE, u".", filename, dict())
|
||||
# Copy it back to the original location
|
||||
shutil.copy("./" + filename, DEFAULT_AUDIO_FILE)
|
||||
#Import it again. It shouldn't overwrite the old file and instead create a new
|
||||
# Import it again. It shouldn't overwrite the old file and instead create a new
|
||||
first_dup_metadata = dict()
|
||||
first_dup_metadata = FileMoverAnalyzer.move(DEFAULT_AUDIO_FILE, u'.', filename,
|
||||
first_dup_metadata)
|
||||
#Copy it back again!
|
||||
first_dup_metadata = FileMoverAnalyzer.move(
|
||||
DEFAULT_AUDIO_FILE, u".", filename, first_dup_metadata
|
||||
)
|
||||
# Copy it back again!
|
||||
shutil.copy("./" + filename, DEFAULT_AUDIO_FILE)
|
||||
#Reimport for the third time, which should have the same timestamp as the second one
|
||||
#thanks to us mocking out time.localtime()
|
||||
# Reimport for the third time, which should have the same timestamp as the second one
|
||||
# thanks to us mocking out time.localtime()
|
||||
second_dup_metadata = dict()
|
||||
second_dup_metadata = FileMoverAnalyzer.move(DEFAULT_AUDIO_FILE, u'.', filename,
|
||||
second_dup_metadata)
|
||||
#Cleanup: move the file (eg. 44100Hz-16bit-mono.mp3) back
|
||||
second_dup_metadata = FileMoverAnalyzer.move(
|
||||
DEFAULT_AUDIO_FILE, u".", filename, second_dup_metadata
|
||||
)
|
||||
# Cleanup: move the file (eg. 44100Hz-16bit-mono.mp3) back
|
||||
shutil.move("./" + filename, DEFAULT_AUDIO_FILE)
|
||||
#Remove the renamed duplicate, eg. 44100Hz-16bit-mono_03-26-2014-11-58.mp3
|
||||
# Remove the renamed duplicate, eg. 44100Hz-16bit-mono_03-26-2014-11-58.mp3
|
||||
os.remove(first_dup_metadata["full_path"])
|
||||
os.remove(second_dup_metadata["full_path"])
|
||||
assert os.path.exists(DEFAULT_AUDIO_FILE)
|
||||
|
||||
|
||||
@raises(OSError)
|
||||
def test_bad_permissions_destination_dir():
|
||||
filename = os.path.basename(DEFAULT_AUDIO_FILE)
|
||||
dest_dir = u'/sys/foobar' # /sys is using sysfs on Linux, which is unwritable
|
||||
dest_dir = u"/sys/foobar" # /sys is using sysfs on Linux, which is unwritable
|
||||
FileMoverAnalyzer.move(DEFAULT_AUDIO_FILE, dest_dir, filename, dict())
|
||||
#Move the file back
|
||||
# Move the file back
|
||||
shutil.move(os.path.join(dest_dir, filename), DEFAULT_AUDIO_FILE)
|
||||
assert os.path.exists(DEFAULT_AUDIO_FILE)
|
||||
|
||||
|
|
|
@ -6,78 +6,101 @@ import mock
|
|||
from nose.tools import *
|
||||
from airtime_analyzer.metadata_analyzer import MetadataAnalyzer
|
||||
|
||||
|
||||
def setup():
|
||||
pass
|
||||
|
||||
|
||||
def teardown():
|
||||
pass
|
||||
|
||||
|
||||
def check_default_metadata(metadata):
|
||||
assert metadata['track_title'] == 'Test Title'
|
||||
assert metadata['artist_name'] == 'Test Artist'
|
||||
assert metadata['album_title'] == 'Test Album'
|
||||
assert metadata['year'] == '1999'
|
||||
assert metadata['genre'] == 'Test Genre'
|
||||
assert metadata['track_number'] == '1'
|
||||
assert metadata["length"] == str(datetime.timedelta(seconds=metadata["length_seconds"]))
|
||||
assert metadata["track_title"] == "Test Title"
|
||||
assert metadata["artist_name"] == "Test Artist"
|
||||
assert metadata["album_title"] == "Test Album"
|
||||
assert metadata["year"] == "1999"
|
||||
assert metadata["genre"] == "Test Genre"
|
||||
assert metadata["track_number"] == "1"
|
||||
assert metadata["length"] == str(
|
||||
datetime.timedelta(seconds=metadata["length_seconds"])
|
||||
)
|
||||
|
||||
|
||||
def test_mp3_mono():
|
||||
metadata = MetadataAnalyzer.analyze('tests/test_data/44100Hz-16bit-mono.mp3', dict())
|
||||
metadata = MetadataAnalyzer.analyze(
|
||||
"tests/test_data/44100Hz-16bit-mono.mp3", dict()
|
||||
)
|
||||
check_default_metadata(metadata)
|
||||
assert metadata['channels'] == 1
|
||||
assert metadata['bit_rate'] == 63998
|
||||
assert abs(metadata['length_seconds'] - 3.9) < 0.1
|
||||
assert metadata['mime'] == 'audio/mp3' # Not unicode because MIMEs aren't.
|
||||
assert metadata['track_total'] == '10' # MP3s can have a track_total
|
||||
#Mutagen doesn't extract comments from mp3s it seems
|
||||
assert metadata["channels"] == 1
|
||||
assert metadata["bit_rate"] == 63998
|
||||
assert abs(metadata["length_seconds"] - 3.9) < 0.1
|
||||
assert metadata["mime"] == "audio/mp3" # Not unicode because MIMEs aren't.
|
||||
assert metadata["track_total"] == "10" # MP3s can have a track_total
|
||||
# Mutagen doesn't extract comments from mp3s it seems
|
||||
|
||||
|
||||
def test_mp3_jointstereo():
|
||||
metadata = MetadataAnalyzer.analyze('tests/test_data/44100Hz-16bit-jointstereo.mp3', dict())
|
||||
metadata = MetadataAnalyzer.analyze(
|
||||
"tests/test_data/44100Hz-16bit-jointstereo.mp3", dict()
|
||||
)
|
||||
check_default_metadata(metadata)
|
||||
assert metadata['channels'] == 2
|
||||
assert metadata['bit_rate'] == 127998
|
||||
assert abs(metadata['length_seconds'] - 3.9) < 0.1
|
||||
assert metadata['mime'] == 'audio/mp3'
|
||||
assert metadata['track_total'] == '10' # MP3s can have a track_total
|
||||
assert metadata["channels"] == 2
|
||||
assert metadata["bit_rate"] == 127998
|
||||
assert abs(metadata["length_seconds"] - 3.9) < 0.1
|
||||
assert metadata["mime"] == "audio/mp3"
|
||||
assert metadata["track_total"] == "10" # MP3s can have a track_total
|
||||
|
||||
|
||||
def test_mp3_simplestereo():
|
||||
metadata = MetadataAnalyzer.analyze('tests/test_data/44100Hz-16bit-simplestereo.mp3', dict())
|
||||
metadata = MetadataAnalyzer.analyze(
|
||||
"tests/test_data/44100Hz-16bit-simplestereo.mp3", dict()
|
||||
)
|
||||
check_default_metadata(metadata)
|
||||
assert metadata['channels'] == 2
|
||||
assert metadata['bit_rate'] == 127998
|
||||
assert abs(metadata['length_seconds'] - 3.9) < 0.1
|
||||
assert metadata['mime'] == 'audio/mp3'
|
||||
assert metadata['track_total'] == '10' # MP3s can have a track_total
|
||||
assert metadata["channels"] == 2
|
||||
assert metadata["bit_rate"] == 127998
|
||||
assert abs(metadata["length_seconds"] - 3.9) < 0.1
|
||||
assert metadata["mime"] == "audio/mp3"
|
||||
assert metadata["track_total"] == "10" # MP3s can have a track_total
|
||||
|
||||
|
||||
def test_mp3_dualmono():
|
||||
metadata = MetadataAnalyzer.analyze('tests/test_data/44100Hz-16bit-dualmono.mp3', dict())
|
||||
metadata = MetadataAnalyzer.analyze(
|
||||
"tests/test_data/44100Hz-16bit-dualmono.mp3", dict()
|
||||
)
|
||||
check_default_metadata(metadata)
|
||||
assert metadata['channels'] == 2
|
||||
assert metadata['bit_rate'] == 127998
|
||||
assert abs(metadata['length_seconds'] - 3.9) < 0.1
|
||||
assert metadata['mime'] == 'audio/mp3'
|
||||
assert metadata['track_total'] == '10' # MP3s can have a track_total
|
||||
assert metadata["channels"] == 2
|
||||
assert metadata["bit_rate"] == 127998
|
||||
assert abs(metadata["length_seconds"] - 3.9) < 0.1
|
||||
assert metadata["mime"] == "audio/mp3"
|
||||
assert metadata["track_total"] == "10" # MP3s can have a track_total
|
||||
|
||||
|
||||
def test_ogg_mono():
|
||||
metadata = MetadataAnalyzer.analyze('tests/test_data/44100Hz-16bit-mono.ogg', dict())
|
||||
metadata = MetadataAnalyzer.analyze(
|
||||
"tests/test_data/44100Hz-16bit-mono.ogg", dict()
|
||||
)
|
||||
check_default_metadata(metadata)
|
||||
assert metadata['channels'] == 1
|
||||
assert metadata['bit_rate'] == 80000
|
||||
assert abs(metadata['length_seconds'] - 3.8) < 0.1
|
||||
assert metadata['mime'] == 'audio/vorbis'
|
||||
assert metadata['comment'] == 'Test Comment'
|
||||
assert metadata["channels"] == 1
|
||||
assert metadata["bit_rate"] == 80000
|
||||
assert abs(metadata["length_seconds"] - 3.8) < 0.1
|
||||
assert metadata["mime"] == "audio/vorbis"
|
||||
assert metadata["comment"] == "Test Comment"
|
||||
|
||||
|
||||
def test_ogg_stereo():
|
||||
metadata = MetadataAnalyzer.analyze('tests/test_data/44100Hz-16bit-stereo.ogg', dict())
|
||||
metadata = MetadataAnalyzer.analyze(
|
||||
"tests/test_data/44100Hz-16bit-stereo.ogg", dict()
|
||||
)
|
||||
check_default_metadata(metadata)
|
||||
assert metadata['channels'] == 2
|
||||
assert metadata['bit_rate'] == 112000
|
||||
assert abs(metadata['length_seconds'] - 3.8) < 0.1
|
||||
assert metadata['mime'] == 'audio/vorbis'
|
||||
assert metadata['comment'] == 'Test Comment'
|
||||
assert metadata["channels"] == 2
|
||||
assert metadata["bit_rate"] == 112000
|
||||
assert abs(metadata["length_seconds"] - 3.8) < 0.1
|
||||
assert metadata["mime"] == "audio/vorbis"
|
||||
assert metadata["comment"] == "Test Comment"
|
||||
|
||||
''' faac and avconv can't seem to create a proper mono AAC file... ugh
|
||||
|
||||
""" faac and avconv can't seem to create a proper mono AAC file... ugh
|
||||
def test_aac_mono():
|
||||
metadata = MetadataAnalyzer.analyze('tests/test_data/44100Hz-16bit-mono.m4a')
|
||||
print("Mono AAC metadata:")
|
||||
|
@ -88,78 +111,93 @@ def test_aac_mono():
|
|||
assert abs(metadata['length_seconds'] - 3.8) < 0.1
|
||||
assert metadata['mime'] == 'audio/mp4'
|
||||
assert metadata['comment'] == 'Test Comment'
|
||||
'''
|
||||
"""
|
||||
|
||||
|
||||
def test_aac_stereo():
|
||||
metadata = MetadataAnalyzer.analyze('tests/test_data/44100Hz-16bit-stereo.m4a', dict())
|
||||
metadata = MetadataAnalyzer.analyze(
|
||||
"tests/test_data/44100Hz-16bit-stereo.m4a", dict()
|
||||
)
|
||||
check_default_metadata(metadata)
|
||||
assert metadata['channels'] == 2
|
||||
assert metadata['bit_rate'] == 102619
|
||||
assert abs(metadata['length_seconds'] - 3.8) < 0.1
|
||||
assert metadata['mime'] == 'audio/mp4'
|
||||
assert metadata['comment'] == 'Test Comment'
|
||||
assert metadata["channels"] == 2
|
||||
assert metadata["bit_rate"] == 102619
|
||||
assert abs(metadata["length_seconds"] - 3.8) < 0.1
|
||||
assert metadata["mime"] == "audio/mp4"
|
||||
assert metadata["comment"] == "Test Comment"
|
||||
|
||||
|
||||
def test_mp3_utf8():
|
||||
metadata = MetadataAnalyzer.analyze('tests/test_data/44100Hz-16bit-stereo-utf8.mp3', dict())
|
||||
metadata = MetadataAnalyzer.analyze(
|
||||
"tests/test_data/44100Hz-16bit-stereo-utf8.mp3", dict()
|
||||
)
|
||||
# Using a bunch of different UTF-8 codepages here. Test data is from:
|
||||
# http://winrus.com/utf8-jap.htm
|
||||
assert metadata['track_title'] == 'アイウエオカキクケコサシスセソタチツテ'
|
||||
assert metadata['artist_name'] == 'てすと'
|
||||
assert metadata['album_title'] == 'Ä ä Ü ü ß'
|
||||
assert metadata['year'] == '1999'
|
||||
assert metadata['genre'] == 'Я Б Г Д Ж Й'
|
||||
assert metadata['track_number'] == '1'
|
||||
assert metadata['channels'] == 2
|
||||
assert metadata['bit_rate'] < 130000
|
||||
assert metadata['bit_rate'] > 127000
|
||||
assert abs(metadata['length_seconds'] - 3.9) < 0.1
|
||||
assert metadata['mime'] == 'audio/mp3'
|
||||
assert metadata['track_total'] == '10' # MP3s can have a track_total
|
||||
assert metadata["track_title"] == "アイウエオカキクケコサシスセソタチツテ"
|
||||
assert metadata["artist_name"] == "てすと"
|
||||
assert metadata["album_title"] == "Ä ä Ü ü ß"
|
||||
assert metadata["year"] == "1999"
|
||||
assert metadata["genre"] == "Я Б Г Д Ж Й"
|
||||
assert metadata["track_number"] == "1"
|
||||
assert metadata["channels"] == 2
|
||||
assert metadata["bit_rate"] < 130000
|
||||
assert metadata["bit_rate"] > 127000
|
||||
assert abs(metadata["length_seconds"] - 3.9) < 0.1
|
||||
assert metadata["mime"] == "audio/mp3"
|
||||
assert metadata["track_total"] == "10" # MP3s can have a track_total
|
||||
|
||||
|
||||
def test_invalid_wma():
|
||||
metadata = MetadataAnalyzer.analyze('tests/test_data/44100Hz-16bit-stereo-invalid.wma', dict())
|
||||
assert metadata['mime'] == 'audio/x-ms-wma'
|
||||
metadata = MetadataAnalyzer.analyze(
|
||||
"tests/test_data/44100Hz-16bit-stereo-invalid.wma", dict()
|
||||
)
|
||||
assert metadata["mime"] == "audio/x-ms-wma"
|
||||
|
||||
|
||||
def test_wav_stereo():
|
||||
metadata = MetadataAnalyzer.analyze('tests/test_data/44100Hz-16bit-stereo.wav', dict())
|
||||
assert metadata['mime'] == 'audio/x-wav'
|
||||
assert abs(metadata['length_seconds'] - 3.9) < 0.1
|
||||
assert metadata['channels'] == 2
|
||||
assert metadata['sample_rate'] == 44100
|
||||
metadata = MetadataAnalyzer.analyze(
|
||||
"tests/test_data/44100Hz-16bit-stereo.wav", dict()
|
||||
)
|
||||
assert metadata["mime"] == "audio/x-wav"
|
||||
assert abs(metadata["length_seconds"] - 3.9) < 0.1
|
||||
assert metadata["channels"] == 2
|
||||
assert metadata["sample_rate"] == 44100
|
||||
|
||||
|
||||
# Make sure the parameter checking works
|
||||
@raises(FileNotFoundError)
|
||||
def test_move_wrong_string_param1():
|
||||
not_unicode = 'asdfasdf'
|
||||
not_unicode = "asdfasdf"
|
||||
MetadataAnalyzer.analyze(not_unicode, dict())
|
||||
|
||||
|
||||
@raises(TypeError)
|
||||
def test_move_wrong_metadata_dict():
|
||||
not_a_dict = list()
|
||||
MetadataAnalyzer.analyze('asdfasdf', not_a_dict)
|
||||
MetadataAnalyzer.analyze("asdfasdf", not_a_dict)
|
||||
|
||||
|
||||
# Test an mp3 file where the number of channels is invalid or missing:
|
||||
def test_mp3_bad_channels():
|
||||
filename = 'tests/test_data/44100Hz-16bit-mono.mp3'
|
||||
'''
|
||||
filename = "tests/test_data/44100Hz-16bit-mono.mp3"
|
||||
"""
|
||||
It'd be a pain in the ass to construct a real MP3 with an invalid number
|
||||
of channels by hand because that value is stored in every MP3 frame in the file
|
||||
'''
|
||||
"""
|
||||
audio_file = mutagen.File(filename, easy=True)
|
||||
audio_file.info.mode = 1777
|
||||
with mock.patch('airtime_analyzer.metadata_analyzer.mutagen') as mock_mutagen:
|
||||
with mock.patch("airtime_analyzer.metadata_analyzer.mutagen") as mock_mutagen:
|
||||
mock_mutagen.File.return_value = audio_file
|
||||
#mock_mutagen.side_effect = lambda *args, **kw: audio_file #File(*args, **kw)
|
||||
# mock_mutagen.side_effect = lambda *args, **kw: audio_file #File(*args, **kw)
|
||||
|
||||
metadata = MetadataAnalyzer.analyze(filename, dict())
|
||||
check_default_metadata(metadata)
|
||||
assert metadata['channels'] == 1
|
||||
assert metadata['bit_rate'] == 63998
|
||||
assert abs(metadata['length_seconds'] - 3.9) < 0.1
|
||||
assert metadata['mime'] == 'audio/mp3' # Not unicode because MIMEs aren't.
|
||||
assert metadata['track_total'] == '10' # MP3s can have a track_total
|
||||
#Mutagen doesn't extract comments from mp3s it seems
|
||||
assert metadata["channels"] == 1
|
||||
assert metadata["bit_rate"] == 63998
|
||||
assert abs(metadata["length_seconds"] - 3.9) < 0.1
|
||||
assert metadata["mime"] == "audio/mp3" # Not unicode because MIMEs aren't.
|
||||
assert metadata["track_total"] == "10" # MP3s can have a track_total
|
||||
# Mutagen doesn't extract comments from mp3s it seems
|
||||
|
||||
|
||||
def test_unparsable_file():
|
||||
MetadataAnalyzer.analyze('tests/test_data/unparsable.txt', dict())
|
||||
MetadataAnalyzer.analyze("tests/test_data/unparsable.txt", dict())
|
||||
|
|
|
@ -2,61 +2,97 @@
|
|||
from nose.tools import *
|
||||
from airtime_analyzer.playability_analyzer import *
|
||||
|
||||
|
||||
def check_default_metadata(metadata):
|
||||
''' Stub function for now in case we need it later.'''
|
||||
"""Stub function for now in case we need it later."""
|
||||
pass
|
||||
|
||||
|
||||
def test_missing_liquidsoap():
|
||||
old_ls = PlayabilityAnalyzer.LIQUIDSOAP_EXECUTABLE
|
||||
PlayabilityAnalyzer.LIQUIDSOAP_EXECUTABLE = 'foosdaf'
|
||||
metadata = PlayabilityAnalyzer.analyze(u'tests/test_data/44100Hz-16bit-stereo-utf8.mp3', dict())
|
||||
PlayabilityAnalyzer.LIQUIDSOAP_EXECUTABLE = old_ls # Need to put this back
|
||||
PlayabilityAnalyzer.LIQUIDSOAP_EXECUTABLE = "foosdaf"
|
||||
metadata = PlayabilityAnalyzer.analyze(
|
||||
u"tests/test_data/44100Hz-16bit-stereo-utf8.mp3", dict()
|
||||
)
|
||||
PlayabilityAnalyzer.LIQUIDSOAP_EXECUTABLE = old_ls # Need to put this back
|
||||
|
||||
|
||||
@raises(UnplayableFileError)
|
||||
def test_invalid_filepath():
|
||||
metadata = PlayabilityAnalyzer.analyze(u'non-existent-file', dict())
|
||||
metadata = PlayabilityAnalyzer.analyze(u"non-existent-file", dict())
|
||||
|
||||
|
||||
def test_mp3_utf8():
|
||||
metadata = PlayabilityAnalyzer.analyze(u'tests/test_data/44100Hz-16bit-stereo-utf8.mp3', dict())
|
||||
metadata = PlayabilityAnalyzer.analyze(
|
||||
u"tests/test_data/44100Hz-16bit-stereo-utf8.mp3", dict()
|
||||
)
|
||||
check_default_metadata(metadata)
|
||||
|
||||
|
||||
def test_mp3_dualmono():
|
||||
metadata = PlayabilityAnalyzer.analyze(u'tests/test_data/44100Hz-16bit-dualmono.mp3', dict())
|
||||
metadata = PlayabilityAnalyzer.analyze(
|
||||
u"tests/test_data/44100Hz-16bit-dualmono.mp3", dict()
|
||||
)
|
||||
check_default_metadata(metadata)
|
||||
|
||||
|
||||
def test_mp3_jointstereo():
|
||||
metadata = PlayabilityAnalyzer.analyze(u'tests/test_data/44100Hz-16bit-jointstereo.mp3', dict())
|
||||
metadata = PlayabilityAnalyzer.analyze(
|
||||
u"tests/test_data/44100Hz-16bit-jointstereo.mp3", dict()
|
||||
)
|
||||
check_default_metadata(metadata)
|
||||
|
||||
|
||||
def test_mp3_simplestereo():
|
||||
metadata = PlayabilityAnalyzer.analyze(u'tests/test_data/44100Hz-16bit-simplestereo.mp3', dict())
|
||||
metadata = PlayabilityAnalyzer.analyze(
|
||||
u"tests/test_data/44100Hz-16bit-simplestereo.mp3", dict()
|
||||
)
|
||||
check_default_metadata(metadata)
|
||||
|
||||
|
||||
def test_mp3_stereo():
|
||||
metadata = PlayabilityAnalyzer.analyze(u'tests/test_data/44100Hz-16bit-stereo.mp3', dict())
|
||||
metadata = PlayabilityAnalyzer.analyze(
|
||||
u"tests/test_data/44100Hz-16bit-stereo.mp3", dict()
|
||||
)
|
||||
check_default_metadata(metadata)
|
||||
|
||||
|
||||
def test_mp3_mono():
|
||||
metadata = PlayabilityAnalyzer.analyze(u'tests/test_data/44100Hz-16bit-mono.mp3', dict())
|
||||
metadata = PlayabilityAnalyzer.analyze(
|
||||
u"tests/test_data/44100Hz-16bit-mono.mp3", dict()
|
||||
)
|
||||
check_default_metadata(metadata)
|
||||
|
||||
|
||||
def test_ogg_stereo():
|
||||
metadata = PlayabilityAnalyzer.analyze(u'tests/test_data/44100Hz-16bit-stereo.ogg', dict())
|
||||
metadata = PlayabilityAnalyzer.analyze(
|
||||
u"tests/test_data/44100Hz-16bit-stereo.ogg", dict()
|
||||
)
|
||||
check_default_metadata(metadata)
|
||||
|
||||
|
||||
@raises(UnplayableFileError)
|
||||
def test_invalid_wma():
|
||||
metadata = PlayabilityAnalyzer.analyze(u'tests/test_data/44100Hz-16bit-stereo-invalid.wma', dict())
|
||||
metadata = PlayabilityAnalyzer.analyze(
|
||||
u"tests/test_data/44100Hz-16bit-stereo-invalid.wma", dict()
|
||||
)
|
||||
|
||||
|
||||
def test_m4a_stereo():
|
||||
metadata = PlayabilityAnalyzer.analyze(u'tests/test_data/44100Hz-16bit-stereo.m4a', dict())
|
||||
metadata = PlayabilityAnalyzer.analyze(
|
||||
u"tests/test_data/44100Hz-16bit-stereo.m4a", dict()
|
||||
)
|
||||
check_default_metadata(metadata)
|
||||
|
||||
|
||||
def test_wav_stereo():
|
||||
metadata = PlayabilityAnalyzer.analyze(u'tests/test_data/44100Hz-16bit-stereo.wav', dict())
|
||||
metadata = PlayabilityAnalyzer.analyze(
|
||||
u"tests/test_data/44100Hz-16bit-stereo.wav", dict()
|
||||
)
|
||||
check_default_metadata(metadata)
|
||||
|
||||
|
||||
@raises(UnplayableFileError)
|
||||
def test_unknown():
|
||||
metadata = PlayabilityAnalyzer.analyze(u'http://www.google.com', dict())
|
||||
check_default_metadata(metadata)
|
||||
metadata = PlayabilityAnalyzer.analyze(u"http://www.google.com", dict())
|
||||
check_default_metadata(metadata)
|
||||
|
|
|
@ -5,80 +5,134 @@ from airtime_analyzer.replaygain_analyzer import ReplayGainAnalyzer
|
|||
|
||||
|
||||
def check_default_metadata(metadata):
|
||||
''' Check that the values extract by Silan/CuePointAnalyzer on our test audio files match what we expect.
|
||||
"""Check that the values extract by Silan/CuePointAnalyzer on our test audio files match what we expect.
|
||||
:param metadata: a metadata dictionary
|
||||
:return: Nothing
|
||||
'''
|
||||
'''
|
||||
"""
|
||||
"""
|
||||
# We give python-rgain some leeway here by specifying a tolerance. It's not perfectly consistent across codecs...
|
||||
assert abs(metadata['cuein']) < tolerance_seconds
|
||||
assert abs(metadata['cueout'] - length_seconds) < tolerance_seconds
|
||||
'''
|
||||
"""
|
||||
tolerance = 0.60
|
||||
expected_replaygain = 5.2
|
||||
print(metadata['replay_gain'])
|
||||
assert abs(metadata['replay_gain'] - expected_replaygain) < tolerance
|
||||
print(metadata["replay_gain"])
|
||||
assert abs(metadata["replay_gain"] - expected_replaygain) < tolerance
|
||||
|
||||
|
||||
def test_missing_replaygain():
|
||||
old_rg = ReplayGainAnalyzer.REPLAYGAIN_EXECUTABLE
|
||||
ReplayGainAnalyzer.REPLAYGAIN_EXECUTABLE = 'foosdaf'
|
||||
metadata = ReplayGainAnalyzer.analyze(u'tests/test_data/44100Hz-16bit-stereo-utf8.mp3', dict())
|
||||
ReplayGainAnalyzer.REPLAYGAIN_EXECUTABLE = old_rg # Need to put this back
|
||||
ReplayGainAnalyzer.REPLAYGAIN_EXECUTABLE = "foosdaf"
|
||||
metadata = ReplayGainAnalyzer.analyze(
|
||||
u"tests/test_data/44100Hz-16bit-stereo-utf8.mp3", dict()
|
||||
)
|
||||
ReplayGainAnalyzer.REPLAYGAIN_EXECUTABLE = old_rg # Need to put this back
|
||||
|
||||
|
||||
def test_invalid_filepath():
|
||||
metadata = ReplayGainAnalyzer.analyze(u'non-existent-file', dict())
|
||||
metadata = ReplayGainAnalyzer.analyze(u"non-existent-file", dict())
|
||||
|
||||
|
||||
def test_mp3_utf8():
|
||||
metadata = ReplayGainAnalyzer.analyze(u'tests/test_data/44100Hz-16bit-stereo-utf8.mp3', dict())
|
||||
metadata = ReplayGainAnalyzer.analyze(
|
||||
u"tests/test_data/44100Hz-16bit-stereo-utf8.mp3", dict()
|
||||
)
|
||||
check_default_metadata(metadata)
|
||||
|
||||
|
||||
test_mp3_utf8.rgain = True
|
||||
|
||||
|
||||
def test_mp3_dualmono():
|
||||
metadata = ReplayGainAnalyzer.analyze(u'tests/test_data/44100Hz-16bit-dualmono.mp3', dict())
|
||||
metadata = ReplayGainAnalyzer.analyze(
|
||||
u"tests/test_data/44100Hz-16bit-dualmono.mp3", dict()
|
||||
)
|
||||
check_default_metadata(metadata)
|
||||
|
||||
|
||||
test_mp3_dualmono.rgain = True
|
||||
|
||||
|
||||
def test_mp3_jointstereo():
|
||||
metadata = ReplayGainAnalyzer.analyze(u'tests/test_data/44100Hz-16bit-jointstereo.mp3', dict())
|
||||
metadata = ReplayGainAnalyzer.analyze(
|
||||
u"tests/test_data/44100Hz-16bit-jointstereo.mp3", dict()
|
||||
)
|
||||
check_default_metadata(metadata)
|
||||
|
||||
|
||||
test_mp3_jointstereo.rgain = True
|
||||
|
||||
|
||||
def test_mp3_simplestereo():
|
||||
metadata = ReplayGainAnalyzer.analyze(u'tests/test_data/44100Hz-16bit-simplestereo.mp3', dict())
|
||||
metadata = ReplayGainAnalyzer.analyze(
|
||||
u"tests/test_data/44100Hz-16bit-simplestereo.mp3", dict()
|
||||
)
|
||||
check_default_metadata(metadata)
|
||||
|
||||
|
||||
test_mp3_simplestereo.rgain = True
|
||||
|
||||
|
||||
def test_mp3_stereo():
|
||||
metadata = ReplayGainAnalyzer.analyze(u'tests/test_data/44100Hz-16bit-stereo.mp3', dict())
|
||||
metadata = ReplayGainAnalyzer.analyze(
|
||||
u"tests/test_data/44100Hz-16bit-stereo.mp3", dict()
|
||||
)
|
||||
check_default_metadata(metadata)
|
||||
|
||||
|
||||
test_mp3_stereo.rgain = True
|
||||
|
||||
|
||||
def test_mp3_mono():
|
||||
metadata = ReplayGainAnalyzer.analyze(u'tests/test_data/44100Hz-16bit-mono.mp3', dict())
|
||||
metadata = ReplayGainAnalyzer.analyze(
|
||||
u"tests/test_data/44100Hz-16bit-mono.mp3", dict()
|
||||
)
|
||||
check_default_metadata(metadata)
|
||||
|
||||
|
||||
test_mp3_mono.rgain = True
|
||||
|
||||
|
||||
def test_ogg_stereo():
|
||||
metadata = ReplayGainAnalyzer.analyze(u'tests/test_data/44100Hz-16bit-stereo.ogg', dict())
|
||||
metadata = ReplayGainAnalyzer.analyze(
|
||||
u"tests/test_data/44100Hz-16bit-stereo.ogg", dict()
|
||||
)
|
||||
check_default_metadata(metadata)
|
||||
|
||||
|
||||
test_ogg_stereo = True
|
||||
|
||||
|
||||
def test_invalid_wma():
|
||||
metadata = ReplayGainAnalyzer.analyze(u'tests/test_data/44100Hz-16bit-stereo-invalid.wma', dict())
|
||||
metadata = ReplayGainAnalyzer.analyze(
|
||||
u"tests/test_data/44100Hz-16bit-stereo-invalid.wma", dict()
|
||||
)
|
||||
|
||||
|
||||
test_invalid_wma.rgain = True
|
||||
|
||||
|
||||
def test_mp3_missing_id3_header():
|
||||
metadata = ReplayGainAnalyzer.analyze(u'tests/test_data/44100Hz-16bit-mp3-missingid3header.mp3', dict())
|
||||
metadata = ReplayGainAnalyzer.analyze(
|
||||
u"tests/test_data/44100Hz-16bit-mp3-missingid3header.mp3", dict()
|
||||
)
|
||||
|
||||
|
||||
test_mp3_missing_id3_header.rgain = True
|
||||
|
||||
|
||||
def test_m4a_stereo():
|
||||
metadata = ReplayGainAnalyzer.analyze(u'tests/test_data/44100Hz-16bit-stereo.m4a', dict())
|
||||
metadata = ReplayGainAnalyzer.analyze(
|
||||
u"tests/test_data/44100Hz-16bit-stereo.m4a", dict()
|
||||
)
|
||||
check_default_metadata(metadata)
|
||||
|
||||
|
||||
test_m4a_stereo.rgain = True
|
||||
|
||||
''' WAVE is not supported by python-rgain yet
|
||||
""" WAVE is not supported by python-rgain yet
|
||||
def test_wav_stereo():
|
||||
metadata = ReplayGainAnalyzer.analyze(u'tests/test_data/44100Hz-16bit-stereo.wav', dict())
|
||||
check_default_metadata(metadata)
|
||||
test_wav_stereo.rgain = True
|
||||
'''
|
||||
"""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue