Made render segments as chapters only affect non chapter segments

This commit is contained in:
Ajay
2022-07-04 00:43:55 -04:00
parent de85d93602
commit fea90d024e
5 changed files with 16 additions and 15 deletions

View File

@@ -958,7 +958,11 @@ async function sponsorsLookup(keepOldSubmissions = true) {
}
function importExistingChapters(wait: boolean) {
if (Config.config.renderAsChapters && !existingChaptersImported
const containsChapter = sponsorTimes?.some((segment) => segment.actionType === ActionType.Chapter)
|| sponsorTimesSubmitting.some((segment) => segment.actionType === ActionType.Chapter);
if ((Config.config.renderSegmentsAsChapters || containsChapter)
&& !existingChaptersImported
&& (sponsorTimes?.length > 0 || sponsorTimesSubmitting.length > 0)) {
GenericUtils.wait(() => video && getExistingChapters(sponsorVideoID, video.duration),
wait ? 5000 : 0, 100, (c) => c?.length > 0).then((chapters) => {