diff --git a/beetsplug/convert.py b/beetsplug/convert.py index 82e62af62e..63bfea9b34 100644 --- a/beetsplug/convert.py +++ b/beetsplug/convert.py @@ -22,6 +22,7 @@ import tempfile import shlex from string import Template +import logging from beets import ui, util, plugins, config from beets.plugins import BeetsPlugin @@ -514,23 +515,21 @@ def convert_on_import(self, lib, item): except subprocess.CalledProcessError: return - pretend = self.config['pretend'].get(bool) - quiet = self.config['quiet'].get(bool) - - if not pretend: - # Change the newly-imported database entry to point to the - # converted file. - source_path = item.path - item.path = dest - item.write() - item.read() # Load new audio information data. - item.store() - - if self.config['delete_originals']: - if not quiet: - self._log.info('Removing original file {0}', - source_path) - util.remove(source_path, False) + # Change the newly-imported database entry to point to the + # converted file. + source_path = item.path + item.path = dest + item.write() + item.read() # Load new audio information data. + item.store() + + if self.config['delete_originals']: + self._log.log( + logging.DEBUG if self.config['quiet'] else logging.INFO, + 'Removing original file {0}', + source_path, + ) + util.remove(source_path, False) def _cleanup(self, task, session): for path in task.old_paths: diff --git a/docs/changelog.rst b/docs/changelog.rst index 6d631ebbd5..a28a992b92 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -32,8 +32,6 @@ Bug fixes: * Fix a regression in the previous release that caused a `TypeError` when moving files across filesystems. :bug:`4168` -* :doc:`/plugins/convert`: Files are no longer converted when running import in - ``--pretend`` mode. * :doc:`/plugins/convert`: Deleting the original files during conversion no longer logs output when the ``quiet`` flag is enabled. * :doc:`plugins/web`: Fix handling of "query" requests. Previously queries diff --git a/test/test_convert.py b/test/test_convert.py index 493d4ecca9..cd32e34b1f 100644 --- a/test/test_convert.py +++ b/test/test_convert.py @@ -127,16 +127,6 @@ def test_delete_originals(self): 'Non-empty import directory {}' .format(util.displayable_path(path))) - def test_delete_originals_keeps_originals_when_pretend_enabled(self): - import_file_count = self.get_count_of_import_files() - - self.config['convert']['delete_originals'] = True - self.config['convert']['pretend'] = True - self.importer.run() - - self.assertEqual(self.get_count_of_import_files(), import_file_count, - 'Count of files differs after running import') - def get_count_of_import_files(self): import_file_count = 0