From 90a1b3fe7a187972acbc8bdc140261f5d654b62e Mon Sep 17 00:00:00 2001 From: gogozs Date: Sun, 27 Jul 2014 22:26:42 +0800 Subject: [PATCH 1/2] remove ass effects end with '}' MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 有些 ass 特效不能清除干净,他们都是以 ‘}’ 字符结尾。详见http://cl.ly/image/0t0C1y381r1f --- asstosrt/__init__.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/asstosrt/__init__.py b/asstosrt/__init__.py index a7c2a25..1b6b0ad 100644 --- a/asstosrt/__init__.py +++ b/asstosrt/__init__.py @@ -117,6 +117,8 @@ def convert(file, translator=None, no_effect=False, only_first_line=False): break # Events ended. elif not line.startswith('Dialogue:'): continue + elif line.endswith('}'): + continue dialogue = formater.format(line) if dialogue['end'] - dialogue['start'] < 0.2: From 4d8821328ec94afb9d2680591f9194b8f48732cd Mon Sep 17 00:00:00 2001 From: gogozs Date: Mon, 28 Jul 2014 10:27:27 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=89=B9=E6=95=88?= =?UTF-8?q?=E8=AF=86=E5=88=AB=E5=AD=97=E7=AC=A6=E4=B8=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- asstosrt/__init__.py | 4 +--- batch.py | 0 2 files changed, 1 insertion(+), 3 deletions(-) mode change 100644 => 100755 batch.py diff --git a/asstosrt/__init__.py b/asstosrt/__init__.py index 1b6b0ad..3fc5e17 100644 --- a/asstosrt/__init__.py +++ b/asstosrt/__init__.py @@ -78,7 +78,7 @@ def __unicode__(self): def _preprocess_line(line): """Remove line endings and comments.""" line = line.strip() - if line.startswith(';'): + if line.startswith(';') | line.endswith('{\p0}'): return '' else: return line @@ -117,8 +117,6 @@ def convert(file, translator=None, no_effect=False, only_first_line=False): break # Events ended. elif not line.startswith('Dialogue:'): continue - elif line.endswith('}'): - continue dialogue = formater.format(line) if dialogue['end'] - dialogue['start'] < 0.2: diff --git a/batch.py b/batch.py old mode 100644 new mode 100755