From 088cdfe995c14927bfa277edd9663c0cb79bad78 Mon Sep 17 00:00:00 2001 From: Adrian Sampson Date: Sat, 29 Jan 2022 18:31:48 -0500 Subject: [PATCH 1/3] Revert some of #4226 Rectify a couple of things in that PR, pointed out here: https://github.com/beetbox/beets/pull/4226#issuecomment-1011499620 - Undo the `pretend` sensitivity in the import path, because it's not clear how this setting could ever be true. - Preserve the log message in debug mode, even when quiet. --- beetsplug/convert.py | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/beetsplug/convert.py b/beetsplug/convert.py index 82e62af62..63bfea9b3 100644 --- a/beetsplug/convert.py +++ b/beetsplug/convert.py @@ -22,6 +22,7 @@ import subprocess 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 @@ class ConvertPlugin(BeetsPlugin): except subprocess.CalledProcessError: return - pretend = self.config['pretend'].get(bool) - quiet = self.config['quiet'].get(bool) + # 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 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) + 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: From 0788197c7665387774d62570ec7367215054cc43 Mon Sep 17 00:00:00 2001 From: Adrian Sampson Date: Sat, 29 Jan 2022 18:33:10 -0500 Subject: [PATCH 2/3] Remove a relevant changelog entry --- docs/changelog.rst | 2 -- 1 file changed, 2 deletions(-) diff --git a/docs/changelog.rst b/docs/changelog.rst index 6d631ebbd..a28a992b9 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 From 2b51b2443b68feafb12511bca2d7611db555922b Mon Sep 17 00:00:00 2001 From: Adrian Sampson Date: Sat, 29 Jan 2022 18:35:36 -0500 Subject: [PATCH 3/3] Remove a relevant test --- test/test_convert.py | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/test/test_convert.py b/test/test_convert.py index 493d4ecca..cd32e34b1 100644 --- a/test/test_convert.py +++ b/test/test_convert.py @@ -127,16 +127,6 @@ class ImportConvertTest(unittest.TestCase, TestHelper): '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