summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authormorpheus65535 <[email protected]>2022-02-23 22:02:01 -0500
committermorpheus65535 <[email protected]>2022-02-23 22:02:01 -0500
commit0a0f609de89d2d93d594067f9c803f9449b89071 (patch)
treedcd51f6e0cb0baba665c0a1515a954aea3671ee3
parentc23ce4a4d1929f9b007b64e81f21fcf881e041fb (diff)
downloadbazarr-0a0f609de89d2d93d594067f9c803f9449b89071.tar.gz
bazarr-0a0f609de89d2d93d594067f9c803f9449b89071.zip
Implemented garbage collection after each subtitles synchronization.v1.0.3-beta.33
-rw-r--r--bazarr/subsyncer.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/bazarr/subsyncer.py b/bazarr/subsyncer.py
index 05d27e9dc..a9893b4c5 100644
--- a/bazarr/subsyncer.py
+++ b/bazarr/subsyncer.py
@@ -1,5 +1,6 @@
import logging
import os
+import gc
from ffsubsync.ffsubsync import run, make_parser
from utils import get_binary
from utils import history_log, history_log_movie
@@ -53,12 +54,18 @@ class SubSyncer:
unparsed_args.append('--make-test-case')
parser = make_parser()
self.args = parser.parse_args(args=unparsed_args)
+ if os.path.isfile(self.srtout):
+ os.remove(self.srtout)
+ logging.debug('BAZARR deleted the previous subtitles synchronization attempt file.')
result = run(self.args)
except Exception:
logging.exception('BAZARR an exception occurs during the synchronization process for this subtitles: '
'{0}'.format(self.srtin))
+ gc.collect()
+ return
else:
if settings.subsync.getboolean('debug'):
+ gc.collect()
return result
if os.path.isfile(self.srtout):
if not settings.subsync.getboolean('debug'):
@@ -82,6 +89,8 @@ class SubSyncer:
else:
logging.error('BAZARR unable to sync subtitles: {0}'.format(self.srtin))
+ gc.collect()
+
return result