mirror of
https://github.com/ksyasuda/SubMiner.git
synced 2026-09-25 17:16:19 -07:00
fix(jellyfin): use the current audio track for media generation (#271)
This commit is contained in:
@@ -0,0 +1,4 @@
|
|||||||
|
type: fixed
|
||||||
|
area: jellyfin
|
||||||
|
|
||||||
|
- Timing review previews and mined card audio now use the audio track you are playing on Jellyfin direct-play streams, instead of the track Jellyfin marks as default.
|
||||||
@@ -213,6 +213,30 @@ test('resolveMediaGenerationInput reads file-local mpv request options', async (
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('resolveMediaGenerationInput keeps stream selection for a directly played remote container', async () => {
|
||||||
|
const resolver = (
|
||||||
|
mediaSource as typeof mediaSource & {
|
||||||
|
resolveMediaGenerationInput?: StructuredMediaResolver;
|
||||||
|
}
|
||||||
|
).resolveMediaGenerationInput;
|
||||||
|
assert.equal(typeof resolver, 'function');
|
||||||
|
|
||||||
|
// Jellyfin direct play: mpv opens the URL as-is, so it can hold several audio streams.
|
||||||
|
const jellyfinUrl = 'http://jellyfin.local:8096/Videos/abc/stream?static=true';
|
||||||
|
const result = await resolver!(
|
||||||
|
{
|
||||||
|
currentVideoPath: jellyfinUrl,
|
||||||
|
requestProperty: async (name: string) =>
|
||||||
|
name === 'stream-open-filename' ? jellyfinUrl : null,
|
||||||
|
},
|
||||||
|
'audio',
|
||||||
|
);
|
||||||
|
|
||||||
|
assert.equal(result?.path, jellyfinUrl);
|
||||||
|
assert.equal(result?.source, 'stream-open-filename');
|
||||||
|
assert.equal(result?.singleResolvedStream, false);
|
||||||
|
});
|
||||||
|
|
||||||
test('resolveMediaGenerationInput prefers a ready cached media file for YouTube extraction', async () => {
|
test('resolveMediaGenerationInput prefers a ready cached media file for YouTube extraction', async () => {
|
||||||
const resolver = (
|
const resolver = (
|
||||||
mediaSource as typeof mediaSource & {
|
mediaSource as typeof mediaSource & {
|
||||||
|
|||||||
@@ -400,12 +400,15 @@ export async function resolveMediaGenerationInput(
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
if (streamOpenFilename) {
|
if (streamOpenFilename) {
|
||||||
|
// A URL that yt-dlp resolved (e.g. youtube.com -> googlevideo) is one picked stream.
|
||||||
|
// When mpv opens the path as-is (e.g. Jellyfin direct play), it is the full container,
|
||||||
|
// so mpv's audio stream index still applies.
|
||||||
const result = await toResolvedMediaGenerationInput(
|
const result = await toResolvedMediaGenerationInput(
|
||||||
mpvClient,
|
mpvClient,
|
||||||
streamOpenFilename,
|
streamOpenFilename,
|
||||||
kind,
|
kind,
|
||||||
'stream-open-filename',
|
'stream-open-filename',
|
||||||
isRemoteMediaPath(streamOpenFilename),
|
isRemoteMediaPath(streamOpenFilename) && streamOpenFilename !== currentVideoPath,
|
||||||
);
|
);
|
||||||
logResolvedMediaGenerationInput(options, currentVideoPath, result);
|
logResolvedMediaGenerationInput(options, currentVideoPath, result);
|
||||||
return result;
|
return result;
|
||||||
|
|||||||
Reference in New Issue
Block a user