Echonest conversion command: only use byte strings

Temp file name was unicode, so if other parts of the command were
utf8-encoded non-ascii strings the command would fail (in
beets.util.command_output()). Requesting a temp file with a byte string
path fixes the issue.

Fix #1407.
This commit is contained in:
Bruno Cauet 2015-04-09 18:02:06 +02:00
parent 7ac6ba53ff
commit 882844bc77
2 changed files with 7 additions and 1 deletions

View file

@ -289,7 +289,7 @@ class EchonestMetadataPlugin(plugins.BeetsPlugin):
pending.
This is stolen from Jakob Schnitzers convert plugin.
"""
fd, dest = tempfile.mkstemp(u'.ogg')
fd, dest = tempfile.mkstemp(b'.ogg')
os.close(fd)
self._log.info(u'encoding {0} to {1}',

View file

@ -109,6 +109,12 @@ class EchonestCliTest(unittest.TestCase, TestHelper):
self.assertNotEqual(item.path,
echonest_track.call_args[1]['filename'])
@patch('pyechonest.song.search')
@patch('beetsplug.echonest.CONVERT_COMMAND', 'cp $source $dest')
def test_analyze_convert2(self, echonest_search):
self.add_item(format='FLAC', path=b'm\xc3\xacn.flac')
self.run_command('echonest')
@patch('pyechonest.song.profile')
@patch('pyechonest.song.search')
@patch('pyechonest.track.track_from_filename')