mirror of
https://github.com/ksyasuda/SubMiner.git
synced 2026-08-16 13:55:51 -07:00
fix(subsync): decode file:// tracks mpv reports for dropped subtitles
- Sync a subtitle dropped onto mpv without hitting "Protocol file: not supported"; decode file:// external-filename/path back to a real path for target, reference, and video - Stream strip proxy: destroy the connection instead of retrying/502 once a response is handed off, and cap buffered playlist bodies - Bridge installer: cap downloaded bundle size to guard against a lying/missing content-length - Anime browser playback: bump generation on dispose so a stale in-flight playEpisode cleans up its own subtitle cache - Fix a flaky sidecar-process test by binding to an OS-assigned port instead of pre-allocating one
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import test from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
import { codecToExtension, getSubsyncConfig } from './utils';
|
||||
import { codecToExtension, getSubsyncConfig, resolveLocalMediaPath } from './utils';
|
||||
|
||||
test('codecToExtension maps stream/web formats to ffmpeg extractable extensions', () => {
|
||||
assert.equal(codecToExtension('subrip'), 'srt');
|
||||
@@ -22,3 +22,21 @@ test('getSubsyncConfig respects explicit replace value', () => {
|
||||
assert.equal(getSubsyncConfig({ replace: false }).replace, false);
|
||||
assert.equal(getSubsyncConfig({ replace: true }).replace, true);
|
||||
});
|
||||
|
||||
test('resolveLocalMediaPath decodes file URLs mpv reports for dropped files', () => {
|
||||
assert.equal(
|
||||
resolveLocalMediaPath('file:///home/user/subs/%E3%83%AF%E3%83%B3%20sdh.srt'),
|
||||
'/home/user/subs/ワン sdh.srt',
|
||||
);
|
||||
assert.equal(resolveLocalMediaPath('FILE:///tmp/ref.srt'), '/tmp/ref.srt');
|
||||
});
|
||||
|
||||
test('resolveLocalMediaPath leaves plain paths and stream URLs alone', () => {
|
||||
assert.equal(resolveLocalMediaPath('/tmp/ref.srt'), '/tmp/ref.srt');
|
||||
assert.equal(
|
||||
resolveLocalMediaPath('https://jellyfin.example/subs/eng.srt'),
|
||||
'https://jellyfin.example/subs/eng.srt',
|
||||
);
|
||||
// A UNC host has no local path; the caller's own error is the useful one.
|
||||
assert.equal(resolveLocalMediaPath('file://host/share/ref.srt'), 'file://host/share/ref.srt');
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user