Add "Export segments as URL" option the unsubmitted videos section

This commit is contained in:
mini-bomba
2022-09-01 23:31:16 +02:00
committed by Ajay
parent df2586e76d
commit bbea534781
3 changed files with 31 additions and 3 deletions

View File

@@ -73,4 +73,15 @@ export function importTimes(data: string, videoDuration: number): SponsorTime[]
}
return result;
}
}
export function exportTimesAsHashParam(segments: SponsorTime[]): string {
const hashparamSegments = segments.map(segment => ({
actionType: segment.actionType,
category: segment.category,
segment: segment.segment,
...(segment.description ? {description: segment.description} : {}) // don't include the description param if empty
}));
return `#segments=${JSON.stringify(hashparamSegments)}`;
}