Convert used to split the user command at whitespaces and pass it to `Popen`.
This approach is to naive, it also was not consistent with output from the
logs. Instead we pass the whole command to a subshell.
* `encode()` raises an error when the command returns with non-zero exit
status. We catch that in the higher-level conversion functions and skip to
the next item without writing tags.
* Simplified the handling of the `keep_new` flag.
Symmetrical to item.read(), this allows us to update the tags of files that are
not in the library. The motivation was this issue [1].
The commit also includes a nasty hack in the plugin code that prevents breaking
other plugins.
[1]: https://github.com/geigerzaehler/beets-check/issues/1
These config options make it easier to customize the command (no need to make
a single-element formats dict). And the opt config option provides backwards
compatibility with the previous style.
The format key is now the (lower-cased) format name string used by beets,
which means we can precisely detect which transcodes would be unnecessary. To
facilitate this, I added an ALIASES dict which allows more convenient names to
work for this (e.g., "wma" is easier to remember than "windows media").
This avoids naming conflicts in the source directory. In particular, when
encoding MP3 -> MP3, the previous scheme would overwrite the original file
(and hang ffmpeg waiting for input). This should also work in
situations where the source directory is read-only.
I introduced a regression a few commits ago when I started using
lib.destination with the basedir keyword argument as opposed to doing
os.path.join manually.
The major functional change here is how files move around when in keep_new
mode. Now, files are first moved to the destination directory and then
copied/transcoded back into the library.
This avoids problems where naming conflicts could occur when transcoding from
MP3 to MP3 (and thus not changing the filename).