Repository: beetbox/beets

Issue:
convert: In `auto` mode, respect `import.move` by deleting old files
The relevant parts of my config:
```
import:
    move: yes

plugins: convert

convert:
    auto: yes
    max_bitrate: 192
    format: mp3
```
If the imported mp3 file has a bitrate under 192 it gets moved unconverted as desired.
If it's higher than that the old file remains inside the source folder after the successful conversion and the new file get's copied to the destination folder. It acts like the copy flag. The output shows:

> convert: Encoding D:\Test\Test.mp3
> convert: Finished encoding D:\Test\Test.mp3


Discussion:
Interesting point! This does seem wrong. For consistency, would you want transcoded files to have their originals deleted—so that the importer always appears to “move” the files?
Absolutely! You could add an plugin option to ignore the global flag but otherwise it should definitely prioritize the global import settings.
Sounds good; thanks for clarifying!
+1 to this feature request!

Better yet, instead of just deleting the source files, providing the option to move the source files to another dir would be excellent. So I can still have the sources around if needed, but they would be moved out of my "Things to process" dir.
Has there been any news about this feature request? I'm facing the same issue
Just here to add my +1 to this feature request.
+1 
By default it would be expected to respect copy/move global flags with option to overwrite it and i.e. copy to a different folder with something like "paths_source:" option, where i.e. FLAC files could be moved to i.e. [FLAC] flagged folder respecting beets variables.
+1
+1

Resolving patch:
diff --git a/beetsplug/convert.py b/beetsplug/convert.py
--- a/beetsplug/convert.py
+++ b/beetsplug/convert.py
@@ -148,6 +148,7 @@ def __init__(self):
             u'never_convert_lossy_files': False,
             u'copy_album_art': False,
             u'album_art_maxwidth': 0,
+            u'delete_originals': False,
         })
         self.early_import_stages = [self.auto_convert]
 
@@ -532,11 +533,16 @@ def convert_on_import(self, lib, item):
 
             # 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.info(u'Removing original file {0}', source_path)
+                util.remove(source_path, False)
+
     def _cleanup(self, task, session):
         for path in task.old_paths:
             if path in _temp_files:


Test patch:
diff --git a/test/test_convert.py b/test/test_convert.py
--- a/test/test_convert.py
+++ b/test/test_convert.py
@@ -15,6 +15,7 @@
 
 from __future__ import division, absolute_import, print_function
 
+import fnmatch
 import sys
 import re
 import os.path
@@ -121,6 +122,15 @@ def test_import_original_on_convert_error(self):
         self.assertIsNotNone(item)
         self.assertTrue(os.path.isfile(item.path))
 
+    def test_delete_originals(self):
+        self.config['convert']['delete_originals'] = True
+        self.importer.run()
+        for path in self.importer.paths:
+            for root, dirnames, filenames in os.walk(path):
+                self.assertTrue(len(fnmatch.filter(filenames, '*.mp3')) == 0,
+                                u'Non-empty import directory {0}'
+                                .format(util.displayable_path(path)))
+
 
 class ConvertCommand(object):
     """A mixin providing a utility method to run the `convert`command