feat: add manual AniList selection for character dictionaries

This commit is contained in:
2026-04-25 15:53:20 -07:00
parent 60435fee10
commit 055bd76718
78 changed files with 1986 additions and 160 deletions

View File

@@ -190,7 +190,43 @@ test('dictionary command forwards --dictionary and target path to app binary', (
});
assert.equal(handled, true);
assert.deepEqual(forwarded, [['--dictionary', '--dictionary-target', '/tmp/anime']]);
assert.deepEqual(forwarded, [['--start', '--dictionary', '--dictionary-target', '/tmp/anime']]);
});
test('dictionary command forwards candidate and selection modes to app binary', () => {
const candidatesContext = createContext();
candidatesContext.args.dictionary = true;
candidatesContext.args.dictionaryCandidates = true;
candidatesContext.args.dictionaryTarget = '/tmp/anime.mkv';
const selectContext = createContext();
selectContext.args.dictionary = true;
selectContext.args.dictionarySelect = true;
selectContext.args.dictionaryAnilistId = 21355;
selectContext.args.dictionaryTarget = '/tmp/anime.mkv';
const forwarded: string[][] = [];
runDictionaryCommand(candidatesContext, {
runAppCommandWithInherit: (_appPath, appArgs) => {
forwarded.push(appArgs);
},
});
runDictionaryCommand(selectContext, {
runAppCommandWithInherit: (_appPath, appArgs) => {
forwarded.push(appArgs);
},
});
assert.deepEqual(forwarded, [
['--start', '--dictionary-candidates', '--dictionary-target', '/tmp/anime.mkv'],
[
'--start',
'--dictionary-select',
'--dictionary-anilist-id',
'21355',
'--dictionary-target',
'/tmp/anime.mkv',
],
]);
});
test('dictionary command returns after app handoff starts', () => {

View File

@@ -18,7 +18,20 @@ export function runDictionaryCommand(
return false;
}
const forwarded = ['--dictionary'];
const forwarded = [
'--start',
args.dictionaryCandidates
? '--dictionary-candidates'
: args.dictionarySelect
? '--dictionary-select'
: '--dictionary',
];
if (args.dictionarySelect) {
if (!args.dictionaryAnilistId) {
throw new Error('Dictionary selection requires an AniList media ID.');
}
forwarded.push('--dictionary-anilist-id', String(args.dictionaryAnilistId));
}
if (typeof args.dictionaryTarget === 'string' && args.dictionaryTarget.trim()) {
forwarded.push('--dictionary-target', args.dictionaryTarget);
}

View File

@@ -44,6 +44,8 @@ function createContext(): LauncherCommandContext {
jellyfinPlay: false,
jellyfinDiscovery: false,
dictionary: false,
dictionaryCandidates: false,
dictionarySelect: false,
stats: false,
doctor: false,
doctorRefreshKnownWords: false,