Skip to content

Commit a48269f

Browse files
committed
Import short category names too
1 parent 4bd7e9a commit a48269f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/utils/exporter.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ const inTest = typeof chrome === "undefined";
88
const chapterNames = CompileConfig.categoryList.filter((code) => code !== "chapter")
99
.map((code) => ({
1010
code,
11-
name: !inTest ? chrome.i18n.getMessage("category_" + code) : code
11+
names: !inTest ? [chrome.i18n.getMessage("category_" + code), shortCategoryName(code)] : [code]
1212
}));
1313

1414
export function exportTimes(segments: SponsorTime[]): string {
@@ -47,7 +47,7 @@ export function importTimes(data: string, videoDuration: number): SponsorTime[]
4747

4848
const title = titleLeft?.length > titleRight?.length ? titleLeft : titleRight;
4949
if (title) {
50-
const determinedCategory = chapterNames.find(c => c.name === title)?.code as Category;
50+
const determinedCategory = chapterNames.find(c => c.names.includes(title))?.code as Category;
5151

5252
const segment: SponsorTime = {
5353
segment: [startTime, GenericUtils.getFormattedTimeToSeconds(match[1])],

0 commit comments

Comments
 (0)