projects
/
youtube-dl
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
3630034
)
[lynda] Check for the empty subtitle
author
Sergey
<Ftornik@users.noreply.github.com>
Mon, 2 Mar 2015 09:49:39 +0000
(11:49 +0200)
committer
Sergey
<Ftornik@users.noreply.github.com>
Mon, 2 Mar 2015 09:49:39 +0000
(11:49 +0200)
youtube_dl/extractor/lynda.py
patch
|
blob
|
history
diff --git
a/youtube_dl/extractor/lynda.py
b/youtube_dl/extractor/lynda.py
index 5dc22da22a6a5324887379fdff339f09f13d0309..a84019bdf69b6e4588ccd6d4eff928e3a7ffdfcd 100644
(file)
--- a/
youtube_dl/extractor/lynda.py
+++ b/
youtube_dl/extractor/lynda.py
@@
-144,6
+144,7
@@
class LyndaIE(InfoExtractor):
def _fix_subtitles(self, subs):
srt = ''
def _fix_subtitles(self, subs):
srt = ''
+ seq_counter = 0
for pos in range(0, len(subs) - 1):
seq_current = subs[pos]
m_current = re.match(self._TIMECODE_REGEX, seq_current['Timecode'])
for pos in range(0, len(subs) - 1):
seq_current = subs[pos]
m_current = re.match(self._TIMECODE_REGEX, seq_current['Timecode'])
@@
-155,8
+156,10
@@
class LyndaIE(InfoExtractor):
continue
appear_time = m_current.group('timecode')
disappear_time = m_next.group('timecode')
continue
appear_time = m_current.group('timecode')
disappear_time = m_next.group('timecode')
- text = seq_current['Caption'].lstrip()
- srt += '%s\r\n%s --> %s\r\n%s' % (str(pos), appear_time, disappear_time, text)
+ text = seq_current['Caption'].strip()
+ if text:
+ seq_counter += 1
+ srt += '%s\r\n%s --> %s\r\n%s\r\n\r\n' % (seq_counter, appear_time, disappear_time, text)
if srt:
return srt
if srt:
return srt