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 diff --git a/danmaku2ass.py b/danmaku2ass.py index 6ec70b4..7a14a9b 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 = {'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): @@ -585,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)] @@ -593,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: @@ -612,8 +541,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: @@ -798,22 +725,29 @@ 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, comment_filter=None, is_reduce_comments=False, progress_callback=None): + try: + if comment_filter: + filter_regex = re.compile(comment_filter) + else: + filter_regex = None + except: + raise ValueError(_('Invalid regular expression: %s') % comment_filter) 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') 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() @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): @@ -827,9 +761,18 @@ 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 not CommentProcessor: - raise ValueError(_('Unknown comment file format: %s') % i) + 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') % input_format + ) comments.extend(CommentProcessor(FilterBadChars(str_io), font_size)) if progress_callback: progress_callback(len(input_files), len(input_files)) @@ -839,7 +782,7 @@ def ReadComments(input_files, font_size=25.0, progress_callback=None): @export def GetCommentProcessor(input_file): - return CommentFormatMap[ProbeCommentFormat(input_file)] + return CommentFormatMap.get(ProbeCommentFormat(input_file)) def main(): @@ -847,6 +790,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 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:]) @@ -854,6 +798,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')) @@ -864,7 +809,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.filter, args.reduce) if __name__ == '__main__': diff --git a/locale/en/LC_MESSAGES/danmaku2ass.mo b/locale/en/LC_MESSAGES/danmaku2ass.mo index f6a28d9..17490be 100644 Binary files a/locale/en/LC_MESSAGES/danmaku2ass.mo and b/locale/en/LC_MESSAGES/danmaku2ass.mo differ diff --git a/locale/en/LC_MESSAGES/danmaku2ass.po b/locale/en/LC_MESSAGES/danmaku2ass.po index 873891a..d79fe60 100644 --- a/locale/en/LC_MESSAGES/danmaku2ass.po +++ b/locale/en/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:44+0800\n" +"POT-Creation-Date: 2016-08-13 19:57+0800\n" "Last-Translator: Star Brilliant \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 f771861..8f6018b 100644 Binary files a/locale/ja/LC_MESSAGES/danmaku2ass.mo and b/locale/ja/LC_MESSAGES/danmaku2ass.mo differ diff --git a/locale/ja/LC_MESSAGES/danmaku2ass.po b/locale/ja/LC_MESSAGES/danmaku2ass.po index f4e84e2..906c664 100644 --- a/locale/ja/LC_MESSAGES/danmaku2ass.po +++ b/locale/ja/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: 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 "無効な正規表現:%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) [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 14046cd..fe074d2 100644 Binary files a/locale/zh_CN/LC_MESSAGES/danmaku2ass.mo and b/locale/zh_CN/LC_MESSAGES/danmaku2ass.mo differ diff --git a/locale/zh_CN/LC_MESSAGES/danmaku2ass.po b/locale/zh_CN/LC_MESSAGES/danmaku2ass.po index e043d58..e2d8bf7 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 a61efec..ce7d6d1 100644 Binary files a/locale/zh_TW/LC_MESSAGES/danmaku2ass.mo and b/locale/zh_TW/LC_MESSAGES/danmaku2ass.mo differ diff --git a/locale/zh_TW/LC_MESSAGES/danmaku2ass.po b/locale/zh_TW/LC_MESSAGES/danmaku2ass.po index a4a6edd..60ddd1a 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"