From a80b5f2df34f6f7d302092109b217afa09ce6186 Mon Sep 17 00:00:00 2001 From: Star Brilliant Date: Sat, 16 Nov 2013 22:17:48 +0800 Subject: [PATCH] Treat reversed comments as ordinary comments --- danmaku2ass.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/danmaku2ass.py b/danmaku2ass.py index 6d5cd9e..b582aca 100755 --- a/danmaku2ass.py +++ b/danmaku2ass.py @@ -150,11 +150,11 @@ def ReadCommentsBilibili(f, fontsize): try: p = str(comment.getAttribute('p')).split(',') assert len(p) >= 5 - assert p[1] in ('1', '4', '5', '7') + assert p[1] in ('1', '4', '5', '6', '7') if p[1] != '7': c = str(comment.childNodes[0].wholeText).replace('/n', '\n') size = int(p[2])*fontsize/25.0 - yield (float(p[0]), int(p[4]), i, c, {'1': 0, '4': 2, '5': 1}[p[1]], int(p[3]), size, (c.count('\n')+1)*size, CalculateLength(c)*size) + yield (float(p[0]), int(p[4]), i, c, {'1': 0, '4': 2, '5': 1, '6': 0}[p[1]], int(p[3]), size, (c.count('\n')+1)*size, CalculateLength(c)*size) else: # positioned comment c = str(comment.childNodes[0].wholeText) yield (float(p[0]), int(p[4]), i, c, 'bilipos', int(p[3]), int(p[2]), 0, 0)