From 3e55ac75a8accfca0e7f9015a2a0675ae234c0c8 Mon Sep 17 00:00:00 2001 From: Ramiro Morales Date: Wed, 18 Jan 2017 16:59:02 -0300 Subject: [PATCH] Also handle .ssa, .sub & .idx when fixing filenames --- service.py | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/service.py b/service.py index 5e9070c..f3b5891 100644 --- a/service.py +++ b/service.py @@ -428,15 +428,16 @@ def _double_dot_fix_hack(video_filename): parts = work_path.rsplit('.', 1) if len(parts) > 1: rest = parts[0] - bad = rest + '..' + 'srt' - old = rest + '.es.' + 'srt' - if xbmcvfs.exists(bad): - log(u"%s exists" % bad) - if xbmcvfs.exists(old): - log(u"%s exists, removing" % old) - xbmcvfs.delete(old) - log(u"renaming %s to %s" % (bad, old)) - xbmcvfs.rename(bad, old) + for ext in ('srt', 'ssa', 'sub', 'idx'): + bad = rest + '..' + ext + old = rest + '.es.' + ext + if xbmcvfs.exists(bad): + log(u"%s exists" % bad) + if xbmcvfs.exists(old): + log(u"%s exists, removing" % old) + xbmcvfs.delete(old) + log(u"renaming %s to %s" % (bad, old)) + xbmcvfs.rename(bad, old) def _subtitles_setting(name):