From ddca1b2e13e4ab682be9360c125ee41f203e5bad Mon Sep 17 00:00:00 2001 From: Mara Kim Date: Fri, 27 Mar 2015 01:40:43 -0500 Subject: [PATCH] Add 'tmpdir' option to convert plugin Closes sampsyo/beets#1382 Add tmpdir setting document tmpdir setting --- beetsplug/convert.py | 4 +++- docs/plugins/convert.rst | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/beetsplug/convert.py b/beetsplug/convert.py index 0cce93f7ac..38191d79cf 100644 --- a/beetsplug/convert.py +++ b/beetsplug/convert.py @@ -125,6 +125,7 @@ def __init__(self): }, u'max_bitrate': 500, u'auto': False, + u'tmpdir': None, u'quiet': False, u'embed': True, u'paths': {}, @@ -388,7 +389,8 @@ def convert_on_import(self, lib, item): fmt = self.config['format'].get(unicode).lower() if should_transcode(item, fmt): command, ext = get_format() - fd, dest = tempfile.mkstemp('.' + ext) + tmpdir = self.config['tmpdir'].get() + fd, dest = tempfile.mkstemp('.' + ext, dir=tmpdir) os.close(fd) _temp_files.append(dest) # Delete the transcode later. try: diff --git a/docs/plugins/convert.rst b/docs/plugins/convert.rst index 751c4d637c..7480bacbb7 100644 --- a/docs/plugins/convert.rst +++ b/docs/plugins/convert.rst @@ -58,6 +58,8 @@ file. The available options are: default configuration) non-MP3 files over the maximum bitrate before adding them to your library. Default: ``no``. +- **tmpdir**: The directory where temporary files will be stored during import. + Default: none (system default), - **copy_album_art**: Copy album art when copying or transcoding albums matched using the ``-a`` option. Default: ``no``. - **dest**: The directory where the files will be converted (or copied) to.