├── .gitignore ├── README.md ├── dist ├── bncm-plugin.dll ├── index.js └── manifest.json ├── index.ts ├── lyric.ts ├── lyric_provider.js ├── manifest.json ├── ncm.d.ts └── package.json /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | yarn.lock -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # CppLyrics-Plugin 2 | 3 | CppLyrics for BetterNCM Windows 4 | 5 | ![image](https://github.com/BetterNCM/CppLyrics-Plugin/assets/66859419/9e2e70bf-57f8-4c68-9faf-4c558a67f43d) 6 | ![image](https://github.com/BetterNCM/CppLyrics-Plugin/assets/66859419/fd7e48a9-9861-41ae-95d8-8b10add80c82) 7 | ![image](https://github.com/BetterNCM/CppLyrics-Plugin/assets/66859419/5bddd2c9-f841-4a19-8c19-8e8da1880dc6) 8 | ![image](https://github.com/BetterNCM/CppLyrics-Plugin/assets/66859419/8acad5f5-2c87-4fcd-85f1-65e56830c35c) 9 | ![image](https://github.com/BetterNCM/CppLyrics-Plugin/assets/66859419/fd75406b-95fc-4b28-b6bb-034283bfcbed) 10 | ![image](https://github.com/BetterNCM/CppLyrics-Plugin/assets/66859419/2f2ce6c1-eec1-46bc-83c3-b1cedd7cb7a3) 11 | ![image](https://github.com/BetterNCM/CppLyrics-Plugin/assets/66859419/664536a4-13a9-45fb-b8e4-4aca21e2dbb3) 12 | -------------------------------------------------------------------------------- /dist/bncm-plugin.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BetterNCM/CppLyrics-Plugin/424a6fe579c88ecebe3583db887f2bf7eb75902f/dist/bncm-plugin.dll -------------------------------------------------------------------------------- /dist/index.js: -------------------------------------------------------------------------------- 1 | (()=>{var me=(e,t)=>{for(let r=e.length-1;r>=0;r--)if(t(e[r]))return e[r];return null},fe=[{time:0,duration:594e4,originalLyric:"\u7EAF\u97F3\u4E50\uFF0C\u8BF7\u6B23\u8D4F"}];var Jt={};function pe(e,t){typeof e>"u"&&(e=""),typeof t>"u"&&(t="");let r=`${e}::${t}`;if(Jt[r]!==void 0)return Jt[r];let n=e.length,o=t.length,s=[];for(let a=0;a<=n;a++)s[a]=[],s[a][0]=a;for(let a=0;a<=o;a++)s[0][a]=a;for(let a=1;a<=n;a++)for(let i=1;i<=o;i++)e[a-1]===t[i-1]?s[a][i]=s[a-1][i-1]:s[a][i]=Math.min(s[a-1][i-1]+1,s[a][i-1]+1,s[a-1][i]+1);return s[n][o]}var de=e=>!!e.replace(/[\p{P}\p{S}]/gu,"").match(/^[\s\w\u00C0-\u024F]+$/u),Xt=e=>e.replace(/[‘’′]/g,"'").replace(/[“”″]/g,'"').replace(/(/g,"(").replace(/)/g,")").replace(/,/g,",").replace(/!/g,"!").replace(/?/g,"?").replace(/:/g,":").replace(/;/g,";");function vt(e,t="",r="",n=""){if(n.trim().length===0){let o=et(e).map(a=>({time:a.time,originalLyric:a.lyric,duration:0,...a.unsynced?{unsynced:!0}:{}}));et(t).forEach(a=>{let i=o.find(c=>c.time===a.time);i&&(i.translatedLyric=a.lyric)}),et(r).forEach(a=>{let i=o.find(c=>c.time===a.time);i&&(i.romanLyric=a.lyric)}),o.sort((a,i)=>a.time-i.time);let s=Ht(o);for(let a=0;a{let h="equal",f=new Set(p.map(C=>C.time)),m=new Set(s.map(C=>C.time));return new Set([...f].filter(C=>m.has(C))).size/f.size<.1&&(h="closest"),s.forEach(C=>{let d=null;h==="equal"?d=me(p,P=>Math.abs(P.time-C.time)<20):p.forEach(P=>{d?Math.abs(d.time-C.time)>Math.abs(P.time-C.time)&&(d=P):d=P}),d&&(d.originalLyric=d.originalLyric||"",d.originalLyric.length>0&&(d.originalLyric+=" "),d.originalLyric+=C.lyric)}),p},i=(p,h)=>{p.forEach((f,m)=>{let y=0;o.forEach((b,w)=>{Math.abs(o[y].time-f.time)>Math.abs(b.time-f.time)&&(y=w)});let C=[y];for(let b=1;b<=5;b++)y-b>=0&&C.push(y-b),y+b0&&(P[h]+=" "),P[h]+=f.lyric})},c=a(et(t)),g=a(et(r)),u=a(et(e));i(c,"translatedLyric"),i(g,"romanLyric"),i(u,"rawLyric");for(let p=0;p0&&f.originalLyric.trim().length>0&&h.duration>0){let m=(h?.dynamicLyricTime||h.time)+h.duration,y=f.time;f.dynamicLyricTime&&y>f.dynamicLyricTime&&(y=f.dynamicLyricTime),y-m>=5e3&&o.splice(p+1,0,{time:m,originalLyric:"",duration:y-m})}}for(let p=0;p=1;y--){let C=null;for(let P=m[y];P>m[y-1];P--){let b=f[P].word.trim();if(!b.match(/[\p{P}\p{S}]/gu)&&!b.match(/^\s*$/)){C=P;break}}if(C===null)continue;let d=f[C];d.duration>=1e3&&(d.trailing=!0)}}return Ht(o)}}var ge=/^\[(?