Lucas Duailibe committed 5b493cb

clean up old files and remove pdb

Comments (0)

Files changed (1)


 import logging
 import os
 import threading
-import pdb
 from subprocess import Popen
 from beets.plugins import BeetsPlugin
 log = logging.getLogger('beets')
 DEVNULL = open(os.devnull, 'wb')
 _fs_lock = threading.Lock()
+_convert_tmp = []
 def _destination(lib, dest_dir, item, keep_new):
     if item.format != 'MP3' or item.bitrate >= 1000 * maxbr:
         # Transcoding necessary
         dest = os.path.splitext(item.path)[0] + '.mp3'
+        _convert_tmp.append(dest)
         encode(item.path, dest)
         item.path = dest
     def auto_convert(self, config, task):
         if self.config['auto_convert'].get():
-            pdb.set_trace()
             if not task.is_album:
                 convert_on_import(config.lib, task.item)
                 for item in task.items:
                     convert_on_import(config.lib, item)
+def _cleanup(task, session):
+    for path in task.old_paths:
+        if path in _convert_tmp and os.path.isfile(path):
+            util.remove(path)
+            _convert_tmp.remove(path)