mirror of
https://github.com/beetbox/beets.git
synced 2025-12-30 04:22:40 +01:00
convert: Add some comments
This commit is contained in:
parent
5f5a8946c3
commit
c617033476
1 changed files with 8 additions and 1 deletions
|
|
@ -396,15 +396,22 @@ class ConvertPlugin(BeetsPlugin):
|
|||
fmt = self.config['format'].get(unicode).lower()
|
||||
if should_transcode(item, fmt):
|
||||
command, ext = get_format()
|
||||
|
||||
# Create a temporary file for the conversion.
|
||||
tmpdir = self.config['tmpdir'].get()
|
||||
fd, dest = tempfile.mkstemp('.' + ext, dir=tmpdir)
|
||||
dest = util.bytestring_path(dest)
|
||||
os.close(fd)
|
||||
dest = util.bytestring_path(dest)
|
||||
_temp_files.append(dest) # Delete the transcode later.
|
||||
|
||||
# Convert.
|
||||
try:
|
||||
self.encode(command, item.path, dest)
|
||||
except subprocess.CalledProcessError:
|
||||
return
|
||||
|
||||
# Change the newly-imported database entry to point to the
|
||||
# converted file.
|
||||
item.path = dest
|
||||
item.write()
|
||||
item.read() # Load new audio information data.
|
||||
|
|
|
|||
Loading…
Reference in a new issue