mirror of https://github.com/morpheus65535/bazarr
Implemented garbage collection after each subtitles synchronization.
This commit is contained in:
parent
c23ce4a4d1
commit
0a0f609de8
|
@ -1,5 +1,6 @@
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
|
import gc
|
||||||
from ffsubsync.ffsubsync import run, make_parser
|
from ffsubsync.ffsubsync import run, make_parser
|
||||||
from utils import get_binary
|
from utils import get_binary
|
||||||
from utils import history_log, history_log_movie
|
from utils import history_log, history_log_movie
|
||||||
|
@ -53,12 +54,18 @@ class SubSyncer:
|
||||||
unparsed_args.append('--make-test-case')
|
unparsed_args.append('--make-test-case')
|
||||||
parser = make_parser()
|
parser = make_parser()
|
||||||
self.args = parser.parse_args(args=unparsed_args)
|
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)
|
result = run(self.args)
|
||||||
except Exception:
|
except Exception:
|
||||||
logging.exception('BAZARR an exception occurs during the synchronization process for this subtitles: '
|
logging.exception('BAZARR an exception occurs during the synchronization process for this subtitles: '
|
||||||
'{0}'.format(self.srtin))
|
'{0}'.format(self.srtin))
|
||||||
|
gc.collect()
|
||||||
|
return
|
||||||
else:
|
else:
|
||||||
if settings.subsync.getboolean('debug'):
|
if settings.subsync.getboolean('debug'):
|
||||||
|
gc.collect()
|
||||||
return result
|
return result
|
||||||
if os.path.isfile(self.srtout):
|
if os.path.isfile(self.srtout):
|
||||||
if not settings.subsync.getboolean('debug'):
|
if not settings.subsync.getboolean('debug'):
|
||||||
|
@ -82,6 +89,8 @@ class SubSyncer:
|
||||||
else:
|
else:
|
||||||
logging.error('BAZARR unable to sync subtitles: {0}'.format(self.srtin))
|
logging.error('BAZARR unable to sync subtitles: {0}'.format(self.srtin))
|
||||||
|
|
||||||
|
gc.collect()
|
||||||
|
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue