m13253 / danmaku2ass

Convert comments from Niconico/AcFun/bilibili to ASS format
http://m13253.blogspot.com/2013/11/play-danmaku-offline-danmaku2ass.html
GNU General Public License v3.0
556 stars 92 forks source link

Fix: integer argument expected, got float #11

Closed cnbeining closed 9 years ago

cnbeining commented 9 years ago

It appears that Biligrab cannot deal with it with a pass in its function.

So here I come:

ERROR:root:'tuple' object has no attribute 'startswith'
INFO: Converting danmaku to ASS file with danmaku2ass(py2)...
INFO: Trying to get resolution...
INFO: Resolution is 1280x720
ERROR: Danmaku2ASS failed: integer argument expected, got float
       Head to https://github.com/m13253/danmaku2ass/issues to complain about this.
Traceback (most recent call last):
  File "b2.py", line 573, in convert_ass_py2
    font_size = int(math.ceil(resolution[1] / 21.6)), text_opacity= 1, comment_duration=8.0)
  File "/Users/Beining/Movies/danmaku2ass2.py", line 781, in Danmaku2ASS
    ProcessComments(comments, fo, stage_width, stage_height, reserve_blank, font_face, font_size, text_opacity, comment_duration, is_reduce_comments, progress_callback)
  File "/Users/Beining/Movies/danmaku2ass2.py", line 583, in ProcessComments
    row = FindAlternativeRow(rows, i, height, bottomReserved)
  File "/Users/Beining/Movies/danmaku2ass2.py", line 630, in FindAlternativeRow
    for row in xrange(height-bottomReserved-math.ceil(c[7])):
TypeError: integer argument expected, got float

Noticeable, on L640:

        for i in xrange(row, row+int(math.ceil(c[7]))):

There already existed a int().

This fix will be pushed in the latest version of Biligrab. Works well for me.

m13253 commented 9 years ago

Thank you. Merged.

(Blame 3to2.py for not having converted math.ceil() to int(math.ceil())) :smile:

cnbeining commented 9 years ago

Yeah...I knew you won't make such mistake...

m13253 commented 9 years ago

Yeah...I knew you won't make such mistake...

I didn't mean that. I meant to say, the py2 branch is generated automatically with 3to2.py with some small manual patches, so it is not as stable as master is.