1
0
mirror of https://github.com/spaam/svtplay-dl.git synced 2024-11-24 04:05:39 +01:00

smi: check if data is empty

This commit is contained in:
Johan Andersson 2015-05-01 22:34:02 +02:00
parent 4d634dc323
commit 7950e06e0d

View File

@ -113,12 +113,15 @@ class subtitle(object):
TAG_RE = re.compile(r'<[^>]+>')
bad_char = re.compile(r'\x96')
for i in ssubdata.readlines():
i = i.rstrip()
sync = re.search(r"<SYNC Start=(\d+)>", i)
if sync:
if int(sync.group(1)) != int(timea):
if data != "&nbsp;\r":
if data and data != "&nbsp;":
subs += "%s\n%s --> %s\n" % (number, timestr(timea), timestr(sync.group(1)))
text = "%s\n" % TAG_RE.sub('', data.replace("<br>", "\n"))
if text[len(text)-2] != "\n":
text += "\n"
subs += text
number += 1
timea = sync.group(1)