aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/utils/exporter.ts
diff options
context:
space:
mode:
authorAjay <[email protected]>2022-10-17 08:50:55 -0400
committerAjay <[email protected]>2022-10-17 08:50:55 -0400
commita48269f254d1443752615f7139ddc405570b1dbb (patch)
tree0bd114e1fe857ee6c68382b388b0a54d72484903 /src/utils/exporter.ts
parent4bd7e9ab3433426364c5102949d3fed6659aef93 (diff)
downloadSponsorBlock-a48269f254d1443752615f7139ddc405570b1dbb.tar.gz
SponsorBlock-a48269f254d1443752615f7139ddc405570b1dbb.zip
Import short category names too
Diffstat (limited to 'src/utils/exporter.ts')
-rw-r--r--src/utils/exporter.ts4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/utils/exporter.ts b/src/utils/exporter.ts
index 16b970f3..8c765a34 100644
--- a/src/utils/exporter.ts
+++ b/src/utils/exporter.ts
@@ -8,7 +8,7 @@ const inTest = typeof chrome === "undefined";
const chapterNames = CompileConfig.categoryList.filter((code) => code !== "chapter")
.map((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 {
@@ -47,7 +47,7 @@ export function importTimes(data: string, videoDuration: number): SponsorTime[]
const title = titleLeft?.length > titleRight?.length ? titleLeft : titleRight;
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 = {
segment: [startTime, GenericUtils.getFormattedTimeToSeconds(match[1])],