mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2025-12-06 19:47:04 +03:00
Import short category names too
This commit is contained in:
@@ -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])],
|
||||||
|
|||||||
Reference in New Issue
Block a user