diff --git a/source/detect_audio_language/changelog.md b/source/detect_audio_language/changelog.md
index dbf7184db..92e3b5236 100644
--- a/source/detect_audio_language/changelog.md
+++ b/source/detect_audio_language/changelog.md
@@ -1,4 +1,7 @@
+**0.0.7**
+- add code to explicitly remove temp wav files as on some systems shutil.rmtree throws an exception if non-empty directory
+
**0.0.6**
- attribution to OpenAI Whisper Module
- addition of OpenAI Whisper License
diff --git a/source/detect_audio_language/info.json b/source/detect_audio_language/info.json
index 39e4c7f25..400c97546 100644
--- a/source/detect_audio_language/info.json
+++ b/source/detect_audio_language/info.json
@@ -16,5 +16,5 @@
"on_worker_process": 1
},
"tags": "audio",
- "version": "0.0.6"
+ "version": "0.0.7"
}
diff --git a/source/detect_audio_language/plugin.py b/source/detect_audio_language/plugin.py
index fd4cb12b2..ffa51be28 100644
--- a/source/detect_audio_language/plugin.py
+++ b/source/detect_audio_language/plugin.py
@@ -35,6 +35,8 @@
import random
import moviepy.editor as mp
import shutil
+import os
+import glob
from unmanic.libs.unplugins.settings import PluginSettings
@@ -142,7 +144,10 @@ def tag_streams(astreams, vid_file):
else:
logger.error("Language not successfully identified for audio stream '{}' of file '{}', so skipping stream".format(astream, vid_file))
- shutil.rmtree(dir)
+ for f in glob.glob(dir + "/*.wav"):
+ os.remove(f)
+
+ shutil.rmtree(dir, ignore_errors=True)
return tag_args
def detect_language(video_file, tmp_dir):