mirror of
https://github.com/ksyasuda/SubMiner.git
synced 2026-08-16 13:55:51 -07:00
fix(anime): keep browser state in sync and alias HLS segments
- Toggle the player Anime Browser without losing its state - Share active playback state and support rotating fake segment extensions
This commit is contained in:
@@ -3,6 +3,7 @@ import assert from 'node:assert/strict';
|
||||
import {
|
||||
createStreamPlaybackMetadataStore,
|
||||
matchRequestedStreamPlaybackMetadata,
|
||||
toAnimeBrowserPlaybackState,
|
||||
toAnilistMediaGuess,
|
||||
toJimakuMediaInfo,
|
||||
} from './stream-playback-metadata';
|
||||
@@ -10,6 +11,9 @@ import type { AnimeStreamMetadata } from '../../anime-bridge/episode-metadata';
|
||||
|
||||
function metadata(overrides: Partial<AnimeStreamMetadata> = {}): AnimeStreamMetadata {
|
||||
return {
|
||||
sourceId: '9001',
|
||||
animeUrl: '/anime/mushoku',
|
||||
episodeUrl: '/watch/ep-4',
|
||||
mediaPath: 'http://127.0.0.1:41234/video/abc.m3u8',
|
||||
statsPath: 'animebrowser://9001/%2Fanime%2Fmushoku/%2Fwatch%2Fep-4',
|
||||
seriesTitle: 'Mushoku Tensei: Jobless Reincarnation',
|
||||
@@ -21,6 +25,15 @@ function metadata(overrides: Partial<AnimeStreamMetadata> = {}): AnimeStreamMeta
|
||||
};
|
||||
}
|
||||
|
||||
test('browser playback state keeps the source episode identity and drops other media', () => {
|
||||
assert.deepEqual(toAnimeBrowserPlaybackState(metadata()), {
|
||||
sourceId: '9001',
|
||||
animeUrl: '/anime/mushoku',
|
||||
episodeUrl: '/watch/ep-4',
|
||||
});
|
||||
assert.equal(toAnimeBrowserPlaybackState(null), null);
|
||||
});
|
||||
|
||||
test('the store answers for the stream URL and for the stats path', () => {
|
||||
const store = createStreamPlaybackMetadataStore();
|
||||
const current = metadata();
|
||||
|
||||
Reference in New Issue
Block a user