feat: 添加版本字符常量以优化歌曲匹配机制

This commit is contained in:
lyswhut
2026-08-04 23:57:28 +08:00
parent 9ff8ae2587
commit 65ff972d1a
3 changed files with 134 additions and 2 deletions
+1
View File
@@ -3,6 +3,7 @@
- 优化kw歌单列表数据显示 - 优化kw歌单列表数据显示
- 同步服务在连接时允许URL重定向 - 同步服务在连接时允许URL重定向
- Linux 点击托盘时将显示主界面(#2840) - Linux 点击托盘时将显示主界面(#2840)
- 优化自动换源歌曲匹配机制
### 修复 ### 修复
+9 -2
View File
@@ -6,6 +6,7 @@ import mg from './mg/index'
import bd from './bd/index' import bd from './bd/index'
import xm from './xm' import xm from './xm'
import { supportQuality } from './api-source' import { supportQuality } from './api-source'
import { versionChars } from './versionChars'
const sources = { const sources = {
@@ -114,8 +115,14 @@ export default {
const fSinger = filterStr(sortSingle(singer)).toLowerCase() const fSinger = filterStr(sortSingle(singer)).toLowerCase()
const fAlbumName = filterStr(albumName).toLowerCase() const fAlbumName = filterStr(albumName).toLowerCase()
const fInterval = getIntv(interval) const fInterval = getIntv(interval)
const isEqualsInterval = (intv) => Math.abs((fInterval || intv) - (intv || fInterval)) < 5 const isEqualsInterval = (intv) => Math.abs((fInterval || intv) - (intv || fInterval)) <= 5
const isIncludesName = (name) => (fMusicName.includes(name) || name.includes(fMusicName)) 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 isIncludesSinger = (singer) => fSinger ? (fSinger.includes(singer) || singer.includes(fSinger)) : true
const isEqualsAlbum = (album) => fAlbumName ? fAlbumName == album : true const isEqualsAlbum = (album) => fAlbumName ? fAlbumName == album : true
+124
View File
@@ -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',
'钢琴',
'吉他',
'管弦乐',
'小提琴',
'ピアノ',
'ギター',
'피아노',
'기타',
// ]
]