修复音乐名称和歌手信息格式化(#2733)
This commit is contained in:
@@ -10,6 +10,7 @@
|
|||||||
- 修复桌面歌词的 鼠标移入歌词区域时提高透明度 设置不稳定的问题(#2679, @Little100)
|
- 修复桌面歌词的 鼠标移入歌词区域时提高透明度 设置不稳定的问题(#2679, @Little100)
|
||||||
- 修复某些情况下可能播放没有声音的问题(#2693)
|
- 修复某些情况下可能播放没有声音的问题(#2693)
|
||||||
- 修复 tx 搜索结果显示异常的问题(#2753)
|
- 修复 tx 搜索结果显示异常的问题(#2753)
|
||||||
|
- 修复音乐名称和歌手信息格式化问题(#2733)
|
||||||
|
|
||||||
### 其他
|
### 其他
|
||||||
|
|
||||||
|
|||||||
@@ -148,3 +148,7 @@ export const clipFileNameLength = (name: string) => {
|
|||||||
return name.length > MAX_FILE_NAME_LENGTH ? name.substring(0, MAX_FILE_NAME_LENGTH) : name
|
return name.length > MAX_FILE_NAME_LENGTH ? name.substring(0, MAX_FILE_NAME_LENGTH) : name
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const formatMusicName = (format: string, name: string, singer: string) => {
|
||||||
|
// return format.replace(/歌名|歌手/g, match => match === '歌名' ? name : singer)
|
||||||
|
return format.replace('歌手', singer).replace('歌名', name)
|
||||||
|
}
|
||||||
|
|||||||
@@ -66,6 +66,7 @@ import {
|
|||||||
import { appSetting } from '@renderer/store/setting'
|
import { appSetting } from '@renderer/store/setting'
|
||||||
import { togglePlay, playNext, playPrev } from '@renderer/core/player'
|
import { togglePlay, playNext, playPrev } from '@renderer/core/player'
|
||||||
import { LIST_IDS } from '@common/constants'
|
import { LIST_IDS } from '@common/constants'
|
||||||
|
import { formatMusicName } from '@renderer/utils'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'CorePlayBar',
|
name: 'CorePlayBar',
|
||||||
@@ -112,7 +113,7 @@ export default {
|
|||||||
|
|
||||||
const title = computed(() => {
|
const title = computed(() => {
|
||||||
return musicInfo.name
|
return musicInfo.name
|
||||||
? appSetting['download.fileName'].replace('歌名', musicInfo.name).replace('歌手', musicInfo.singer)
|
? formatMusicName(appSetting['download.fileName'], musicInfo.name, musicInfo.singer)
|
||||||
: ''
|
: ''
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -66,6 +66,7 @@ import {
|
|||||||
import { appSetting } from '@renderer/store/setting'
|
import { appSetting } from '@renderer/store/setting'
|
||||||
import { togglePlay, playNext, playPrev } from '@renderer/core/player'
|
import { togglePlay, playNext, playPrev } from '@renderer/core/player'
|
||||||
import { LIST_IDS } from '@common/constants'
|
import { LIST_IDS } from '@common/constants'
|
||||||
|
import { formatMusicName } from '@renderer/utils'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'CorePlayBar',
|
name: 'CorePlayBar',
|
||||||
@@ -112,7 +113,7 @@ export default {
|
|||||||
|
|
||||||
const title = computed(() => {
|
const title = computed(() => {
|
||||||
return musicInfo.name
|
return musicInfo.name
|
||||||
? appSetting['download.fileName'].replace('歌名', musicInfo.name).replace('歌手', musicInfo.singer)
|
? formatMusicName(appSetting['download.fileName'], musicInfo.name, musicInfo.singer)
|
||||||
: ''
|
: ''
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -68,6 +68,7 @@ import {
|
|||||||
import { appSetting } from '@renderer/store/setting'
|
import { appSetting } from '@renderer/store/setting'
|
||||||
import { togglePlay, playNext, playPrev } from '@renderer/core/player'
|
import { togglePlay, playNext, playPrev } from '@renderer/core/player'
|
||||||
import { LIST_IDS } from '@common/constants'
|
import { LIST_IDS } from '@common/constants'
|
||||||
|
import { formatMusicName } from '@renderer/utils'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'CorePlayBar',
|
name: 'CorePlayBar',
|
||||||
@@ -114,7 +115,7 @@ export default {
|
|||||||
|
|
||||||
const title = computed(() => {
|
const title = computed(() => {
|
||||||
return musicInfo.name
|
return musicInfo.name
|
||||||
? appSetting['download.fileName'].replace('歌名', musicInfo.name).replace('歌手', musicInfo.singer)
|
? formatMusicName(appSetting['download.fileName'], musicInfo.name, musicInfo.singer)
|
||||||
: ''
|
: ''
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -80,6 +80,7 @@ import useTaskActions from './useTaskActions'
|
|||||||
import useMusicAdd from './useMusicAdd'
|
import useMusicAdd from './useMusicAdd'
|
||||||
import { downloadStatus } from '@renderer/store/download/state'
|
import { downloadStatus } from '@renderer/store/download/state'
|
||||||
import { appSetting } from '@renderer/store/setting'
|
import { appSetting } from '@renderer/store/setting'
|
||||||
|
import { formatMusicName } from '@renderer/utils'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'Download',
|
name: 'Download',
|
||||||
@@ -203,7 +204,7 @@ export default {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const getName = (downloadInfo) => {
|
const getName = (downloadInfo) => {
|
||||||
return appSetting['download.fileName'].replace('歌名', downloadInfo.metadata.musicInfo.name).replace('歌手', downloadInfo.metadata.musicInfo.singer)
|
return formatMusicName(appSetting['download.fileName'], downloadInfo.metadata.musicInfo.name, downloadInfo.metadata.musicInfo.singer)
|
||||||
}
|
}
|
||||||
const getTypeName = (quality) => {
|
const getTypeName = (quality) => {
|
||||||
return quality == 'flac24bit' ? 'FLAC Hires' : quality?.toUpperCase()
|
return quality == 'flac24bit' ? 'FLAC Hires' : quality?.toUpperCase()
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import { dialog } from '@renderer/plugins/Dialog'
|
|||||||
import { useI18n } from '@renderer/plugins/i18n'
|
import { useI18n } from '@renderer/plugins/i18n'
|
||||||
import { removeListMusics } from '@renderer/store/list/action'
|
import { removeListMusics } from '@renderer/store/list/action'
|
||||||
import { appSetting } from '@renderer/store/setting'
|
import { appSetting } from '@renderer/store/setting'
|
||||||
import { toOldMusicInfo } from '@renderer/utils/index'
|
import { formatMusicName, toOldMusicInfo } from '@renderer/utils/index'
|
||||||
import { addDislikeInfo, hasDislike } from '@renderer/core/dislikeList'
|
import { addDislikeInfo, hasDislike } from '@renderer/core/dislikeList'
|
||||||
import { playNext } from '@renderer/core/player'
|
import { playNext } from '@renderer/core/player'
|
||||||
import { playMusicInfo } from '@renderer/store/player/state'
|
import { playMusicInfo } from '@renderer/store/player/state'
|
||||||
@@ -34,7 +34,7 @@ export default ({ props, list, selectedList, removeAllSelect }) => {
|
|||||||
|
|
||||||
const handleCopyName = index => {
|
const handleCopyName = index => {
|
||||||
const minfo = list.value[index]
|
const minfo = list.value[index]
|
||||||
clipboardWriteText(appSetting['download.fileName'].replace('歌名', minfo.name).replace('歌手', minfo.singer))
|
clipboardWriteText(formatMusicName(appSetting['download.fileName'], minfo.name, minfo.singer))
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleDislikeMusic = async(index) => {
|
const handleDislikeMusic = async(index) => {
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import { DOWNLOAD_STATUS, QUALITYS } from '@common/constants'
|
|||||||
import { filterFileName } from '@common/utils/common'
|
import { filterFileName } from '@common/utils/common'
|
||||||
import { buildLyrics } from './lrcTool'
|
import { buildLyrics } from './lrcTool'
|
||||||
import fs from 'fs'
|
import fs from 'fs'
|
||||||
import { clipFileNameLength, clipNameLength } from '@common/utils/tools'
|
import { clipFileNameLength, clipNameLength, formatMusicName } from '@common/utils/tools'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 保存歌词文件
|
* 保存歌词文件
|
||||||
@@ -91,9 +91,7 @@ export const createDownloadInfo = (musicInfo: LX.Music.MusicInfoOnline, type: LX
|
|||||||
ext,
|
ext,
|
||||||
filePath: '',
|
filePath: '',
|
||||||
listId,
|
listId,
|
||||||
fileName: filterFileName(`${clipFileNameLength(fileName
|
fileName: filterFileName(`${clipFileNameLength(formatMusicName(fileName, musicInfo.name, clipNameLength(musicInfo.singer)))}.${ext}`),
|
||||||
.replace('歌名', musicInfo.name)
|
|
||||||
.replace('歌手', clipNameLength(musicInfo.singer)))}.${ext}`),
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
// downloadInfo.metadata.filePath = joinPath(savePath, downloadInfo.metadata.fileName)
|
// downloadInfo.metadata.filePath = joinPath(savePath, downloadInfo.metadata.fileName)
|
||||||
|
|||||||
Reference in New Issue
Block a user