From 7d623dc8576f185846d8d72a3ec11c311553f983 Mon Sep 17 00:00:00 2001 From: John Chong Date: Mon, 9 May 2016 09:53:28 +0800 Subject: [PATCH] Fix potential type error when processing Tudou danmaku. --- danmaku2ass.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/danmaku2ass.py b/danmaku2ass.py index 17a368b..4d02050 100755 --- a/danmaku2ass.py +++ b/danmaku2ass.py @@ -213,10 +213,10 @@ def ReadCommentsTudou2(f, fontsize): try: c = str(comment['content']) prop = json.loads(str(comment['propertis']) or '{}') - size = prop.get('size', 1) + size = int(prop.get('size', 1)) assert size in (0, 1, 2) size = {0: 0.64, 1: 1, 2: 1.44}[size] * fontsize - pos = prop.get('pos', 3) + pos = int(prop.get('pos', 3)) assert pos in (0, 3, 4, 6) yield ( int(comment['playat'] * 0.001), int(comment['createtime'] * 0.001), i, c,