mirror of
https://github.com/beetbox/beets.git
synced 2026-02-19 13:56:22 +01:00
echonest: test conversion failure
This commit is contained in:
parent
c248a71494
commit
66b81ed081
2 changed files with 20 additions and 2 deletions
|
|
@ -267,7 +267,7 @@ class EchonestMetadataPlugin(plugins.BeetsPlugin):
|
|||
if item.format not in ALLOWED_FORMATS:
|
||||
if config['echonest']['convert']:
|
||||
tmp = source = self.convert(source)
|
||||
else:
|
||||
if not tmp:
|
||||
return
|
||||
|
||||
if os.stat(source).st_size > UPLOAD_MAX_SIZE:
|
||||
|
|
@ -279,7 +279,8 @@ class EchonestMetadataPlugin(plugins.BeetsPlugin):
|
|||
else:
|
||||
return
|
||||
|
||||
return (source, tmp)
|
||||
if source:
|
||||
return (source, tmp)
|
||||
|
||||
def convert(self, source):
|
||||
"""Converts an item in an unsupported media format to ogg. Config
|
||||
|
|
|
|||
|
|
@ -106,6 +106,23 @@ class EchonestCliTest(unittest.TestCase, TestHelper):
|
|||
self.assertNotEqual(item.path,
|
||||
echonest_track.call_args[1]['filename'])
|
||||
|
||||
@patch('pyechonest.song.profile')
|
||||
@patch('pyechonest.song.search')
|
||||
@patch('pyechonest.track.track_from_filename')
|
||||
@patch('beetsplug.echonest.CONVERT_COMMAND', 'false')
|
||||
def test_analyze_convert_fail(self, echonest_track, echonest_search,
|
||||
echonest_profile):
|
||||
item = self.add_item(title='title', length=10, format='FLAC',
|
||||
path=os.path.join(RSRC, 'min.flac'))
|
||||
echonest_search.return_value = []
|
||||
echonest_profile.return_value = [self.profile(item, energy=0.2)]
|
||||
echonest_track.return_value = self.track(item)
|
||||
|
||||
self.run_command('echonest')
|
||||
item.load()
|
||||
self.assertNotIn('energy', item)
|
||||
self.assertEqual(0, echonest_track.call_count)
|
||||
|
||||
@patch('pyechonest.song.profile')
|
||||
@patch('pyechonest.song.search')
|
||||
@patch('pyechonest.track.track_from_filename')
|
||||
|
|
|
|||
Loading…
Reference in a new issue