1
0
mirror of https://codeberg.org/polarisfm/youtube-dl synced 2024-11-29 19:47:54 +01:00

if first chapter starts at non-zero time, youtube-dl (or maybe ffmpeg?) ignores it and you end up with the first chapter starting at the wrong time. So, when first chapter does not start at time 0, insert an "Intro" chapter, so that the music starts at a chapter marker.

This commit is contained in:
teridon 2020-08-07 20:32:21 -04:00
parent cdb3cfb31a
commit 6bfc0d96d7

View File

@ -96,8 +96,18 @@ class DigitalConcertHallIE(InfoExtractor):
entries[-1]['description'] = vid_info.get('short_description', "missing description") entries[-1]['description'] = vid_info.get('short_description', "missing description")
if vid_info.get('cuepoints'): if vid_info.get('cuepoints'):
chapters = [] chapters = []
first_chapter = 1
for chapter in vid_info.get('cuepoints'): for chapter in vid_info.get('cuepoints'):
start_time = chapter.get('time') start_time = chapter.get('time')
# Often, the first chapter does not start at zero. In this case,
# insert an intro chapter so that first chapter is the start of the music
if (first_chapter == 1) and (start_time != 0):
chapters.append({
'start_time': 0,
'end_time': start_time,
'title': '0. Intro'
})
first_chapter = 0
end_time = start_time + chapter.get('duration') end_time = start_time + chapter.get('duration')
chapter_title = chapter.get('text') chapter_title = chapter.get('text')
chapters.append({ chapters.append({