93 lines
3.1 KiB
JavaScript
93 lines
3.1 KiB
JavaScript
const fs = require('fs');
|
|
const path = require('path');
|
|
|
|
console.log('=== 查找8个模板的不同配置(普通字幕字体、特效字幕字体、颜色都不同)===\n');
|
|
|
|
// 检查所有可能的配置文件
|
|
const filesToCheck = [
|
|
{ name: 'default-ipagent-config.json', path: 'electron/config/default-ipagent-config.json' },
|
|
{ name: 'default-ipagent-config.json (resources)', path: 'packaging/resources/common/config/default-ipagent-config.json' },
|
|
{ name: 'default-subtitle-templates.json', path: 'electron/config/default-subtitle-templates.json' },
|
|
{ name: 'C盘配置', path: 'C:\\system-templates.json' },
|
|
];
|
|
|
|
filesToCheck.forEach(fileInfo => {
|
|
if (!fs.existsSync(fileInfo.path)) {
|
|
return;
|
|
}
|
|
|
|
try {
|
|
const data = JSON.parse(fs.readFileSync(fileInfo.path, 'utf-8'));
|
|
|
|
if (data.subtitleTemplates) {
|
|
const templates = data.subtitleTemplates.filter(t =>
|
|
t.id && t.id.match(/template_system_(11|22|33|44|55|66|77|88)/)
|
|
);
|
|
|
|
if (templates.length === 8) {
|
|
console.log(`\n✅ 找到包含8个模板的配置文件: ${fileInfo.name}`);
|
|
console.log(` 路径: ${fileInfo.path}\n`);
|
|
|
|
// 检查每个模板的配置是否不同
|
|
const configs = {};
|
|
let allDifferent = true;
|
|
|
|
templates.forEach(t => {
|
|
const templateNum = t.name;
|
|
|
|
// 普通字幕字体和颜色
|
|
const normalFont = t.config?.subtitleStyle?.fontName ||
|
|
(t.config?.subtitleStyleId ? `ID: ${t.config.subtitleStyleId}` : 'N/A');
|
|
const normalColor = t.config?.subtitleStyle?.fontColor || 'N/A';
|
|
|
|
// 特效字幕字体和颜色(取第一个关键词组的配置作为代表)
|
|
const effectFont = t.config?.keywordGroupsStyles?.[0]?.styleOverride?.fontName ||
|
|
t.config?.keywordGroups?.[0]?.styleOverride?.fontName || 'N/A';
|
|
const effectColor = t.config?.keywordGroupsStyles?.[0]?.color ||
|
|
t.config?.keywordGroups?.[0]?.color || 'N/A';
|
|
|
|
const key = `${normalFont}-${normalColor}-${effectFont}-${effectColor}`;
|
|
|
|
if (configs[key]) {
|
|
allDifferent = false;
|
|
console.log(` ❌ 模板 ${templateNum} 与模板 ${configs[key]} 配置相同`);
|
|
} else {
|
|
configs[key] = templateNum;
|
|
}
|
|
|
|
console.log(` 模板 ${templateNum}:`);
|
|
console.log(` 普通字幕: 字体=${normalFont}, 颜色=${normalColor}`);
|
|
console.log(` 特效字幕: 字体=${effectFont}, 颜色=${effectColor}`);
|
|
});
|
|
|
|
if (allDifferent) {
|
|
console.log(`\n ✅ 所有8个模板的配置都不同!`);
|
|
console.log(`\n 这就是你要找的配置文件: ${fileInfo.path}`);
|
|
} else {
|
|
console.log(`\n ⚠️ 部分模板配置相同`);
|
|
}
|
|
|
|
console.log('\n' + '='.repeat(60) + '\n');
|
|
}
|
|
}
|
|
} catch (e) {
|
|
// 忽略错误
|
|
}
|
|
});
|
|
|
|
console.log('\n检查完成。如果找到8个不同配置的模板,会在上面显示。');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|