commit
30e518a5fc
@ -181,15 +181,16 @@ def ReadCommentsBilibili(f, fontsize):
|
|||||||
p = str(comment.getAttribute('p')).split(',')
|
p = str(comment.getAttribute('p')).split(',')
|
||||||
assert len(p) >= 5
|
assert len(p) >= 5
|
||||||
assert p[1] in ('1', '4', '5', '6', '7', '8')
|
assert p[1] in ('1', '4', '5', '6', '7', '8')
|
||||||
if p[1] in ('1', '4', '5', '6'):
|
if comment.childNodes.length > 0:
|
||||||
c = str(comment.childNodes[0].wholeText).replace('/n', '\n')
|
if p[1] in ('1', '4', '5', '6'):
|
||||||
size = int(p[2])*fontsize/25.0
|
c = str(comment.childNodes[0].wholeText).replace('/n', '\n')
|
||||||
yield (float(p[0]), int(p[4]), i, c, {'1': 0, '4': 2, '5': 1, '6': 3}[p[1]], int(p[3]), size, (c.count('\n')+1)*size, CalculateLength(c)*size)
|
size = int(p[2])*fontsize/25.0
|
||||||
elif p[1] == '7': # positioned comment
|
yield (float(p[0]), int(p[4]), i, c, {'1': 0, '4': 2, '5': 1, '6': 3}[p[1]], int(p[3]), size, (c.count('\n')+1)*size, CalculateLength(c)*size)
|
||||||
c = str(comment.childNodes[0].wholeText)
|
elif p[1] == '7': # positioned comment
|
||||||
yield (float(p[0]), int(p[4]), i, c, 'bilipos', int(p[3]), int(p[2]), 0, 0)
|
c = str(comment.childNodes[0].wholeText)
|
||||||
elif p[1] == '8':
|
yield (float(p[0]), int(p[4]), i, c, 'bilipos', int(p[3]), int(p[2]), 0, 0)
|
||||||
pass # ignore scripted comment
|
elif p[1] == '8':
|
||||||
|
pass # ignore scripted comment
|
||||||
except (AssertionError, AttributeError, IndexError, TypeError, ValueError):
|
except (AssertionError, AttributeError, IndexError, TypeError, ValueError):
|
||||||
logging.warning(_('Invalid comment: %s') % comment.toxml())
|
logging.warning(_('Invalid comment: %s') % comment.toxml())
|
||||||
continue
|
continue
|
||||||
|
Loading…
Reference in New Issue
Block a user