From fa0e3681bfe2ccdfdb4f3c4a391316c980cad2fb Mon Sep 17 00:00:00 2001 From: Star Brilliant Date: Sun, 17 Nov 2013 09:10:12 +0800 Subject: [PATCH] PEP8-ize --- danmaku2ass.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/danmaku2ass.py b/danmaku2ass.py index 9a9eb44..348c9f6 100755 --- a/danmaku2ass.py +++ b/danmaku2ass.py @@ -217,6 +217,7 @@ CommentFormatMap = {None: None, 'Niconico': ReadCommentsNiconico, 'Acfun': ReadC def WriteCommentBilibiliPositioned(f, c, width, height, styleid): BiliPlayerSize = (672, 437) BiliPlayerAspect = 672/437 + def GetZoomFactor(TargetSize): try: if TargetSize == GetZoomFactor.Cached_TargetSize: @@ -238,7 +239,9 @@ def WriteCommentBilibiliPositioned(f, c, width, height, styleid): except ZeroDivisionError: GetZoomFactor.Cached_Result = (1, 0, 0) return GetZoomFactor.Cached_Result + ZoomFactor = GetZoomFactor((width, height)) + def GetPosition(InputPos, isHeight): isHeight = int(isHeight) # True -> 1 if isinstance(InputPos, int): @@ -254,6 +257,7 @@ def WriteCommentBilibiliPositioned(f, c, width, height, styleid): except ValueError: InputPos = float(InputPos) return GetPosition(InputPos, isHeight) + try: comment_args = safe_list(json.loads(c[3])) text = str(comment_args[4]).replace('\\', '\\\\').replace('/n', '\\N').replace('{', '\\{').replace('}', '\\}')