const fs = require('fs');
const path = require('path');

// 读取 JSON 配置文件
const jsonFile = path.join(__dirname, '../electron/resources/extra/common/config/system-templates.json');
const data = JSON.parse(fs.readFileSync(jsonFile, 'utf-8'));

console.log('=== 模板标题字幕配置对比 ===\n');

const templates = data.subtitleTemplates || [];

templates.forEach(t => {
  const title = t.config.titleSubtitleConfig;
  if (title) {
    console.log(`模板 ${t.name}:`);
    console.log(`  - 每行字符数: ${title.maxCharsPerLine}`);
    console.log(`  - 行数: ${title.lines.length}`);
    title.lines.forEach((l, i) => {
      console.log(`  - 第${i + 1}行: "${l.text}" (${l.fontName}, ${l.fontColor})`);
    });
    console.log('');
  }
});

// 找出相同的模板
console.log('\n=== 相同配置的模板组 ===\n');

const groups = {};
templates.forEach(t => {
  const title = t.config.titleSubtitleConfig;
  if (title) {
    const key = `${title.maxCharsPerLine}-${title.lines.length}-${title.lines.map(l => `${l.text}:${l.fontName}:${l.fontColor}`).join('|')}`;
    if (!groups[key]) {
      groups[key] = [];
    }
    groups[key].push(t.name);
  }
});

Object.keys(groups).forEach(key => {
  if (groups[key].length > 1) {
    console.log(`模板 ${groups[key].join(', ')} 配置相同`);
  }
});














