From 6bfc0d96d7918b2742a75288eb1c1b80afecc55e Mon Sep 17 00:00:00 2001 From: teridon Date: Fri, 7 Aug 2020 20:32:21 -0400 Subject: [PATCH] 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. --- youtube_dl/extractor/digitalconcerthall.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/youtube_dl/extractor/digitalconcerthall.py b/youtube_dl/extractor/digitalconcerthall.py index 99911ffec..76ef327a1 100644 --- a/youtube_dl/extractor/digitalconcerthall.py +++ b/youtube_dl/extractor/digitalconcerthall.py @@ -96,8 +96,18 @@ class DigitalConcertHallIE(InfoExtractor): entries[-1]['description'] = vid_info.get('short_description', "missing description") if vid_info.get('cuepoints'): chapters = [] + first_chapter = 1 for chapter in vid_info.get('cuepoints'): 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') chapter_title = chapter.get('text') chapters.append({