From 26f5ce9235e8b9afd1e28cb232885502cb9c7b99 Mon Sep 17 00:00:00 2001 From: Michael Johnson Date: Fri, 31 May 2013 07:42:25 -0300 Subject: [PATCH] Attempt to remove transcoding target before calling ffmpeg --- autoProcess/Transcoder.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/autoProcess/Transcoder.py b/autoProcess/Transcoder.py index d38b1e1c..b5e98973 100644 --- a/autoProcess/Transcoder.py +++ b/autoProcess/Transcoder.py @@ -107,6 +107,14 @@ def Transcode_directory(dirName): else: command.append('-sn') # Don't copy the subtitles over command.append(newfilePath) + + try: # Try to remove the file that we're transcoding to just in case. (ffmpeg will return an error if it already exists for some reason) + os.remove(newFilePath) + except OSError, e: + if e.errno != errno.ENOENT: # Ignore the error if it's just telling us that the file doesn't exist + Logger.debug("Error when removing transcoding target: %s", e) + except Exception, e: + Logger.debug("Error when removing transcoding target: %s", e) Logger.info("Transcoding video: %s", file) result = 1 # set result to failed in case call fails.