From 2c51dfcdd6e1798c8fa566a745f8ddbddc24ea1e Mon Sep 17 00:00:00 2001 From: 910JQK Date: Sat, 13 Aug 2016 16:28:28 +0800 Subject: [PATCH 01/12] Remove obsoleted code of sH5V --- danmaku2ass.py | 77 +------------------------------------------------- 1 file changed, 1 insertion(+), 76 deletions(-) diff --git a/danmaku2ass.py b/danmaku2ass.py index 6ec70b4..47a1840 100755 --- a/danmaku2ass.py +++ b/danmaku2ass.py @@ -64,8 +64,6 @@ def ProbeCommentFormat(f): tmp = f.read(14) if tmp == '"status_code":': return 'Tudou' - elif tmp == '"root":{"total': - return 'sH5V' elif tmp.strip().startswith('"result'): return 'Tudou2' elif tmp == '<': @@ -246,34 +244,7 @@ def ReadCommentsMioMio(f, fontsize): continue -def ReadCommentsSH5V(f, fontsize): - comment_element = json.load(f) - for i, comment in enumerate(comment_element["root"]["bgs"]): - try: - c_at = str(comment['at']) - c_type = str(comment['type']) - c_date = str(comment['timestamp']) - c_color = str(comment['color']) - c = str(comment['text']) - size = fontsize - if c_type != '7': - yield (float(c_at), int(c_date), i, c, {'0': 0, '1': 0, '4': 2, '5': 1}[c_type], int(c_color[1:], 16), size, (c.count('\n')+1)*size, CalculateLength(c)*size) - else: - c_x = float(comment['x']) - c_y = float(comment['y']) - size = int(comment['size']) - dur = int(comment['dur']) - data1 = float(comment['data1']) - data2 = float(comment['data2']) - data3 = int(comment['data3']) - data4 = int(comment['data4']) - yield (float(c_at), int(c_date), i, c, 'sH5Vpos', int(c_color[1:], 16), size, 0, 0, c_x, c_y, dur, data1, data2, data3, data4) - except (AssertionError, AttributeError, IndexError, TypeError, ValueError): - logging.warning(_('Invalid comment: %r') % comment) - continue - - -CommentFormatMap = {None: None, 'Niconico': ReadCommentsNiconico, 'Acfun': ReadCommentsAcfun, 'Bilibili': ReadCommentsBilibili, 'Tudou': ReadCommentsTudou, 'Tudou2': ReadCommentsTudou2, 'MioMio': ReadCommentsMioMio, 'sH5V': ReadCommentsSH5V} +CommentFormatMap = {None: None, 'Niconico': ReadCommentsNiconico, 'Acfun': ReadCommentsAcfun, 'Bilibili': ReadCommentsBilibili, 'Tudou': ReadCommentsTudou, 'Tudou2': ReadCommentsTudou2, 'MioMio': ReadCommentsMioMio} def WriteCommentBilibiliPositioned(f, c, width, height, styleid): @@ -472,50 +443,6 @@ def WriteCommentAcfunPositioned(f, c, width, height, styleid): logging.warning(_('Invalid comment: %r') % c[3]) -def WriteCommentSH5VPositioned(f, c, width, height, styleid): - - def GetTransformStyles(x=None, y=None, fsize=None, rotate_z=None, rotate_y=None, color=None, alpha=None): - styles = [] - if x is not None and y is not None: - styles.append('\\pos(%.0f, %.0f)' % (x, y)) - if fsize is not None: - styles.append('\\fs%.0f' % fsize) - if rotate_y is not None and rotate_z is not None: - styles.append('\\frz%.0f' % rotate_z) - styles.append('\\fry%.0f' % rotate_y) - if color is not None: - styles.append('\\c&H%s&' % ConvertColor(color)) - if color == 0x000000: - styles.append('\\3c&HFFFFFF&') - if alpha is not None: - alpha = 255-round(alpha*255) - styles.append('\\alpha&H%02X' % alpha) - return styles - - def FlushCommentLine(f, text, styles, start_time, end_time, styleid): - if end_time > start_time: - f.write('Dialogue: -1,%(start)s,%(end)s,%(styleid)s,,0,0,0,,{%(styles)s}%(text)s\n' % {'start': ConvertTimestamp(start_time), 'end': ConvertTimestamp(end_time), 'styles': ''.join(styles), 'text': text, 'styleid': styleid}) - - try: - text = ASSEscape(str(c[3])) - to_x = float(c[9])*width - to_y = float(c[10])*height - to_rotate_z = -int(c[14]) - to_rotate_y = -int(c[15]) - to_color = c[5] - to_alpha = float(c[12]) - # Note: Alpha transition hasn't been worked out yet. - to_size = int(c[6])*math.sqrt(width*height/307200) - # Note: Because sH5V's data is the absolute size of font,temporarily solve by it at present.[*math.sqrt(width/640*height/480)] - # But it seems to be working fine... - from_time = float(c[0]) - action_time = float(c[11])/1000 - transform_styles = GetTransformStyles(to_x, to_y, to_size, to_rotate_z, to_rotate_y, to_color, to_alpha) - FlushCommentLine(f, text, transform_styles, from_time, from_time+action_time, styleid) - except (IndexError, ValueError) as e: - logging.warning(_('Invalid comment: %r') % c[3]) - - # Result: (f, dx, dy) # To convert: NewX = f*x+dx, NewY = f*y+dy def GetZoomFactor(SourceSize, TargetSize): @@ -612,8 +539,6 @@ def ProcessComments(comments, f, width, height, bottomReserved, fontface, fontsi WriteCommentBilibiliPositioned(f, i, width, height, styleid) elif i[4] == 'acfunpos': WriteCommentAcfunPositioned(f, i, width, height, styleid) - elif i[4] == 'sH5Vpos': - WriteCommentSH5VPositioned(f, i, width, height, styleid) else: logging.warning(_('Invalid comment: %r') % i[3]) if progress_callback: From 4477a56810a7fbbfddc273981b5b560c9623a8b5 Mon Sep 17 00:00:00 2001 From: 910JQK Date: Sat, 13 Aug 2016 17:02:37 +0800 Subject: [PATCH 02/12] Add command-line argument FORMAT (fix #24) --- danmaku2ass.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/danmaku2ass.py b/danmaku2ass.py index 47a1840..2a9b78e 100755 --- a/danmaku2ass.py +++ b/danmaku2ass.py @@ -723,9 +723,9 @@ def export(func): @export -def Danmaku2ASS(input_files, output_file, stage_width, stage_height, reserve_blank=0, font_face=_('(FONT) sans-serif')[7:], font_size=25.0, text_opacity=1.0, duration_marquee=5.0, duration_still=5.0, is_reduce_comments=False, progress_callback=None): +def Danmaku2ASS(input_files, input_format, output_file, stage_width, stage_height, reserve_blank=0, font_face=_('(FONT) sans-serif')[7:], font_size=25.0, text_opacity=1.0, duration_marquee=5.0, duration_still=5.0, is_reduce_comments=False, progress_callback=None): fo = None - comments = ReadComments(input_files, font_size) + comments = ReadComments(input_files, input_format, font_size) try: if output_file: fo = ConvertToFile(output_file, 'w', encoding='utf-8-sig', errors='replace', newline='\r\n') @@ -738,7 +738,7 @@ def Danmaku2ASS(input_files, output_file, stage_width, stage_height, reserve_bla @export -def ReadComments(input_files, font_size=25.0, progress_callback=None): +def ReadComments(input_files, input_format, font_size=25.0, progress_callback=None): if isinstance(input_files, bytes): input_files = str(bytes(input_files).decode('utf-8', 'replace')) if isinstance(input_files, str): @@ -752,7 +752,10 @@ def ReadComments(input_files, font_size=25.0, progress_callback=None): with ConvertToFile(i, 'r', encoding='utf-8', errors='replace') as f: s = f.read() str_io = io.StringIO(s) - CommentProcessor = GetCommentProcessor(str_io) + if input_format == 'autodetect': + CommentProcessor = GetCommentProcessor(str_io) + else: + CommentProcessor = CommentFormatMap.get(input_format) if not CommentProcessor: raise ValueError(_('Unknown comment file format: %s') % i) comments.extend(CommentProcessor(FilterBadChars(str_io), font_size)) @@ -772,6 +775,7 @@ def main(): if len(sys.argv) == 1: sys.argv.append('--help') parser = argparse.ArgumentParser() + parser.add_argument('-f', '--format', metavar=_('FORMAT'), help=_('Format of input [default: autodetect]'), default='autodetect') parser.add_argument('-o', '--output', metavar=_('OUTPUT'), help=_('Output file')) parser.add_argument('-s', '--size', metavar=_('WIDTHxHEIGHT'), required=True, help=_('Stage size in pixels')) parser.add_argument('-fn', '--font', metavar=_('FONT'), help=_('Specify font face [default: %s]') % _('(FONT) sans-serif')[7:], default=_('(FONT) sans-serif')[7:]) @@ -789,7 +793,7 @@ def main(): height = int(height) except ValueError: raise ValueError(_('Invalid stage size: %r') % args.size) - Danmaku2ASS(args.file, args.output, width, height, args.protect, args.font, args.fontsize, args.alpha, args.duration_marquee, args.duration_still, args.reduce) + Danmaku2ASS(args.file, args.format, args.output, width, height, args.protect, args.font, args.fontsize, args.alpha, args.duration_marquee, args.duration_still, args.reduce) if __name__ == '__main__': From 234d43cc01e375c3ff0bbf28690a61a14d2e3f07 Mon Sep 17 00:00:00 2001 From: 910JQK Date: Sat, 13 Aug 2016 17:20:02 +0800 Subject: [PATCH 03/12] Fix error message when invalid format is given --- danmaku2ass.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/danmaku2ass.py b/danmaku2ass.py index 2a9b78e..11300c4 100755 --- a/danmaku2ass.py +++ b/danmaku2ass.py @@ -754,10 +754,16 @@ def ReadComments(input_files, input_format, font_size=25.0, progress_callback=No str_io = io.StringIO(s) if input_format == 'autodetect': CommentProcessor = GetCommentProcessor(str_io) + if not CommentProcessor: + raise ValueError( + _('Failed to detect comment file format: %s') % i + ) else: CommentProcessor = CommentFormatMap.get(input_format) - if not CommentProcessor: - raise ValueError(_('Unknown comment file format: %s') % i) + if not CommentProcessor: + raise ValueError( + _('Unknown comment file format: %s') % input_format + ) comments.extend(CommentProcessor(FilterBadChars(str_io), font_size)) if progress_callback: progress_callback(len(input_files), len(input_files)) From bb5d1b15b7c336add4d0d2e384b318cebd801cf4 Mon Sep 17 00:00:00 2001 From: 910JQK Date: Sat, 13 Aug 2016 18:06:48 +0800 Subject: [PATCH 04/12] Add regex filter --- danmaku2ass.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/danmaku2ass.py b/danmaku2ass.py index 11300c4..d379a41 100755 --- a/danmaku2ass.py +++ b/danmaku2ass.py @@ -618,8 +618,13 @@ Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text ) +Filter = None + + def WriteComment(f, c, row, width, height, bottomReserved, fontsize, duration_marquee, duration_still, styleid): text = ASSEscape(c[3]) + if Filter and Filter.search(text): + return styles = [] if c[4] == 1: styles.append('\\an8\\pos(%(halfwidth)d, %(row)d)' % {'halfwidth': width/2, 'row': row}) @@ -777,6 +782,7 @@ def GetCommentProcessor(input_file): def main(): + global Filter logging.basicConfig(format='%(levelname)s: %(message)s') if len(sys.argv) == 1: sys.argv.append('--help') @@ -789,6 +795,7 @@ def main(): parser.add_argument('-a', '--alpha', metavar=_('ALPHA'), help=_('Text opacity'), type=float, default=1.0) parser.add_argument('-dm', '--duration-marquee', metavar=_('SECONDS'), help=_('Duration of scrolling comment display [default: %s]') % 5, type=float, default=5.0) parser.add_argument('-ds', '--duration-still', metavar=_('SECONDS'), help=_('Duration of still comment display [default: %s]') % 5, type=float, default=5.0) + parser.add_argument('-fl', '--filter', help=_('Regular expression to filter comments')) parser.add_argument('-p', '--protect', metavar=_('HEIGHT'), help=_('Reserve blank on the bottom of the stage'), type=int, default=0) parser.add_argument('-r', '--reduce', action='store_true', help=_('Reduce the amount of comments if stage is full')) parser.add_argument('file', metavar=_('FILE'), nargs='+', help=_('Comment file to be processed')) @@ -799,6 +806,11 @@ def main(): height = int(height) except ValueError: raise ValueError(_('Invalid stage size: %r') % args.size) + try: + if args.filter: + Filter = re.compile(args.filter) + except: + raise ValueError(_('Invalid filter: %s') % args.filter) Danmaku2ASS(args.file, args.format, args.output, width, height, args.protect, args.font, args.fontsize, args.alpha, args.duration_marquee, args.duration_still, args.reduce) From 893907bff29fcf27fa49d91705574c8369d6676d Mon Sep 17 00:00:00 2001 From: 910JQK Date: Sat, 13 Aug 2016 19:01:11 +0800 Subject: [PATCH 05/12] Fix messages --- danmaku2ass.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/danmaku2ass.py b/danmaku2ass.py index d379a41..f961b27 100755 --- a/danmaku2ass.py +++ b/danmaku2ass.py @@ -787,7 +787,7 @@ def main(): if len(sys.argv) == 1: sys.argv.append('--help') parser = argparse.ArgumentParser() - parser.add_argument('-f', '--format', metavar=_('FORMAT'), help=_('Format of input [default: autodetect]'), default='autodetect') + parser.add_argument('-f', '--format', metavar=_('FORMAT'), help=_('Format of input file [default: autodetect]'), default='autodetect') parser.add_argument('-o', '--output', metavar=_('OUTPUT'), help=_('Output file')) parser.add_argument('-s', '--size', metavar=_('WIDTHxHEIGHT'), required=True, help=_('Stage size in pixels')) parser.add_argument('-fn', '--font', metavar=_('FONT'), help=_('Specify font face [default: %s]') % _('(FONT) sans-serif')[7:], default=_('(FONT) sans-serif')[7:]) @@ -810,7 +810,7 @@ def main(): if args.filter: Filter = re.compile(args.filter) except: - raise ValueError(_('Invalid filter: %s') % args.filter) + raise ValueError(_('Invalid regular expression: %s') % args.filter) Danmaku2ASS(args.file, args.format, args.output, width, height, args.protect, args.font, args.fontsize, args.alpha, args.duration_marquee, args.duration_still, args.reduce) From 30045859f588892cbb4a7f116eb1e47a47828b7b Mon Sep 17 00:00:00 2001 From: 910JQK Date: Sat, 13 Aug 2016 19:57:12 +0800 Subject: [PATCH 06/12] Implement filter in an appropriate way --- danmaku2ass.py | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/danmaku2ass.py b/danmaku2ass.py index f961b27..cbd724c 100755 --- a/danmaku2ass.py +++ b/danmaku2ass.py @@ -244,7 +244,7 @@ def ReadCommentsMioMio(f, fontsize): continue -CommentFormatMap = {None: None, 'Niconico': ReadCommentsNiconico, 'Acfun': ReadCommentsAcfun, 'Bilibili': ReadCommentsBilibili, 'Tudou': ReadCommentsTudou, 'Tudou2': ReadCommentsTudou2, 'MioMio': ReadCommentsMioMio} +CommentFormatMap = {'Niconico': ReadCommentsNiconico, 'Acfun': ReadCommentsAcfun, 'Bilibili': ReadCommentsBilibili, 'Tudou': ReadCommentsTudou, 'Tudou2': ReadCommentsTudou2, 'MioMio': ReadCommentsMioMio} def WriteCommentBilibiliPositioned(f, c, width, height, styleid): @@ -728,7 +728,15 @@ def export(func): @export -def Danmaku2ASS(input_files, input_format, output_file, stage_width, stage_height, reserve_blank=0, font_face=_('(FONT) sans-serif')[7:], font_size=25.0, text_opacity=1.0, duration_marquee=5.0, duration_still=5.0, is_reduce_comments=False, progress_callback=None): +def Danmaku2ASS(input_files, input_format, output_file, stage_width, stage_height, reserve_blank=0, font_face=_('(FONT) sans-serif')[7:], font_size=25.0, text_opacity=1.0, duration_marquee=5.0, duration_still=5.0, comment_filter=None, is_reduce_comments=False, progress_callback=None): + global Filter + try: + if comment_filter: + Filter = re.compile(comment_filter) + else: + Filter = None + except: + raise ValueError(_('Invalid regular expression: %s') % comment_filter) fo = None comments = ReadComments(input_files, input_format, font_size) try: @@ -778,16 +786,15 @@ def ReadComments(input_files, input_format, font_size=25.0, progress_callback=No @export def GetCommentProcessor(input_file): - return CommentFormatMap[ProbeCommentFormat(input_file)] + return CommentFormatMap.get(ProbeCommentFormat(input_file)) def main(): - global Filter logging.basicConfig(format='%(levelname)s: %(message)s') if len(sys.argv) == 1: sys.argv.append('--help') parser = argparse.ArgumentParser() - parser.add_argument('-f', '--format', metavar=_('FORMAT'), help=_('Format of input file [default: autodetect]'), default='autodetect') + parser.add_argument('-f', '--format', metavar=_('FORMAT'), help=_('Format of input file (autodetect|%s) [default: autodetect]') % '|'.join(i for i in CommentFormatMap), default='autodetect') parser.add_argument('-o', '--output', metavar=_('OUTPUT'), help=_('Output file')) parser.add_argument('-s', '--size', metavar=_('WIDTHxHEIGHT'), required=True, help=_('Stage size in pixels')) parser.add_argument('-fn', '--font', metavar=_('FONT'), help=_('Specify font face [default: %s]') % _('(FONT) sans-serif')[7:], default=_('(FONT) sans-serif')[7:]) @@ -806,12 +813,7 @@ def main(): height = int(height) except ValueError: raise ValueError(_('Invalid stage size: %r') % args.size) - try: - if args.filter: - Filter = re.compile(args.filter) - except: - raise ValueError(_('Invalid regular expression: %s') % args.filter) - Danmaku2ASS(args.file, args.format, args.output, width, height, args.protect, args.font, args.fontsize, args.alpha, args.duration_marquee, args.duration_still, args.reduce) + Danmaku2ASS(args.file, args.format, args.output, width, height, args.protect, args.font, args.fontsize, args.alpha, args.duration_marquee, args.duration_still, args.filter, args.reduce) if __name__ == '__main__': From 893afc3901956b7301d4779aa0a5de820b1c5ee2 Mon Sep 17 00:00:00 2001 From: 910JQK Date: Sat, 13 Aug 2016 20:24:50 +0800 Subject: [PATCH 07/12] Update translations --- locale/en/LC_MESSAGES/danmaku2ass.mo | Bin 1805 -> 2253 bytes locale/en/LC_MESSAGES/danmaku2ass.po | 73 ++++++++++++------ locale/ja/LC_MESSAGES/danmaku2ass.mo | Bin 2032 -> 2538 bytes locale/ja/LC_MESSAGES/danmaku2ass.po | 97 +++++++++++++++--------- locale/zh_CN/LC_MESSAGES/danmaku2ass.mo | Bin 1760 -> 2189 bytes locale/zh_CN/LC_MESSAGES/danmaku2ass.po | 97 +++++++++++++++--------- locale/zh_TW/LC_MESSAGES/danmaku2ass.mo | Bin 1778 -> 2207 bytes locale/zh_TW/LC_MESSAGES/danmaku2ass.po | 97 +++++++++++++++--------- 8 files changed, 228 insertions(+), 136 deletions(-) diff --git a/locale/en/LC_MESSAGES/danmaku2ass.mo b/locale/en/LC_MESSAGES/danmaku2ass.mo index f6a28d998af1ed4f7c950e7ae44f8974e343bc93..17490beef7415f44db29187e8aa47520f08d651f 100644 GIT binary patch literal 2253 zcmeH`zi%8x6vv0e{K!EF5TPI2^N1EH6Jx{#1 zvznPTHbNALDoO!D^pR5K4@f#hL=pagbQBa6X%Zp2G!%T_-kxnx6k3Xm?(Ju1?#!4j$Q!7~rP` zTi{EW```$;3|7H!iuIqs1DM}0_$&Ax=6`^P!MzAZ`;UXKf+xT+@H99KMj*w#0lp00 z0r6u$;z9ZS3?2l32VVo96zf9}L-XU{Utk4%102K0@XF4Bq_YlEoDN7jzXnO?T@azz z!-9`M{Mes(P(DvU(#eq&tuKS5vr}*#B%Rkm(s>&szk49*`~@VP55Qq?*DL+FBOsR8 zXCQt5GD!Jd1xe>uAnE$PSif1!?}60PcVLtU`R*L=VsZoqw>&;+r#NT>I|QRabs3Dk z#mjz>&Ii@51bZ7sgU%BT(n5o@QNE=0E!gX@eJ~n(`d~Oh5INhr;E!@E66;xMRK%v| z78=uRM)!I$aXeD7_*28fsxKs84*N@0K5SQ5Ei=L?op2p- z8yFqOD(Ui|2pKAy#$xkXdz^~n|L~t}&ea(ukH_NtG$4>_NV$g6$-r&x&m~0K^n|1I z*lhkvxv3=03W*~kbGpCr%V9gZBf0HAR#>CnJm2tHGg%k03I|_6RP&TIyR~LyH;aYg zaw9dUAS#n5G6-Xx=*ql~d8F2ozp&)9R^|rTu|*kX0s62ix#;N(RY&$kJuO$Lavnli z9%XS1_kVwn%7QvLX|}e(3k_eFyc3ILjiXx>zN4MfJqk~=JS=P1XId9(ZPspHsk3$} z0~Kxddmjm8_0Qh7x5S{lJXISqw#=6sNI4aOa+_=^SxfZi$sm#b5!=z9OU;_!*eFW9 zVDvRK(`$y_MQQq_tBIs1*0PD|cDuAFQ*E3#Z@Vh=&ShQe`MSzW3oYN9F)}}eUQIYz z^l$l}~k)D-AAZL&odUsX#oxo6qm&|LAW14YUDGzyJUM delta 613 zcmYk(zb^w}9LMo*+pFJgwOS0KM2O||u1-WZF&QlU4a97gbhAh$axqB6B5W2m1Ea}8 zVj3lSvE@)%+o zH&D-QVj1^v8IQ1n59r~y^9TEww{Z+R&RoiD+^lYM4D>(^hjAU3a0?gl5c}~O_2FAo z;X5qiD~@2x-EX^jk%#}dKZ~O{&FY(N9 zARSnaMXfJzQ3F1zfi+YE`=|y^QQtjBHE@YV>f0j&b@1jEnr^PQbP8HiA^x0|NPR?w zw3!J~p#lS>j*5MCJBIEblD(m$R`8=Nq*gbwPBBR4$bu$4F~m3%H\n" "Language: en\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=utf-8\n" "Content-Transfer-Encoding: 8bit\n" -#: danmaku2ass.py:143 danmaku2ass.py:182 danmaku2ass.py:212 +#: danmaku2ass.py:147 danmaku2ass.py:193 danmaku2ass.py:243 #, python-format msgid "Invalid comment: %s" msgstr "Invalid comment: %s" -#: danmaku2ass.py:162 danmaku2ass.py:196 danmaku2ass.py:239 danmaku2ass.py:323 -#: danmaku2ass.py:325 danmaku2ass.py:439 danmaku2ass.py:483 danmaku2ass.py:585 +#: danmaku2ass.py:170 danmaku2ass.py:207 danmaku2ass.py:227 danmaku2ass.py:327 +#: danmaku2ass.py:329 danmaku2ass.py:443 danmaku2ass.py:543 #, python-format msgid "Invalid comment: %r" msgstr "Invalid comment: %r" -#: danmaku2ass.py:769 danmaku2ass.py:818 +#: danmaku2ass.py:731 danmaku2ass.py:800 msgid "(FONT) sans-serif" msgstr "(FONT) Helvetica" -#: danmaku2ass.py:798 +#: danmaku2ass.py:739 +#, python-format +msgid "Invalid regular expression: %s" +msgstr "Invalid regular expression: %s" + +#: danmaku2ass.py:772 +#, python-format +msgid "Failed to detect comment file format: %s" +msgstr "Failed to detect comment file format: %s" + +#: danmaku2ass.py:778 #, python-format msgid "Unknown comment file format: %s" msgstr "Unknown comment file format: %s" -#: danmaku2ass.py:816 +#: danmaku2ass.py:797 +msgid "FORMAT" +msgstr "FORMAT" + +#: danmaku2ass.py:797 +#, python-format +msgid "Format of input file (autodetect|%s) [default: autodetect]" +msgstr "Format of input file (autodetect|%s) [default: autodetect]" + +#: danmaku2ass.py:798 msgid "OUTPUT" msgstr "OUTPUT" -#: danmaku2ass.py:816 +#: danmaku2ass.py:798 msgid "Output file" msgstr "Output file" -#: danmaku2ass.py:817 +#: danmaku2ass.py:799 msgid "WIDTHxHEIGHT" msgstr "WIDTHxHEIGHT" -#: danmaku2ass.py:817 +#: danmaku2ass.py:799 msgid "Stage size in pixels" msgstr "Stage size in pixels" -#: danmaku2ass.py:818 +#: danmaku2ass.py:800 msgid "FONT" msgstr "FONT" -#: danmaku2ass.py:818 +#: danmaku2ass.py:800 #, python-format msgid "Specify font face [default: %s]" msgstr "Specify font face [default: %s]" -#: danmaku2ass.py:819 +#: danmaku2ass.py:801 msgid "SIZE" msgstr "SIZE" -#: danmaku2ass.py:819 +#: danmaku2ass.py:801 #, python-format msgid "Default font size [default: %s]" msgstr "Default font size [default: %s]" -#: danmaku2ass.py:820 +#: danmaku2ass.py:802 msgid "ALPHA" msgstr "ALPHA" -#: danmaku2ass.py:820 +#: danmaku2ass.py:802 msgid "Text opacity" msgstr "Text opacity" -#: danmaku2ass.py:821 danmaku2ass.py:822 +#: danmaku2ass.py:803 danmaku2ass.py:804 msgid "SECONDS" msgstr "SECONDS" -#: danmaku2ass.py:821 +#: danmaku2ass.py:803 #, python-format msgid "Duration of scrolling comment display [default: %s]" msgstr "Duration of scrolling comment display [default: %s]" -#: danmaku2ass.py:822 +#: danmaku2ass.py:804 #, python-format msgid "Duration of still comment display [default: %s]" msgstr "Duration of still comment display [default: %s]" -#: danmaku2ass.py:823 +#: danmaku2ass.py:805 +msgid "Regular expression to filter comments" +msgstr "Regular expression to filter comments" + +#: danmaku2ass.py:806 msgid "HEIGHT" msgstr "HEIGHT" -#: danmaku2ass.py:823 +#: danmaku2ass.py:806 msgid "Reserve blank on the bottom of the stage" msgstr "Reserve blank on the bottom of the stage" -#: danmaku2ass.py:824 +#: danmaku2ass.py:807 msgid "Reduce the amount of comments if stage is full" msgstr "Reduce the amount of comments if stage is full" -#: danmaku2ass.py:825 +#: danmaku2ass.py:808 msgid "FILE" msgstr "FILE" -#: danmaku2ass.py:825 +#: danmaku2ass.py:808 msgid "Comment file to be processed" msgstr "Comment file to be processed" -#: danmaku2ass.py:832 +#: danmaku2ass.py:815 #, python-format msgid "Invalid stage size: %r" msgstr "Invalid stage size: %r" diff --git a/locale/ja/LC_MESSAGES/danmaku2ass.mo b/locale/ja/LC_MESSAGES/danmaku2ass.mo index f7718616846957a0db1ef02e483680999822480d..7ca02ca3a070cc89c9cd0aaf4a123ab7f0cff67f 100644 GIT binary patch delta 1075 zcmaLV?MqWp9KiA8w(MzUX=Ym51v9joIxHUsfxb})L@M7&(9pY(<|f-6NCo5G6-61A zL&6Ngw6dZIL|=pt(F^+@f_mX;CJ`1G_#&acXB%d{=*Q0eoOABEzw@;3*K>fB^KJrfhW_pVkYf2EW>v6;FVN= zRLoJyrDHzrdn~5CjC(MPY%0M)+>S@E0&B4peW()m;bxpfeqx4)THssUjSJ|+)pWmu z-8e;*#8lRJ;YPL73T9IS8}Kl;;0f%-TAWI|jB4B=W>r=rU7`WcU^6!2aJv5k7SjHd z_7~~2#?|iw&)cotAK2j?rfARx$&uVAfgvg_);E>iMD_v8IRVTNTvW>ErqC)+rRH$oH zp%%^QC$BXhcc^`4Q&GXRC@w_f$gVGw2)|iYvPra7bz~b2b#I@Jb9Fo>eX~v~FF3mn^K9S}vY0gS> zSXy+_yerKI-=^=ChDGA)qr{EjjoGC6GL>+B$3>jWf3{qi+3Z|=F}n1)e`#d=bN_7I ipBX>4VWrkUGW{qkmDZe$JyScdUZs}#*N1DFKYjyyMf|D& delta 612 zcmZ9}&nrYx6u|K_GjGhpFw8GPe)Lk3H{Khg$40;lnPP{K}Jz#OjN1XeJHXQ&^( zL_PQl)A)#Sdc%WpsSav^9^C*I z1J}@DzJ)Y7q)Xy4uHprH_>DBlaf^1GMIYzU<$T#@Fo>r(g?C7kS33O*tzwXulMJb^ zpf9D**+**Vew);rQor<&8u~*2Lw~gf4<)`\n" "Language: ja\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=utf-8\n" "Content-Transfer-Encoding: 8bit\n" -#: danmaku2ass.py:143 danmaku2ass.py:182 danmaku2ass.py:212 +#: danmaku2ass.py:147 danmaku2ass.py:193 danmaku2ass.py:243 #, python-format msgid "Invalid comment: %s" msgstr "無効なコメント:%s" -#: danmaku2ass.py:162 danmaku2ass.py:196 danmaku2ass.py:239 danmaku2ass.py:323 -#: danmaku2ass.py:325 danmaku2ass.py:439 danmaku2ass.py:483 danmaku2ass.py:585 +#: danmaku2ass.py:170 danmaku2ass.py:207 danmaku2ass.py:227 danmaku2ass.py:327 +#: danmaku2ass.py:329 danmaku2ass.py:443 danmaku2ass.py:543 #, python-format msgid "Invalid comment: %r" msgstr "無効なコメント:%r" -#: danmaku2ass.py:769 danmaku2ass.py:818 +#: danmaku2ass.py:731 danmaku2ass.py:800 msgid "(FONT) sans-serif" msgstr "(FONT) MS PGothic" -#: danmaku2ass.py:798 +#: danmaku2ass.py:739 +#, python-format +msgid "Invalid regular expression: %s" +msgstr "無効な正規表現" + +#: danmaku2ass.py:772 +#, python-format +msgid "Failed to detect comment file format: %s" +msgstr "コメントファイル形式を検出することができませんでした:%s" + +#: danmaku2ass.py:778 #, python-format msgid "Unknown comment file format: %s" msgstr "未知のコメントファイル形式:%s" -#: danmaku2ass.py:816 +#: danmaku2ass.py:797 +msgid "FORMAT" +msgstr "形式" + +#: danmaku2ass.py:797 +#, python-format +msgid "Format of input file (autodetect|%s) [default: autodetect]" +msgstr "入力ファイルの形式 (autodetect|%s) [default: autodetect]" + +#: danmaku2ass.py:798 msgid "OUTPUT" msgstr "出力" -#: danmaku2ass.py:816 +#: danmaku2ass.py:798 msgid "Output file" msgstr "出力ファイル" -#: danmaku2ass.py:817 -msgid "Stage size in pixels" -msgstr "ピクセル単位でステージのサイズ" - -#: danmaku2ass.py:817 +#: danmaku2ass.py:799 msgid "WIDTHxHEIGHT" msgstr "幅x高" -#: danmaku2ass.py:818 +#: danmaku2ass.py:799 +msgid "Stage size in pixels" +msgstr "ピクセル単位でステージのサイズ" + +#: danmaku2ass.py:800 msgid "FONT" msgstr "フォント" -#: danmaku2ass.py:818 +#: danmaku2ass.py:800 #, python-format msgid "Specify font face [default: %s]" msgstr "フォントを指定する [デフォルト: %s]" -#: danmaku2ass.py:819 +#: danmaku2ass.py:801 +msgid "SIZE" +msgstr "サイズ" + +#: danmaku2ass.py:801 #, python-format msgid "Default font size [default: %s]" msgstr "デフォルトのフォントサイズ [デフォルト: %s]" -#: danmaku2ass.py:819 -msgid "SIZE" -msgstr "サイズ" - -#: danmaku2ass.py:820 +#: danmaku2ass.py:802 msgid "ALPHA" msgstr "アルファ" -#: danmaku2ass.py:820 +#: danmaku2ass.py:802 msgid "Text opacity" msgstr "テキストの不透明度" -#: danmaku2ass.py:821 +#: danmaku2ass.py:803 danmaku2ass.py:804 +msgid "SECONDS" +msgstr "秒数" + +#: danmaku2ass.py:803 #, python-format msgid "Duration of scrolling comment display [default: %s]" msgstr "運動コメント表示の時間 [デフォルト: %s]" -#: danmaku2ass.py:821 danmaku2ass.py:822 -msgid "SECONDS" -msgstr "秒数" - -#: danmaku2ass.py:822 +#: danmaku2ass.py:804 #, python-format msgid "Duration of still comment display [default: %s]" msgstr "静止コメント表示の時間 [デフォルト: %s]" -#: danmaku2ass.py:823 +#: danmaku2ass.py:805 +msgid "Regular expression to filter comments" +msgstr "コメントをフィルタリングする正規表現" + +#: danmaku2ass.py:806 msgid "HEIGHT" msgstr "高度" -#: danmaku2ass.py:823 +#: danmaku2ass.py:806 msgid "Reserve blank on the bottom of the stage" msgstr "ステージの下にブランクを予備する" -#: danmaku2ass.py:824 +#: danmaku2ass.py:807 msgid "Reduce the amount of comments if stage is full" msgstr "ステージがいっぱいになったのときにコメントの量を減らす" -#: danmaku2ass.py:825 -msgid "Comment file to be processed" -msgstr "ファイルが処理されるコメント" - -#: danmaku2ass.py:825 +#: danmaku2ass.py:808 msgid "FILE" msgstr "ファイル" -#: danmaku2ass.py:832 +#: danmaku2ass.py:808 +msgid "Comment file to be processed" +msgstr "ファイルが処理されるコメント" + +#: danmaku2ass.py:815 #, python-format msgid "Invalid stage size: %r" msgstr "無効なステージサイズ:%r" diff --git a/locale/zh_CN/LC_MESSAGES/danmaku2ass.mo b/locale/zh_CN/LC_MESSAGES/danmaku2ass.mo index 14046cd1eae3f8f15c82c1dd4d6a3263aad5bc08..3a41f4cdde35277fd763642b954209d969ac5bd2 100644 GIT binary patch delta 967 zcmZY7Ur19?9KiA8HfMjF<;qM;JN+3bVYOtXHLS*Ilz#Vc8!licmT)gNJDCHI+V-HE_XxIOFNScm z(wvhg#4!@Himmn9X}jV;po7i5z}T;#|+cxH?8l^rcgMU8j6}a8P@}e z;f$%{^wDk6jG3%-I`2!j>)x0Vk7fqVkpBDOw6)~u@}`V4nZamE8)t`8Mmjx^OjxbX zzMcO!%A(9{8Y$hM92znbX4)EYF4Z3B*w@wJ@6`T-p}?bau47g1((QaPf5n=0?+BI) zR&nf3X>$C1Zno0AGO>@j>*a?t|K|0qdcXI>&C$|>>Egv3<*B>nLP4hdR2^w4&ySaK RGsXN|ac*Ko7pvPn^9%HMwDtf1 delta 612 zcmZ9}ze@sP7{KvIJv%F}OVfU!kPr z2n{twOH)%rNLx@t4sH$gec~OW2cP@A?|ZNJKKEQJ_3AY{Y3D?UaWYT7kR|do!i5N; zA}I_pj*F=KmT?lda2EHmf;Z^kyY&tWK^UnQw(%N0|#*dXK)p#aTi^@ zKz;Bf>cLl-!6!`On_chOd4|p3tQXN!sa{{8!X<}woZx&}V^CsY$9jxfP}_QIy+`fD zqqT!$%)9n}fLdeA)blMU-8>I-aRj`QV!K^o7ofNj(_en$NY`cPUWbWXCQ zc0oI(?bHG^bbo@>0;xxaNe%7L|IkmZL8Bz(jNcftD*dESYEgeTYQE+$Hnjp8Wt7Vl*BA diff --git a/locale/zh_CN/LC_MESSAGES/danmaku2ass.po b/locale/zh_CN/LC_MESSAGES/danmaku2ass.po index e043d58..a6b2e2f 100644 --- a/locale/zh_CN/LC_MESSAGES/danmaku2ass.po +++ b/locale/zh_CN/LC_MESSAGES/danmaku2ass.po @@ -2,110 +2,133 @@ msgid "" msgstr "" "Project-Id-Version: Danmaku2ASS\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2014-12-21 00:47+0800\n" +"POT-Creation-Date: 2016-08-13 19:57+0800\n" "Last-Translator: Star Brilliant \n" "Language: zh_CN\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=utf-8\n" "Content-Transfer-Encoding: 8bit\n" -#: danmaku2ass.py:143 danmaku2ass.py:182 danmaku2ass.py:212 +#: danmaku2ass.py:147 danmaku2ass.py:193 danmaku2ass.py:243 #, python-format msgid "Invalid comment: %s" msgstr "无效弹幕:%s" -#: danmaku2ass.py:162 danmaku2ass.py:196 danmaku2ass.py:239 danmaku2ass.py:323 -#: danmaku2ass.py:325 danmaku2ass.py:439 danmaku2ass.py:483 danmaku2ass.py:585 +#: danmaku2ass.py:170 danmaku2ass.py:207 danmaku2ass.py:227 danmaku2ass.py:327 +#: danmaku2ass.py:329 danmaku2ass.py:443 danmaku2ass.py:543 #, python-format msgid "Invalid comment: %r" msgstr "无效弹幕:%r" -#: danmaku2ass.py:769 danmaku2ass.py:818 +#: danmaku2ass.py:731 danmaku2ass.py:800 msgid "(FONT) sans-serif" msgstr "(FONT) SimHei" -#: danmaku2ass.py:798 +#: danmaku2ass.py:739 +#, python-format +msgid "Invalid regular expression: %s" +msgstr "无效的正则表达式:%s" + +#: danmaku2ass.py:772 +#, python-format +msgid "Failed to detect comment file format: %s" +msgstr "未知的弹幕文件格式:%s" + +#: danmaku2ass.py:778 #, python-format msgid "Unknown comment file format: %s" msgstr "未知的弹幕文件格式:%s" -#: danmaku2ass.py:816 +#: danmaku2ass.py:797 +msgid "FORMAT" +msgstr "格式" + +#: danmaku2ass.py:797 +#, python-format +msgid "Format of input file (autodetect|%s) [default: autodetect]" +msgstr "输入文件格式 (autodetect|%s) [默认: autodetect]" + +#: danmaku2ass.py:798 msgid "OUTPUT" msgstr "输出" -#: danmaku2ass.py:816 +#: danmaku2ass.py:798 msgid "Output file" msgstr "输出文件" -#: danmaku2ass.py:817 -msgid "Stage size in pixels" -msgstr "舞台尺寸的像素数目" - -#: danmaku2ass.py:817 +#: danmaku2ass.py:799 msgid "WIDTHxHEIGHT" msgstr "宽x高" -#: danmaku2ass.py:818 +#: danmaku2ass.py:799 +msgid "Stage size in pixels" +msgstr "舞台尺寸的像素数目" + +#: danmaku2ass.py:800 msgid "FONT" msgstr "字体" -#: danmaku2ass.py:818 +#: danmaku2ass.py:800 #, python-format msgid "Specify font face [default: %s]" msgstr "指定字体名称 [默认: %s]" -#: danmaku2ass.py:819 +#: danmaku2ass.py:801 +msgid "SIZE" +msgstr "尺寸" + +#: danmaku2ass.py:801 #, python-format msgid "Default font size [default: %s]" msgstr "默认字号 [默认: %s]" -#: danmaku2ass.py:819 -msgid "SIZE" -msgstr "尺寸" - -#: danmaku2ass.py:820 +#: danmaku2ass.py:802 msgid "ALPHA" msgstr "ALPHA" -#: danmaku2ass.py:820 +#: danmaku2ass.py:802 msgid "Text opacity" msgstr "文字不透明度" -#: danmaku2ass.py:821 +#: danmaku2ass.py:803 danmaku2ass.py:804 +msgid "SECONDS" +msgstr "秒数" + +#: danmaku2ass.py:803 #, python-format msgid "Duration of scrolling comment display [default: %s]" msgstr "滚动弹幕显示时长 [默认: %s]" -#: danmaku2ass.py:821 danmaku2ass.py:822 -msgid "SECONDS" -msgstr "秒数" - -#: danmaku2ass.py:822 +#: danmaku2ass.py:804 #, python-format msgid "Duration of still comment display [default: %s]" msgstr "静止弹幕显示时长 [默认: %s]" -#: danmaku2ass.py:823 +#: danmaku2ass.py:805 +msgid "Regular expression to filter comments" +msgstr "过滤弹幕的正则表达式" + +#: danmaku2ass.py:806 msgid "HEIGHT" msgstr "高度" -#: danmaku2ass.py:823 +#: danmaku2ass.py:806 msgid "Reserve blank on the bottom of the stage" msgstr "在舞台底部预留空位" -#: danmaku2ass.py:824 +#: danmaku2ass.py:807 msgid "Reduce the amount of comments if stage is full" msgstr "在舞台满时减少弹幕数量" -#: danmaku2ass.py:825 -msgid "Comment file to be processed" -msgstr "将要处理的弹幕文件" - -#: danmaku2ass.py:825 +#: danmaku2ass.py:808 msgid "FILE" msgstr "文件" -#: danmaku2ass.py:832 +#: danmaku2ass.py:808 +msgid "Comment file to be processed" +msgstr "将要处理的弹幕文件" + +#: danmaku2ass.py:815 #, python-format msgid "Invalid stage size: %r" msgstr "无效舞台尺寸:%r" diff --git a/locale/zh_TW/LC_MESSAGES/danmaku2ass.mo b/locale/zh_TW/LC_MESSAGES/danmaku2ass.mo index a61efecc331f5291565c0896499d14f5e2f967b7..e883687dbfcd70ae2d8d07d21c77410af4c0dc55 100644 GIT binary patch delta 996 zcmZY7-AhzK7{K9iceO9g+&)Z8o3JG%tV~MVyKW4O62m(Y+SaonxUTG;ji^8ZBQGkA zlM3FXxP=80A${4J(1ra6L0w2hdt4z5@}i51`n{f0VZEH$XU@!=nRjOPOTnF@o_W7- zP!VO6ofKb=QdRf~B?df772z$+#c`Bz_i-1_VJ+Ht0872hfsL+Bn8$kyR$?m#vDazu zQL|Jw(=g}y4$FC8!fjZI%=>)WHqYl1n$6Ql!>Akz#Fbp$fMr6zIR=~3fh;j4*g_BRW+iVWV34+ zOIcqfsTAV?%D@SfOdsNIOrxC0JW4`8P{x(4b<`*c?nUW8j(!ZI#`DN0Y8d5KWs`E^ zaw@X^pOBABDU4hBK<-%*;U?5piiDiZ?>W&Wlz07Zk$VYhT__|&>c4tiH=y8Rqj1g z@o%Fn%FLz_*Wp++YIKymdl|48-0`s$imU2`;ecL8BjERY_2+1JO2g_t0x$yc&So<$glz!6Dd zh%sD3-M4~y+{Ag@$2q)57dzH>>|@@;QT((fqatG>O_||EH`H(l>sZD$oW))A@Cx;5SQEyPD3%cuvfBaduZw^1*!gE`KZQ(n?|hXrh*-nfJM7xbgFO6Z(qN$rAm zO53RgXz2caQVXOm86h>aL;pj6wFZrnkTZT`*s2VWNm7gY8-q*|=FoXG577mabvMkB f+l^OCVWm_F3qeq;-X6pn5wq%r=EPezU*5$J1$H$W diff --git a/locale/zh_TW/LC_MESSAGES/danmaku2ass.po b/locale/zh_TW/LC_MESSAGES/danmaku2ass.po index a4a6edd..fce02eb 100644 --- a/locale/zh_TW/LC_MESSAGES/danmaku2ass.po +++ b/locale/zh_TW/LC_MESSAGES/danmaku2ass.po @@ -2,110 +2,133 @@ msgid "" msgstr "" "Project-Id-Version: Danmaku2ASS\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2014-12-21 00:47+0800\n" +"POT-Creation-Date: 2016-08-13 19:57+0800\n" "Last-Translator: Star Brilliant \n" "Language: zh_TW\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=utf-8\n" "Content-Transfer-Encoding: 8bit\n" -#: danmaku2ass.py:143 danmaku2ass.py:182 danmaku2ass.py:212 +#: danmaku2ass.py:147 danmaku2ass.py:193 danmaku2ass.py:243 #, python-format msgid "Invalid comment: %s" msgstr "無效彈幕:%s" -#: danmaku2ass.py:162 danmaku2ass.py:196 danmaku2ass.py:239 danmaku2ass.py:323 -#: danmaku2ass.py:325 danmaku2ass.py:439 danmaku2ass.py:483 danmaku2ass.py:585 +#: danmaku2ass.py:170 danmaku2ass.py:207 danmaku2ass.py:227 danmaku2ass.py:327 +#: danmaku2ass.py:329 danmaku2ass.py:443 danmaku2ass.py:543 #, python-format msgid "Invalid comment: %r" msgstr "無效彈幕:%r" -#: danmaku2ass.py:769 danmaku2ass.py:818 +#: danmaku2ass.py:731 danmaku2ass.py:800 msgid "(FONT) sans-serif" msgstr "(FONT) Microsoft JhengHei" -#: danmaku2ass.py:798 +#: danmaku2ass.py:739 +#, python-format +msgid "Invalid regular expression: %s" +msgstr "無效正規表示式:%s" + +#: danmaku2ass.py:772 +#, python-format +msgid "Failed to detect comment file format: %s" +msgstr "判斷彈幕檔案格式失敗:%s" + +#: danmaku2ass.py:778 #, python-format msgid "Unknown comment file format: %s" msgstr "未知的彈幕檔案格式:%s" -#: danmaku2ass.py:816 +#: danmaku2ass.py:797 +msgid "FORMAT" +msgstr "格式" + +#: danmaku2ass.py:797 +#, python-format +msgid "Format of input file (autodetect|%s) [default: autodetect]" +msgstr "輸入文件格式 (autodetect|%s) [預設: autodetect]" + +#: danmaku2ass.py:798 msgid "OUTPUT" msgstr "輸出" -#: danmaku2ass.py:816 +#: danmaku2ass.py:798 msgid "Output file" msgstr "輸出檔案" -#: danmaku2ass.py:817 -msgid "Stage size in pixels" -msgstr "舞臺尺寸的畫素數目" - -#: danmaku2ass.py:817 +#: danmaku2ass.py:799 msgid "WIDTHxHEIGHT" msgstr "寬x高" -#: danmaku2ass.py:818 +#: danmaku2ass.py:799 +msgid "Stage size in pixels" +msgstr "舞臺尺寸的畫素數目" + +#: danmaku2ass.py:800 msgid "FONT" msgstr "字型" -#: danmaku2ass.py:818 +#: danmaku2ass.py:800 #, python-format msgid "Specify font face [default: %s]" msgstr "指定字型名稱 [預設: %s]" -#: danmaku2ass.py:819 +#: danmaku2ass.py:801 +msgid "SIZE" +msgstr "尺寸" + +#: danmaku2ass.py:801 #, python-format msgid "Default font size [default: %s]" msgstr "預設字型大小 [預設: %s]" -#: danmaku2ass.py:819 -msgid "SIZE" -msgstr "尺寸" - -#: danmaku2ass.py:820 +#: danmaku2ass.py:802 msgid "ALPHA" msgstr "ALPHA" -#: danmaku2ass.py:820 +#: danmaku2ass.py:802 msgid "Text opacity" msgstr "文字不透明度" -#: danmaku2ass.py:821 +#: danmaku2ass.py:803 danmaku2ass.py:804 +msgid "SECONDS" +msgstr "秒數" + +#: danmaku2ass.py:803 #, python-format msgid "Duration of scrolling comment display [default: %s]" msgstr "滾動彈幕顯示時長 [預設: %s]" -#: danmaku2ass.py:821 danmaku2ass.py:822 -msgid "SECONDS" -msgstr "秒數" - -#: danmaku2ass.py:822 +#: danmaku2ass.py:804 #, python-format msgid "Duration of still comment display [default: %s]" msgstr "靜止彈幕顯示時長 [預設: %s]" -#: danmaku2ass.py:823 +#: danmaku2ass.py:805 +msgid "Regular expression to filter comments" +msgstr "過濾彈幕的正規表示式" + +#: danmaku2ass.py:806 msgid "HEIGHT" msgstr "高度" -#: danmaku2ass.py:823 +#: danmaku2ass.py:806 msgid "Reserve blank on the bottom of the stage" msgstr "在舞臺底部預留空位" -#: danmaku2ass.py:824 +#: danmaku2ass.py:807 msgid "Reduce the amount of comments if stage is full" msgstr "在舞臺滿時減少彈幕數量" -#: danmaku2ass.py:825 -msgid "Comment file to be processed" -msgstr "將要處理的彈幕檔案" - -#: danmaku2ass.py:825 +#: danmaku2ass.py:808 msgid "FILE" msgstr "檔案" -#: danmaku2ass.py:832 +#: danmaku2ass.py:808 +msgid "Comment file to be processed" +msgstr "將要處理的彈幕檔案" + +#: danmaku2ass.py:815 #, python-format msgid "Invalid stage size: %r" msgstr "無效舞臺尺寸:%r" From 0f9d3d34f403b71f41302434f27eb3d1ec6efdf3 Mon Sep 17 00:00:00 2001 From: 910JQK Date: Sat, 13 Aug 2016 20:27:28 +0800 Subject: [PATCH 08/12] Update README --- README.md | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index a173b47..e0b6173 100644 --- a/README.md +++ b/README.md @@ -54,8 +54,9 @@ Command line reference ---------------------- ``` -usage: danmaku2ass.py [-h] [-o OUTPUT] -s WIDTHxHEIGHT [-fn FONT] [-fs SIZE] - [-a ALPHA] [-dm SECONDS] [-ds SECONDS] [-p HEIGHT] [-r] +usage: danmaku2ass.py [-h] [-f FORMAT] [-o OUTPUT] -s WIDTHxHEIGHT [-fn FONT] + [-fs SIZE] [-a ALPHA] [-dm SECONDS] [-ds SECONDS] + [-fl FILTER] [-p HEIGHT] [-r] FILE [FILE ...] positional arguments: @@ -63,12 +64,15 @@ positional arguments: optional arguments: -h, --help show this help message and exit + -f FORMAT, --format FORMAT + Format of input file (autodetect|Bilibili|Tudou2|MioMi + o|Acfun|Niconico|Tudou) [default: autodetect] -o OUTPUT, --output OUTPUT Output file -s WIDTHxHEIGHT, --size WIDTHxHEIGHT Stage size in pixels -fn FONT, --font FONT - Specify font face [default: Helvetica] + Specify font face [default: sans-serif] -fs SIZE, --fontsize SIZE Default font size [default: 25] -a ALPHA, --alpha ALPHA @@ -77,6 +81,8 @@ optional arguments: Duration of scrolling comment display [default: 5] -ds SECONDS, --duration-still SECONDS Duration of still comment display [default: 5] + -fl FILTER, --filter FILTER + Regular expression to filter comments -p HEIGHT, --protect HEIGHT Reserve blank on the bottom of the stage -r, --reduce Reduce the amount of comments if stage is full From e101d0738ef7e8fc67da5e577d8f1d67ee3b82de Mon Sep 17 00:00:00 2001 From: 910JQK Date: Sat, 13 Aug 2016 20:38:18 +0800 Subject: [PATCH 09/12] Fix zh_TW translation --- locale/zh_TW/LC_MESSAGES/danmaku2ass.mo | Bin 2207 -> 2207 bytes locale/zh_TW/LC_MESSAGES/danmaku2ass.po | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/locale/zh_TW/LC_MESSAGES/danmaku2ass.mo b/locale/zh_TW/LC_MESSAGES/danmaku2ass.mo index e883687dbfcd70ae2d8d07d21c77410af4c0dc55..ce7d6d132bbb32e962106eeb96263a9123539edb 100644 GIT binary patch delta 18 acmbO)IA3ssBs=S>DbE&mY?fnhWCQ?0ZU)@| delta 18 acmbO)IA3ssBs=T0_9wfyZI)wiWCQ?0>jwe= diff --git a/locale/zh_TW/LC_MESSAGES/danmaku2ass.po b/locale/zh_TW/LC_MESSAGES/danmaku2ass.po index fce02eb..60ddd1a 100644 --- a/locale/zh_TW/LC_MESSAGES/danmaku2ass.po +++ b/locale/zh_TW/LC_MESSAGES/danmaku2ass.po @@ -46,7 +46,7 @@ msgstr "格式" #: danmaku2ass.py:797 #, python-format msgid "Format of input file (autodetect|%s) [default: autodetect]" -msgstr "輸入文件格式 (autodetect|%s) [預設: autodetect]" +msgstr "輸入檔案格式 (autodetect|%s) [預設: autodetect]" #: danmaku2ass.py:798 msgid "OUTPUT" From e277f9280930af2c2c2b013cbff996b65ec5ae32 Mon Sep 17 00:00:00 2001 From: 910JQK Date: Sat, 13 Aug 2016 21:47:25 +0800 Subject: [PATCH 10/12] Fix translation bugs --- locale/ja/LC_MESSAGES/danmaku2ass.po | 2 +- locale/zh_CN/LC_MESSAGES/danmaku2ass.po | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/locale/ja/LC_MESSAGES/danmaku2ass.po b/locale/ja/LC_MESSAGES/danmaku2ass.po index 35c0f19..df33e82 100644 --- a/locale/ja/LC_MESSAGES/danmaku2ass.po +++ b/locale/ja/LC_MESSAGES/danmaku2ass.po @@ -27,7 +27,7 @@ msgstr "(FONT) MS PGothic" #: danmaku2ass.py:739 #, python-format msgid "Invalid regular expression: %s" -msgstr "無効な正規表現" +msgstr "無効な正規表現:%s" #: danmaku2ass.py:772 #, python-format diff --git a/locale/zh_CN/LC_MESSAGES/danmaku2ass.po b/locale/zh_CN/LC_MESSAGES/danmaku2ass.po index a6b2e2f..e2d8bf7 100644 --- a/locale/zh_CN/LC_MESSAGES/danmaku2ass.po +++ b/locale/zh_CN/LC_MESSAGES/danmaku2ass.po @@ -27,12 +27,12 @@ msgstr "(FONT) SimHei" #: danmaku2ass.py:739 #, python-format msgid "Invalid regular expression: %s" -msgstr "无效的正则表达式:%s" +msgstr "无效正则表达式:%s" #: danmaku2ass.py:772 #, python-format msgid "Failed to detect comment file format: %s" -msgstr "未知的弹幕文件格式:%s" +msgstr "判断弹幕文件格式失败:%s" #: danmaku2ass.py:778 #, python-format From ac2a73fc0630acdeef257ee37b88b900bd3146d3 Mon Sep 17 00:00:00 2001 From: 910JQK Date: Sat, 13 Aug 2016 21:56:44 +0800 Subject: [PATCH 11/12] Fix translation bugs (update mo files) --- locale/ja/LC_MESSAGES/danmaku2ass.mo | Bin 2538 -> 2543 bytes locale/ja/LC_MESSAGES/danmaku2ass.po | 2 +- locale/zh_CN/LC_MESSAGES/danmaku2ass.mo | Bin 2189 -> 2189 bytes 3 files changed, 1 insertion(+), 1 deletion(-) diff --git a/locale/ja/LC_MESSAGES/danmaku2ass.mo b/locale/ja/LC_MESSAGES/danmaku2ass.mo index 7ca02ca3a070cc89c9cd0aaf4a123ab7f0cff67f..8f6018ba45768a6c519020b41e951276c34fc1ab 100644 GIT binary patch delta 164 zcmWm4F$%&!6olbSA&Y*%?dIzye=MjVyX@ndiorPx*wh{tPIoWWK*A76TLNiaAe{}QrGfNJAgu$Ww*qN)ApHnPGXiNzAQlE<5eA0MzZrvB fCP%T!@;q+Z{J44H<7Ob)vALXW2jgZFj@^s^l;Imo diff --git a/locale/ja/LC_MESSAGES/danmaku2ass.po b/locale/ja/LC_MESSAGES/danmaku2ass.po index df33e82..906c664 100644 --- a/locale/ja/LC_MESSAGES/danmaku2ass.po +++ b/locale/ja/LC_MESSAGES/danmaku2ass.po @@ -126,7 +126,7 @@ msgstr "ファイル" #: danmaku2ass.py:808 msgid "Comment file to be processed" -msgstr "ファイルが処理されるコメント" +msgstr "コメントファイルが処理される" #: danmaku2ass.py:815 #, python-format diff --git a/locale/zh_CN/LC_MESSAGES/danmaku2ass.mo b/locale/zh_CN/LC_MESSAGES/danmaku2ass.mo index 3a41f4cdde35277fd763642b954209d969ac5bd2..fe074d26e99dabc65fe6fa15ba3c6072487ca49c 100644 GIT binary patch delta 98 zcmeAb>=oP)!l4MNZUi{Kp-sz?u9mu!5oW$EPaZ26lr*;N<;BxWEw delta 74 zcmeAb>=oP)!l@)I^UGDfpbPT^3T Q#Gc9gd{)cmOm-DU0Iy07D*ylh From afa09710f973971a09383babf02819328e1daf53 Mon Sep 17 00:00:00 2001 From: 910JQK Date: Sat, 13 Aug 2016 22:24:29 +0800 Subject: [PATCH 12/12] No global variable --- danmaku2ass.py | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/danmaku2ass.py b/danmaku2ass.py index cbd724c..7a14a9b 100755 --- a/danmaku2ass.py +++ b/danmaku2ass.py @@ -512,7 +512,7 @@ def ConvertFlashRotation(rotY, rotZ, X, Y, width, height): return (trX, trY, WrapAngle(outX), WrapAngle(outY), WrapAngle(outZ), scaleXY*100, scaleXY*100) -def ProcessComments(comments, f, width, height, bottomReserved, fontface, fontsize, alpha, duration_marquee, duration_still, reduced, progress_callback): +def ProcessComments(comments, f, width, height, bottomReserved, fontface, fontsize, alpha, duration_marquee, duration_still, filter_regex, reduced, progress_callback): styleid = 'Danmaku2ASS_%04x' % random.randint(0, 0xffff) WriteASSHead(f, width, height, fontface, fontsize, alpha, styleid) rows = [[None]*(height-bottomReserved+1) for i in range(4)] @@ -520,6 +520,8 @@ def ProcessComments(comments, f, width, height, bottomReserved, fontface, fontsi if progress_callback and idx % 1000 == 0: progress_callback(idx, len(comments)) if isinstance(i[4], int): + if filter_regex and filter_regex.search(i[3]): + continue row = 0 rowmax = height-bottomReserved-i[7] while row <= rowmax: @@ -618,13 +620,8 @@ Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text ) -Filter = None - - def WriteComment(f, c, row, width, height, bottomReserved, fontsize, duration_marquee, duration_still, styleid): text = ASSEscape(c[3]) - if Filter and Filter.search(text): - return styles = [] if c[4] == 1: styles.append('\\an8\\pos(%(halfwidth)d, %(row)d)' % {'halfwidth': width/2, 'row': row}) @@ -729,12 +726,11 @@ def export(func): @export def Danmaku2ASS(input_files, input_format, output_file, stage_width, stage_height, reserve_blank=0, font_face=_('(FONT) sans-serif')[7:], font_size=25.0, text_opacity=1.0, duration_marquee=5.0, duration_still=5.0, comment_filter=None, is_reduce_comments=False, progress_callback=None): - global Filter try: if comment_filter: - Filter = re.compile(comment_filter) + filter_regex = re.compile(comment_filter) else: - Filter = None + filter_regex = None except: raise ValueError(_('Invalid regular expression: %s') % comment_filter) fo = None @@ -744,7 +740,7 @@ def Danmaku2ASS(input_files, input_format, output_file, stage_width, stage_heigh fo = ConvertToFile(output_file, 'w', encoding='utf-8-sig', errors='replace', newline='\r\n') else: fo = sys.stdout - ProcessComments(comments, fo, stage_width, stage_height, reserve_blank, font_face, font_size, text_opacity, duration_marquee, duration_still, is_reduce_comments, progress_callback) + ProcessComments(comments, fo, stage_width, stage_height, reserve_blank, font_face, font_size, text_opacity, duration_marquee, duration_still, filter_regex, is_reduce_comments, progress_callback) finally: if output_file and fo != output_file: fo.close()