mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2025-12-07 03:57:09 +03:00
Add action type attribute
This commit is contained in:
@@ -3,7 +3,7 @@ import * as CompileConfig from "../../../config.json";
|
|||||||
|
|
||||||
import Config from "../../config";
|
import Config from "../../config";
|
||||||
import { AdvancedSkipRuleSet, SkipRuleAttribute, SkipRuleOperator } from "../../utils/skipRule";
|
import { AdvancedSkipRuleSet, SkipRuleAttribute, SkipRuleOperator } from "../../utils/skipRule";
|
||||||
import { CategorySkipOption } from "../../types";
|
import { ActionType, ActionTypes, CategorySkipOption } from "../../types";
|
||||||
|
|
||||||
let configSaveTimeout: NodeJS.Timeout | null = null;
|
let configSaveTimeout: NodeJS.Timeout | null = null;
|
||||||
|
|
||||||
@@ -140,6 +140,10 @@ function compileConfig(config: string): AdvancedSkipRuleSet[] | null {
|
|||||||
&& operator === SkipRuleOperator.Equal
|
&& operator === SkipRuleOperator.Equal
|
||||||
&& !CompileConfig.categoryList.includes(value as string)) {
|
&& !CompileConfig.categoryList.includes(value as string)) {
|
||||||
return null; // Invalid category value
|
return null; // Invalid category value
|
||||||
|
} else if (attribute === SkipRuleAttribute.ActionType
|
||||||
|
&& operator === SkipRuleOperator.Equal
|
||||||
|
&& !ActionTypes.includes(value as ActionType)) {
|
||||||
|
return null; // Invalid category value
|
||||||
} else if (attribute === SkipRuleAttribute.Source
|
} else if (attribute === SkipRuleAttribute.Source
|
||||||
&& operator === SkipRuleOperator.Equal
|
&& operator === SkipRuleOperator.Equal
|
||||||
&& !["local", "youtube", "autogenerated", "server"].includes(value as string)) {
|
&& !["local", "youtube", "autogenerated", "server"].includes(value as string)) {
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ export enum SkipRuleAttribute {
|
|||||||
EndTimePercent = "endTimePercent",
|
EndTimePercent = "endTimePercent",
|
||||||
DurationPercent = "durationPercent",
|
DurationPercent = "durationPercent",
|
||||||
Category = "category",
|
Category = "category",
|
||||||
|
ActionType = "actionType",
|
||||||
Description = "description",
|
Description = "description",
|
||||||
Source = "source"
|
Source = "source"
|
||||||
}
|
}
|
||||||
@@ -86,6 +87,8 @@ function getSkipRuleValue(segment: SponsorTime | VideoLabelsCacheData, rule: Adv
|
|||||||
}
|
}
|
||||||
case SkipRuleAttribute.Category:
|
case SkipRuleAttribute.Category:
|
||||||
return segment.category;
|
return segment.category;
|
||||||
|
case SkipRuleAttribute.ActionType:
|
||||||
|
return (segment as SponsorTime).actionType;
|
||||||
case SkipRuleAttribute.Description:
|
case SkipRuleAttribute.Description:
|
||||||
return (segment as SponsorTime).description || "";
|
return (segment as SponsorTime).description || "";
|
||||||
case SkipRuleAttribute.Source:
|
case SkipRuleAttribute.Source:
|
||||||
|
|||||||
Reference in New Issue
Block a user