mirror of
https://github.com/ksyasuda/SubMiner.git
synced 2026-11-22 16:46:10 -08:00
- Add `subtitleFilter` config with four presets: parentheses, brackets, speaker prefix and music symbols. Custom regex rules run after the presets. - Filter primary text where it enters the app (live `sub-text` and parsed cues), so the overlay, sidebar, mining and stats all get the same filtered text. - Changes hot-reload: the current line is read again and the active track is parsed again, using the filter config as the prefetch parse key. - Add a custom rule editor in Settings under Behavior → Subtitle Filters that checks patterns as you type. - Update the config example, the configuration docs and the architecture domains doc, and add a changelog fragment.
40 lines
1.3 KiB
TypeScript
40 lines
1.3 KiB
TypeScript
import { ConfigValidationWarning, RawConfig, ResolvedConfig } from '../types/config';
|
|
import { applyAnkiConnectResolution } from './resolve/anki-connect';
|
|
import { createResolveContext } from './resolve/context';
|
|
import { applyCoreDomainConfig } from './resolve/core-domains';
|
|
import { applyImmersionTrackingConfig } from './resolve/immersion-tracking';
|
|
import { applyIntegrationConfig } from './resolve/integrations';
|
|
import { applyPluginsConfig } from './resolve/plugins';
|
|
import { applyStatsConfig } from './resolve/stats';
|
|
import { applySubtitleDomainConfig } from './resolve/subtitle-domains';
|
|
import { applySubtitleFilterConfig } from './resolve/subtitle-filter';
|
|
import { applyTopLevelConfig } from './resolve/top-level';
|
|
|
|
const APPLY_RESOLVE_STEPS = [
|
|
applyTopLevelConfig,
|
|
applyCoreDomainConfig,
|
|
applySubtitleDomainConfig,
|
|
applySubtitleFilterConfig,
|
|
applyIntegrationConfig,
|
|
applyImmersionTrackingConfig,
|
|
applyStatsConfig,
|
|
applyPluginsConfig,
|
|
applyAnkiConnectResolution,
|
|
] as const;
|
|
|
|
export function resolveConfig(raw: RawConfig): {
|
|
resolved: ResolvedConfig;
|
|
warnings: ConfigValidationWarning[];
|
|
} {
|
|
const { context, warnings } = createResolveContext(raw);
|
|
|
|
for (const applyStep of APPLY_RESOLVE_STEPS) {
|
|
applyStep(context);
|
|
}
|
|
|
|
return {
|
|
resolved: context.resolved,
|
|
warnings,
|
|
};
|
|
}
|