diff --git a/publish/changeLog.md b/publish/changeLog.md index 604f744a..013b8151 100644 --- a/publish/changeLog.md +++ b/publish/changeLog.md @@ -3,6 +3,7 @@ - 优化kw歌单列表数据显示 - 同步服务在连接时允许URL重定向 - Linux 点击托盘时将显示主界面(#2840) +- 优化自动换源歌曲匹配机制 ### 修复 diff --git a/src/renderer/utils/musicSdk/index.js b/src/renderer/utils/musicSdk/index.js index 58f75686..e0b53d19 100644 --- a/src/renderer/utils/musicSdk/index.js +++ b/src/renderer/utils/musicSdk/index.js @@ -6,6 +6,7 @@ import mg from './mg/index' import bd from './bd/index' import xm from './xm' import { supportQuality } from './api-source' +import { versionChars } from './versionChars' const sources = { @@ -114,8 +115,14 @@ export default { const fSinger = filterStr(sortSingle(singer)).toLowerCase() const fAlbumName = filterStr(albumName).toLowerCase() const fInterval = getIntv(interval) - const isEqualsInterval = (intv) => Math.abs((fInterval || intv) - (intv || fInterval)) < 5 - const isIncludesName = (name) => (fMusicName.includes(name) || name.includes(fMusicName)) + const isEqualsInterval = (intv) => Math.abs((fInterval || intv) - (intv || fInterval)) <= 5 + const isEqualsVersionMusicNameChar = (name) => { + for (const char of versionChars) { + if (name.includes(char) != fMusicName.includes(char)) return false + } + return true + } + const isIncludesName = (name) => (fMusicName.includes(name) || name.includes(fMusicName)) && isEqualsVersionMusicNameChar(name) const isIncludesSinger = (singer) => fSinger ? (fSinger.includes(singer) || singer.includes(fSinger)) : true const isEqualsAlbum = (album) => fAlbumName ? fAlbumName == album : true diff --git a/src/renderer/utils/musicSdk/versionChars.ts b/src/renderer/utils/musicSdk/versionChars.ts new file mode 100644 index 00000000..e1e389f4 --- /dev/null +++ b/src/renderer/utils/musicSdk/versionChars.ts @@ -0,0 +1,124 @@ +export const versionChars = [ + // 伴奏 / 无人声 + // instrumental: [ + 'instrumental', + 'inst', + 'karaoke', + 'backing track', + 'minus one', + 'minus vocal', + 'no vocal', + 'off vocal', + 'vocal removed', + '伴奏', + '伴唱', + '卡拉ok', + '纯音乐', + '无人声', + '去人声', + '消音', + 'オフボーカル', + 'インスト', + '반주', + '노래방', + // ], + + // 现场 + // live: [ + 'live', + 'concert', + 'tour', + 'festival', + 'stage', + 'session', + '现场', + '演唱会', + '巡演', + '音乐会', + 'ライブ', + '공연', + '라이브', + // ], + + // 翻唱 + // cover: [ + 'cover', + 'tribute', + 'rendition', + 'remake', + '翻唱', + '致敬', + '改编', + 'カバー', + '커버', + // ], + + // 混音 + // remix: [ + 'remix', + 'mix', + 'club', + 'dance', + 'extended', + 'house', + 'edm', + 'dj', + 'dub', + 'trap', + '混音', + '重混', + '电音', + 'リミックス', + '리믹스', + // ], + + // 原声 / 不插电 + // acoustic: [ + 'acoustic', + 'unplugged', + 'stripped', + '原声', + '不插电', + 'アコースティック', + '어쿠스틱', + // ], + + // Demo + // demo: [ + 'demo', + '小样', + '试听', + 'デモ', + '데모', + // ], + + // 速度变化 + // speed: [ + 'slowed', + 'slowed reverb', + 'sped up', + 'speed up', + 'nightcore', + '慢速', + '加速', + '变速', + 'ナイトコア', + // ], + + // 特殊乐器版 + // special_instrumental: [ + 'piano', + 'guitar', + 'orchestra', + 'symphony', + 'violin', + '钢琴', + '吉他', + '管弦乐', + '小提琴', + 'ピアノ', + 'ギター', + '피아노', + '기타', + // ] +]