Import short category names too

This commit is contained in:
Ajay
2022-10-17 08:50:55 -04:00
parent 4bd7e9ab34
commit a48269f254

View File

@@ -8,7 +8,7 @@ const inTest = typeof chrome === "undefined";
const chapterNames = CompileConfig.categoryList.filter((code) => code !== "chapter") const chapterNames = CompileConfig.categoryList.filter((code) => code !== "chapter")
.map((code) => ({ .map((code) => ({
code, code,
name: !inTest ? chrome.i18n.getMessage("category_" + code) : code names: !inTest ? [chrome.i18n.getMessage("category_" + code), shortCategoryName(code)] : [code]
})); }));
export function exportTimes(segments: SponsorTime[]): string { export function exportTimes(segments: SponsorTime[]): string {
@@ -47,7 +47,7 @@ export function importTimes(data: string, videoDuration: number): SponsorTime[]
const title = titleLeft?.length > titleRight?.length ? titleLeft : titleRight; const title = titleLeft?.length > titleRight?.length ? titleLeft : titleRight;
if (title) { if (title) {
const determinedCategory = chapterNames.find(c => c.name === title)?.code as Category; const determinedCategory = chapterNames.find(c => c.names.includes(title))?.code as Category;
const segment: SponsorTime = { const segment: SponsorTime = {
segment: [startTime, GenericUtils.getFormattedTimeToSeconds(match[1])], segment: [startTime, GenericUtils.getFormattedTimeToSeconds(match[1])],