diff --git a/src/types.ts b/src/types.ts index 5ff683a7..7780a4a4 100644 --- a/src/types.ts +++ b/src/types.ts @@ -31,6 +31,7 @@ export interface VideoDurationResponse { } export enum CategorySkipOption { + Disabled = -1, ShowOverlay, ManualSkip, AutoSkip diff --git a/src/utils.ts b/src/utils.ts index 92e29d8b..537fa3f3 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -1,5 +1,5 @@ import Config, { VideoDownvotes } from "./config"; -import { CategorySelection, SponsorTime, BackgroundScriptContainer, Registration, VideoID, SponsorHideType } from "./types"; +import { CategorySelection, SponsorTime, BackgroundScriptContainer, Registration, VideoID, SponsorHideType, CategorySkipOption } from "./types"; import { getHash, HashedValue } from "@ajayyy/maze-utils/lib/hash"; import * as CompileConfig from "../config.json"; @@ -225,7 +225,7 @@ export default class Utils { return selection; } } - return { name: "None", option: 0} as CategorySelection; + return { name: category, option: CategorySkipOption.Disabled} as CategorySelection; } /** diff --git a/src/utils/videoLabels.ts b/src/utils/videoLabels.ts index ca12c6e4..15815ab9 100644 --- a/src/utils/videoLabels.ts +++ b/src/utils/videoLabels.ts @@ -1,4 +1,4 @@ -import { Category, VideoID } from "../types"; +import { Category, CategorySkipOption, VideoID } from "../types"; import { getHash } from "@ajayyy/maze-utils/lib/hash"; import Utils from "../utils"; import { logWarn } from "./logger"; @@ -58,7 +58,12 @@ export async function getVideoLabel(videoID: VideoID): Promise const result = await getLabelHashBlock(prefix); if (result) { - return result.videos[videoID] ?? null; + const category = result.videos[videoID]; + if (category && utils.getCategorySelection(category).option !== CategorySkipOption.Disabled) { + return category; + } else { + return null; + } } return null;