mirror of
https://github.com/ksyasuda/SubMiner.git
synced 2026-05-26 00:55:16 -07:00
style: format youtube runtime files
This commit is contained in:
@@ -30,7 +30,10 @@ test('isYoutubePlaybackActive checks both current media and mpv video paths', ()
|
|||||||
|
|
||||||
test('isSameYoutubeMediaPath matches equivalent youtube urls by video id', () => {
|
test('isSameYoutubeMediaPath matches equivalent youtube urls by video id', () => {
|
||||||
assert.equal(
|
assert.equal(
|
||||||
isSameYoutubeMediaPath('https://www.youtube.com/watch?v=abc123&t=30', 'https://youtu.be/abc123'),
|
isSameYoutubeMediaPath(
|
||||||
|
'https://www.youtube.com/watch?v=abc123&t=30',
|
||||||
|
'https://youtu.be/abc123',
|
||||||
|
),
|
||||||
true,
|
true,
|
||||||
);
|
);
|
||||||
assert.equal(
|
assert.equal(
|
||||||
|
|||||||
@@ -78,10 +78,7 @@ export function shouldUseCachedYoutubeParsedCues(input: {
|
|||||||
cachedMediaPath: string | null | undefined;
|
cachedMediaPath: string | null | undefined;
|
||||||
cachedCueCount: number;
|
cachedCueCount: number;
|
||||||
}): boolean {
|
}): boolean {
|
||||||
return (
|
return input.cachedCueCount > 0 && isSameYoutubeMediaPath(input.videoPath, input.cachedMediaPath);
|
||||||
input.cachedCueCount > 0 &&
|
|
||||||
isSameYoutubeMediaPath(input.videoPath, input.cachedMediaPath)
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export function isYoutubePlaybackActive(
|
export function isYoutubePlaybackActive(
|
||||||
|
|||||||
@@ -111,7 +111,10 @@ export function createYoutubePrimarySubtitleNotificationRuntime(deps: {
|
|||||||
delayMs: number,
|
delayMs: number,
|
||||||
) => YoutubePrimarySubtitleNotificationTimer;
|
) => YoutubePrimarySubtitleNotificationTimer;
|
||||||
clearSchedule: (timer: YoutubePrimarySubtitleNotificationTimer | null) => void;
|
clearSchedule: (timer: YoutubePrimarySubtitleNotificationTimer | null) => void;
|
||||||
getCurrentSubtitleState?: () => CurrentSubtitleState | null | Promise<CurrentSubtitleState | null>;
|
getCurrentSubtitleState?: () =>
|
||||||
|
| CurrentSubtitleState
|
||||||
|
| null
|
||||||
|
| Promise<CurrentSubtitleState | null>;
|
||||||
delayMs?: number;
|
delayMs?: number;
|
||||||
}) {
|
}) {
|
||||||
const delayMs = deps.delayMs ?? 5000;
|
const delayMs = deps.delayMs ?? 5000;
|
||||||
@@ -128,9 +131,7 @@ export function createYoutubePrimarySubtitleNotificationRuntime(deps: {
|
|||||||
pendingTimer = null;
|
pendingTimer = null;
|
||||||
};
|
};
|
||||||
|
|
||||||
const refreshCurrentSubtitleState = async (
|
const refreshCurrentSubtitleState = async (preferredLanguages: Set<string>): Promise<boolean> => {
|
||||||
preferredLanguages: Set<string>,
|
|
||||||
): Promise<boolean> => {
|
|
||||||
const getCurrentSubtitleState = deps.getCurrentSubtitleState;
|
const getCurrentSubtitleState = deps.getCurrentSubtitleState;
|
||||||
if (!getCurrentSubtitleState) {
|
if (!getCurrentSubtitleState) {
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
Reference in New Issue
Block a user