mirror of
https://github.com/algerkong/AlgerMusicPlayer.git
synced 2026-04-14 14:50:50 +08:00
Compare commits
60 Commits
v4.9.0
...
56adac0d4e
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
56adac0d4e | ||
|
|
452e1d1129 | ||
|
|
34ba2250bf | ||
|
|
1005718c07 | ||
|
|
3527da17da | ||
|
|
9bf513d35d | ||
|
|
35b798b69e | ||
|
|
9535183405 | ||
|
|
6d7ba6dbae | ||
|
|
a9adb6be36 | ||
|
|
bee5445b6e | ||
|
|
316d5932e3 | ||
|
|
a5d3ff359c | ||
|
|
77f3069e67 | ||
|
|
f3a9f8b979 | ||
|
|
29ba231a7d | ||
|
|
cb2baeadf5 | ||
|
|
4575e4f26d | ||
|
|
dc8957dcf2 | ||
|
|
c83ad48ef4 | ||
|
|
67370b9072 | ||
|
|
93022691e2 | ||
|
|
0df86b583b | ||
|
|
df3a7994cb | ||
|
|
8fb4c4df68 | ||
|
|
56922caa40 | ||
|
|
abbbf7e771 | ||
|
|
6d9235902a | ||
|
|
659c9f9a4c | ||
|
|
8f0728d9db | ||
|
|
8f9c989815 | ||
|
|
d8734f8302 | ||
|
|
74b9d73241 | ||
|
|
10421fa4d2 | ||
|
|
d05a63c5e3 | ||
|
|
a9f76c7952 | ||
|
|
70677dfb14 | ||
|
|
e9ef7123e7 | ||
|
|
5fbe4c3ad4 | ||
|
|
bce02532ef | ||
|
|
9003de8d4b | ||
|
|
c98f5bb608 | ||
|
|
6e67263766 | ||
|
|
e91667a2e6 | ||
|
|
7306722fcf | ||
|
|
76db7e3ad6 | ||
|
|
8aaabf4b65 | ||
|
|
292ab56be8 | ||
|
|
5ab3143fdd | ||
|
|
08f7e5adfe | ||
|
|
2a8d0f2066 | ||
|
|
fb8b4c9341 | ||
|
|
dc99331911 | ||
|
|
7ae6e041b5 | ||
|
|
1171e0f9e7 | ||
|
|
df236e491c | ||
|
|
4368c05b80 | ||
|
|
d24d3d63b8 | ||
|
|
ad57673129 | ||
|
|
ad51f57bd7 |
2
.gitignore
vendored
2
.gitignore
vendored
@@ -30,6 +30,8 @@ resources/android/**/*
|
||||
android/app/release
|
||||
|
||||
.cursor
|
||||
.windsurf
|
||||
|
||||
|
||||
.auto-imports.d.ts
|
||||
.components.d.ts
|
||||
|
||||
@@ -1,2 +1,7 @@
|
||||
echo "对已暂存文件运行 lint-staged..."
|
||||
npx lint-staged
|
||||
|
||||
echo "运行类型检查..."
|
||||
npm run typecheck
|
||||
npm run typecheck
|
||||
|
||||
echo "所有检查通过,准备提交..."
|
||||
@@ -1,2 +1,7 @@
|
||||
echo "对已暂存文件运行 lint-staged..."
|
||||
npx lint-staged
|
||||
|
||||
echo "运行类型检查..."
|
||||
npm run typecheck
|
||||
npm run typecheck
|
||||
|
||||
echo "所有检查通过,准备提交..."
|
||||
62
custom-api-readme.md
Normal file
62
custom-api-readme.md
Normal file
@@ -0,0 +1,62 @@
|
||||
## 🎵 自定义音源API配置
|
||||
|
||||
现在支持通过导入一个简单的 JSON 配置文件来对接第三方的音乐解析 API。这将提供极大的灵活性,可以接入任意第三方音源。
|
||||
|
||||
### 如何使用
|
||||
|
||||
1. 前往 **设置 -> 播放设置 -> 音源设置**。
|
||||
2. 在 **自定义 API 设置** 区域,点击 **“导入 JSON 配置”** 按钮。
|
||||
3. 选择你已经编写好的 `xxx.json` 配置文件。
|
||||
4. 导入成功后,程序将优先使用你的自定义 API 进行解析。
|
||||
|
||||
### JSON 配置文件格式说明
|
||||
|
||||
导入的配置文件必须是一个合法的 JSON 文件,并包含以下字段:
|
||||
|
||||
| 字段名 | 类型 | 是否必须 | 描述 |
|
||||
| ---------------- | --------- | -------- | ---------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `name` | `string` | 是 | API 名称,将显示在应用的 UI 界面上。 |
|
||||
| `apiUrl` | `string` | 是 | API 的基础请求地址。 |
|
||||
| `method` | `string` | 否 | HTTP 请求方法。可以是 `"GET"` 或 `"POST"`。**如果省略,默认为 "GET"**。 |
|
||||
| `params` | `object` | 是 | 请求时需要发送的参数。对于 `GET` 请求,它们会作为查询字符串;对于 `POST` 请求,它们会作为请求体。 |
|
||||
| `qualityMapping` | `object` | 否 | **音质映射表**。用于将应用内部的音质值(如 `"lossless"`)翻译成你的 API 需要的特定值。如果省略,则直接使用应用内部值。 |
|
||||
| `responseUrlPath`| `string` | 是 | **URL提取路径**。用于从 API 返回的 JSON 响应中找到最终可播放的音乐链接。支持点 `.` 和方括号 `[]` 语法来访问嵌套对象和数组。 |
|
||||
|
||||
#### 占位符
|
||||
|
||||
在 `params` 对象的值中,你可以使用以下占位符,程序在请求时会自动替换它们:
|
||||
|
||||
* `{songId}`: 将被替换为当前歌曲的 ID。
|
||||
* `{quality}`: 将被替换为当前用户设置的音质字符串 (例如, `"higher"`, `"lossless"`)。
|
||||
|
||||
#### 音质值列表
|
||||
|
||||
应用内部使用的音质值如下,你可以在 `qualityMapping` 中使用它们作为**键**:
|
||||
`standard`, `higher`, `exhigh`, `lossless`, `hires`, `jyeffect`, `sky`, `dolby`, `jymaster`
|
||||
|
||||
### 示例
|
||||
|
||||
假设有一个 API 如下:
|
||||
`https://api.example.com/music?song_id=12345&bitrate=320000`
|
||||
它返回的 JSON 是:
|
||||
`{ "code": 200, "data": { "play_url": "http://..." } }`
|
||||
|
||||
那么对应的 JSON 配置文件应该是:
|
||||
|
||||
```json
|
||||
{
|
||||
"name": "Example API",
|
||||
"apiUrl": "https://api.example.com/music",
|
||||
"method": "GET",
|
||||
"params": {
|
||||
"song_id": "{songId}",
|
||||
"bitrate": "{quality}"
|
||||
},
|
||||
"qualityMapping": {
|
||||
"higher": "128000",
|
||||
"exhigh": "320000",
|
||||
"lossless": "999000"
|
||||
},
|
||||
"responseUrlPath": "data.play_url"
|
||||
}
|
||||
```
|
||||
@@ -22,7 +22,6 @@ mac:
|
||||
entitlementsInherit: build/entitlements.mac.plist
|
||||
extendInfo:
|
||||
- NSCameraUsageDescription: Application requests access to the device's camera.
|
||||
- NSMicrophoneUsageDescription: Application requests access to the device's microphone.
|
||||
- NSDocumentsFolderUsageDescription: Application requests access to the user's Documents folder.
|
||||
- NSDownloadsFolderUsageDescription: Application requests access to the user's Downloads folder.
|
||||
notarize: false
|
||||
|
||||
@@ -40,7 +40,8 @@ export default defineConfig({
|
||||
],
|
||||
publicDir: resolve('resources'),
|
||||
server: {
|
||||
host: '0.0.0.0'
|
||||
host: '0.0.0.0',
|
||||
port: 2389
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
38
package.json
38
package.json
@@ -7,8 +7,8 @@
|
||||
"homepage": "https://github.com/algerkong/AlgerMusicPlayer",
|
||||
"scripts": {
|
||||
"prepare": "husky",
|
||||
"format": "prettier --write .",
|
||||
"lint": "eslint . --fix",
|
||||
"format": "prettier --write ./src",
|
||||
"lint": "eslint ./src --fix",
|
||||
"typecheck:node": "tsc --noEmit -p tsconfig.node.json --composite false",
|
||||
"typecheck:web": "vue-tsc --noEmit -p tsconfig.web.json --composite false",
|
||||
"typecheck": "npm run typecheck:node && npm run typecheck:web",
|
||||
@@ -22,8 +22,16 @@
|
||||
"build:mac": "npm run build && electron-builder --mac",
|
||||
"build:linux": "npm run build && electron-builder --linux"
|
||||
},
|
||||
"lint-staged": {
|
||||
"*.{ts,tsx,vue,js}": [
|
||||
"eslint --fix"
|
||||
],
|
||||
"*.{ts,tsx,vue,js,css,scss,md,json}": [
|
||||
"prettier --write"
|
||||
]
|
||||
},
|
||||
"dependencies": {
|
||||
"@electron-toolkit/preload": "^3.0.1",
|
||||
"@electron-toolkit/preload": "^3.0.2",
|
||||
"@electron-toolkit/utils": "^4.0.0",
|
||||
"@unblockneteasemusic/server": "^0.27.8-patch.1",
|
||||
"cors": "^2.8.5",
|
||||
@@ -32,12 +40,15 @@
|
||||
"electron-window-state": "^5.0.3",
|
||||
"express": "^4.18.2",
|
||||
"file-type": "^21.0.0",
|
||||
"flac-tagger": "^1.0.7",
|
||||
"font-list": "^1.5.1",
|
||||
"husky": "^9.1.7",
|
||||
"music-metadata": "^11.2.3",
|
||||
"netease-cloud-music-api-alger": "^4.26.1",
|
||||
"node-id3": "^0.2.9",
|
||||
"node-machine-id": "^1.1.12",
|
||||
"pinia-plugin-persistedstate": "^4.5.0",
|
||||
"sharp": "^0.34.3",
|
||||
"vue-i18n": "^11.1.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
@@ -46,7 +57,6 @@
|
||||
"@electron-toolkit/tsconfig": "^1.0.1",
|
||||
"@eslint/js": "^9.31.0",
|
||||
"@rushstack/eslint-patch": "^1.10.3",
|
||||
"@tailwindcss/postcss7-compat": "^2.2.4",
|
||||
"@types/howler": "^2.2.12",
|
||||
"@types/node": "^20.14.8",
|
||||
"@types/tinycolor2": "^1.4.6",
|
||||
@@ -58,15 +68,15 @@
|
||||
"@vue/eslint-config-typescript": "^14.5.0",
|
||||
"@vue/runtime-core": "^3.5.0",
|
||||
"@vueuse/core": "^11.3.0",
|
||||
"@vueuse/electron": "^11.3.0",
|
||||
"@vueuse/electron": "^13.8.0",
|
||||
"animate.css": "^4.1.1",
|
||||
"autoprefixer": "^10.4.20",
|
||||
"axios": "^1.7.7",
|
||||
"cross-env": "^7.0.3",
|
||||
"electron": "^35.2.0",
|
||||
"electron-builder": "^25.1.8",
|
||||
"electron-vite": "^3.1.0",
|
||||
"eslint": "^9.0.0",
|
||||
"electron": "^38.1.2",
|
||||
"electron-builder": "^26.0.12",
|
||||
"electron-vite": "^4.0.0",
|
||||
"eslint": "^9.34.0",
|
||||
"eslint-config-prettier": "^10.1.8",
|
||||
"eslint-plugin-import": "^2.32.0",
|
||||
"eslint-plugin-prettier": "^5.5.3",
|
||||
@@ -75,12 +85,13 @@
|
||||
"eslint-plugin-vue-scoped-css": "^2.11.0",
|
||||
"globals": "^16.3.0",
|
||||
"howler": "^2.2.4",
|
||||
"lint-staged": "^15.2.10",
|
||||
"lodash": "^4.17.21",
|
||||
"marked": "^15.0.4",
|
||||
"naive-ui": "^2.41.0",
|
||||
"pinia": "^3.0.1",
|
||||
"pinyin-match": "^1.2.6",
|
||||
"postcss": "^8.5.3",
|
||||
"postcss": "^8.4.47",
|
||||
"prettier": "^3.6.2",
|
||||
"remixicon": "^4.6.0",
|
||||
"sass": "^1.86.0",
|
||||
@@ -94,6 +105,7 @@
|
||||
"vite-plugin-compression": "^0.5.1",
|
||||
"vite-plugin-vue-devtools": "7.7.2",
|
||||
"vue": "^3.5.13",
|
||||
"vue-eslint-parser": "^10.2.0",
|
||||
"vue-router": "^4.5.0",
|
||||
"vue-tsc": "^2.0.22"
|
||||
},
|
||||
@@ -193,5 +205,11 @@
|
||||
"shortcutName": "AlgerMusicPlayer",
|
||||
"include": "build/installer.nsh"
|
||||
}
|
||||
},
|
||||
"pnpm": {
|
||||
"onlyBuiltDependencies": [
|
||||
"electron",
|
||||
"esbuild"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
51
src/i18n/lang/en-US/bilibili.ts
Normal file
51
src/i18n/lang/en-US/bilibili.ts
Normal file
@@ -0,0 +1,51 @@
|
||||
export default {
|
||||
player: {
|
||||
loading: 'Loading audio...',
|
||||
retry: 'Retry',
|
||||
playNow: 'Play Now',
|
||||
loadingTitle: 'Loading...',
|
||||
totalDuration: 'Total Duration: {duration}',
|
||||
partsList: 'Parts List ({count} episodes)',
|
||||
playStarted: 'Playback started',
|
||||
switchingPart: 'Switching to part: {part}',
|
||||
preloadingNext: 'Preloading next part: {part}',
|
||||
playingCurrent: 'Playing current selected part: {name}',
|
||||
num: 'M',
|
||||
errors: {
|
||||
invalidVideoId: 'Invalid video ID',
|
||||
loadVideoDetailFailed: 'Failed to load video details',
|
||||
loadPartInfoFailed: 'Unable to load video part information',
|
||||
loadAudioUrlFailed: 'Failed to get audio playback URL',
|
||||
videoDetailNotLoaded: 'Video details not loaded',
|
||||
missingParams: 'Missing required parameters',
|
||||
noAvailableAudioUrl: 'No available audio URL found',
|
||||
loadPartAudioFailed: 'Failed to load part audio URL',
|
||||
audioListEmpty: 'Audio list is empty, please retry',
|
||||
currentPartNotFound: 'Current part audio not found',
|
||||
audioUrlFailed: 'Failed to get audio URL',
|
||||
playFailed: 'Playback failed, please retry',
|
||||
getAudioUrlFailed: 'Failed to get audio URL, please retry',
|
||||
audioNotFound: 'Corresponding audio not found, please retry',
|
||||
preloadFailed: 'Failed to preload next part',
|
||||
switchPartFailed: 'Failed to load audio URL when switching parts'
|
||||
},
|
||||
console: {
|
||||
loadingDetail: 'Loading Bilibili video details',
|
||||
detailData: 'Bilibili video detail data',
|
||||
multipleParts: 'Video has multiple parts, total {count}',
|
||||
noPartsData: 'Video has no parts or part data is empty',
|
||||
loadingAudioSource: 'Loading audio source',
|
||||
generatedAudioList: 'Generated audio list, total {count}',
|
||||
getDashAudioUrl: 'Got dash audio URL',
|
||||
getDurlAudioUrl: 'Got durl audio URL',
|
||||
loadingPartAudio: 'Loading part audio URL: {part}, cid: {cid}',
|
||||
loadPartAudioFailed: 'Failed to load part audio URL: {part}',
|
||||
switchToPart: 'Switching to part: {part}',
|
||||
audioNotFoundInList: 'Corresponding audio item not found',
|
||||
preparingToPlay: 'Preparing to play current selected part: {name}',
|
||||
preloadingNextPart: 'Preloading next part: {part}',
|
||||
playingSelectedPart: 'Playing current selected part: {name}, audio URL: {url}',
|
||||
preloadNextFailed: 'Failed to preload next part'
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -1,5 +1,45 @@
|
||||
export default {
|
||||
title: 'Play History',
|
||||
heatmapTitle: 'Heatmap',
|
||||
playCount: '{count}',
|
||||
getHistoryFailed: 'Failed to get play history'
|
||||
getHistoryFailed: 'Failed to get play history',
|
||||
categoryTabs: {
|
||||
songs: 'Songs',
|
||||
playlists: 'Playlists',
|
||||
albums: 'Albums'
|
||||
},
|
||||
tabs: {
|
||||
all: 'All Records',
|
||||
local: 'Local Records',
|
||||
cloud: 'Cloud Records'
|
||||
},
|
||||
getCloudRecordFailed: 'Failed to get cloud records',
|
||||
needLogin: 'Please login with cookie to view cloud records',
|
||||
merging: 'Merging records...',
|
||||
noDescription: 'No description',
|
||||
noData: 'No records',
|
||||
newKey: 'New translation',
|
||||
heatmap: {
|
||||
title: 'Play Heatmap',
|
||||
loading: 'Loading data...',
|
||||
unit: 'plays',
|
||||
footerText: 'Hover to view details',
|
||||
playCount: 'Played {count} times',
|
||||
topSongs: 'Top songs of the day',
|
||||
times: 'times',
|
||||
totalPlays: 'Total Plays',
|
||||
activeDays: 'Active Days',
|
||||
noData: 'No play records',
|
||||
colorTheme: 'Color Theme',
|
||||
colors: {
|
||||
green: 'Green',
|
||||
blue: 'Blue',
|
||||
orange: 'Orange',
|
||||
purple: 'Purple',
|
||||
red: 'Red'
|
||||
},
|
||||
mostPlayedSong: 'Most Played Song',
|
||||
mostActiveDay: 'Most Active Day',
|
||||
latestNightSong: 'Latest Night Song'
|
||||
}
|
||||
};
|
||||
|
||||
@@ -45,7 +45,8 @@ export default {
|
||||
phoneLoginFailed: 'Phone login failed, please check if phone number and password are correct',
|
||||
autoGetCookieSuccess: 'Auto get Cookie successful',
|
||||
autoGetCookieFailed: 'Auto get Cookie failed',
|
||||
autoGetCookieTip: 'Will open NetEase Cloud Music login page, please complete login and close the window',
|
||||
autoGetCookieTip:
|
||||
'Will open NetEase Cloud Music login page, please complete login and close the window',
|
||||
qrCheckFailed: 'Failed to check QR code status, please refresh and try again',
|
||||
qrLoading: 'Loading QR code...',
|
||||
qrExpired: 'QR code has expired, please click to refresh',
|
||||
@@ -58,5 +59,6 @@ export default {
|
||||
qrGenerating: 'Generating QR code...'
|
||||
},
|
||||
qrTitle: 'NetEase Cloud Music QR Code Login',
|
||||
uidWarning: 'Note: UID login is only for viewing user public information and cannot access features that require login permissions.'
|
||||
uidWarning:
|
||||
'Note: UID login is only for viewing user public information and cannot access features that require login permissions.'
|
||||
};
|
||||
|
||||
@@ -29,7 +29,8 @@ export default {
|
||||
list: 'Next'
|
||||
},
|
||||
lrc: {
|
||||
noLrc: 'No lyrics, please enjoy'
|
||||
noLrc: 'No lyrics, please enjoy',
|
||||
noAutoScroll: 'This lyrics does not support auto-scroll'
|
||||
},
|
||||
reparse: {
|
||||
title: 'Select Music Source',
|
||||
@@ -39,7 +40,9 @@ export default {
|
||||
warning: 'Please select a music source',
|
||||
bilibiliNotSupported: 'Bilibili videos do not support reparsing',
|
||||
processing: 'Processing...',
|
||||
clear: 'Clear Custom Source'
|
||||
clear: 'Clear Custom Source',
|
||||
customApiFailed: 'Custom API parsing failed, trying built-in sources...',
|
||||
customApiError: 'Custom API request error, trying built-in sources...'
|
||||
},
|
||||
playBar: {
|
||||
expand: 'Expand Lyrics',
|
||||
@@ -63,7 +66,17 @@ export default {
|
||||
favorite: 'Favorite {name}',
|
||||
unFavorite: 'Unfavorite {name}',
|
||||
playbackSpeed: 'Playback Speed',
|
||||
advancedControls: 'Advanced Controls'
|
||||
advancedControls: 'Advanced Controls',
|
||||
intelligenceMode: {
|
||||
title: 'Intelligence Mode',
|
||||
needCookieLogin: 'Please login with Cookie method to use Intelligence Mode',
|
||||
noFavoritePlaylist: 'Favorite playlist not found',
|
||||
noLikedSongs: 'You have no liked songs yet',
|
||||
loading: 'Loading Intelligence Mode',
|
||||
success: 'Loaded {count} songs',
|
||||
failed: 'Failed to get Intelligence Mode list',
|
||||
error: 'Intelligence Mode error'
|
||||
}
|
||||
},
|
||||
eq: {
|
||||
title: 'Equalizer',
|
||||
|
||||
@@ -50,7 +50,17 @@ export default {
|
||||
englishText: 'The quick brown fox jumps over the lazy dog',
|
||||
japaneseText: 'あいうえお かきくけこ さしすせそ',
|
||||
koreanText: '가나다라마 바사아자차 카타파하'
|
||||
}
|
||||
},
|
||||
gpuAcceleration: 'GPU Acceleration',
|
||||
gpuAccelerationDesc:
|
||||
'Enable or disable hardware acceleration, can improve rendering performance but may increase GPU load',
|
||||
gpuAccelerationRestart:
|
||||
'Changing GPU acceleration settings requires application restart to take effect',
|
||||
gpuAccelerationChangeSuccess:
|
||||
'GPU acceleration settings updated, restart application to take effect',
|
||||
gpuAccelerationChangeError: 'Failed to update GPU acceleration settings',
|
||||
tabletMode: 'Tablet Mode',
|
||||
tabletModeDesc: 'Enabling tablet mode allows using PC-style interface on mobile devices'
|
||||
},
|
||||
playback: {
|
||||
quality: 'Audio Quality',
|
||||
@@ -80,7 +90,32 @@ export default {
|
||||
autoPlayDesc: 'Auto resume playback when reopening the app',
|
||||
showStatusBar: 'Show Status Bar',
|
||||
showStatusBarContent:
|
||||
'You can display the music control function in your mac status bar (effective after a restart)'
|
||||
'You can display the music control function in your mac status bar (effective after a restart)',
|
||||
fallbackParser: 'Fallback Parser (GD Music)',
|
||||
fallbackParserDesc:
|
||||
'When "GD Music" is checked and regular sources fail, this service will be used.',
|
||||
parserGD: 'GD Music (Built-in)',
|
||||
parserCustom: 'Custom API',
|
||||
|
||||
// Source labels
|
||||
sourceLabels: {
|
||||
migu: 'Migu',
|
||||
kugou: 'Kugou',
|
||||
pyncmd: 'NetEase (Built-in)',
|
||||
bilibili: 'Bilibili',
|
||||
gdmusic: 'GD Music',
|
||||
custom: 'Custom API'
|
||||
},
|
||||
|
||||
customApi: {
|
||||
sectionTitle: 'Custom API Settings',
|
||||
importConfig: 'Import JSON Config',
|
||||
currentSource: 'Current Source',
|
||||
notImported: 'No custom source imported yet.',
|
||||
importSuccess: 'Successfully imported source: {name}',
|
||||
importFailed: 'Import failed: {message}',
|
||||
enableHint: 'Import a JSON config file to enable'
|
||||
}
|
||||
},
|
||||
application: {
|
||||
closeAction: 'Close Action',
|
||||
@@ -233,6 +268,11 @@ export default {
|
||||
lyricLines: 'Lyric Lines',
|
||||
mobileUnavailable: 'This setting is only available on mobile devices'
|
||||
},
|
||||
translationEngine: 'Lyric Translation Engine',
|
||||
translationEngineOptions: {
|
||||
none: 'Off',
|
||||
opencc: 'OpenCC Traditionalize'
|
||||
},
|
||||
themeColor: {
|
||||
title: 'Lyric Theme Color',
|
||||
presetColors: 'Preset Colors',
|
||||
|
||||
@@ -10,6 +10,11 @@ export default {
|
||||
trackCount: '{count} tracks',
|
||||
playCount: 'Played {count} times'
|
||||
},
|
||||
tabs: {
|
||||
created: 'Created',
|
||||
favorite: 'Favorite',
|
||||
album: 'Album'
|
||||
},
|
||||
ranking: {
|
||||
title: 'Listening History',
|
||||
playCount: '{count} times'
|
||||
|
||||
@@ -1,38 +0,0 @@
|
||||
# 日本語翻訳 (Japanese Translation)
|
||||
|
||||
このディレクトリには、AlgerMusicPlayerの日本語翻訳ファイルが含まれています。
|
||||
|
||||
## ファイル構成
|
||||
|
||||
- `artist.ts` - アーティスト関連の翻訳
|
||||
- `common.ts` - 共通の翻訳(ボタン、メッセージなど)
|
||||
- `comp.ts` - コンポーネント関連の翻訳
|
||||
- `donation.ts` - 寄付関連の翻訳
|
||||
- `download.ts` - ダウンロード管理の翻訳
|
||||
- `favorite.ts` - お気に入り機能の翻訳
|
||||
- `history.ts` - 履歴機能の翻訳
|
||||
- `login.ts` - ログイン関連の翻訳
|
||||
- `player.ts` - プレイヤー機能の翻訳
|
||||
- `search.ts` - 検索機能の翻訳
|
||||
- `settings.ts` - 設定画面の翻訳
|
||||
- `songItem.ts` - 楽曲アイテムの翻訳
|
||||
- `user.ts` - ユーザー関連の翻訳
|
||||
- `index.ts` - すべての翻訳をエクスポートするメインファイル
|
||||
|
||||
## 使用方法
|
||||
|
||||
アプリケーション内で言語を日本語に切り替えるには:
|
||||
|
||||
1. 設定画面を開く
|
||||
2. 「言語設定」セクションを見つける
|
||||
3. ドロップダウンメニューから「日本語」を選択
|
||||
|
||||
## 翻訳の改善
|
||||
|
||||
翻訳の改善や修正がある場合は、該当するファイルを編集してプルリクエストを送信してください。
|
||||
|
||||
## 注意事項
|
||||
|
||||
- すべての翻訳キーは中国語版と英語版に対応しています
|
||||
- 新しい機能が追加された場合は、対応する日本語翻訳も追加する必要があります
|
||||
- 文字化けを避けるため、ファイルはUTF-8エンコーディングで保存してください
|
||||
@@ -2,4 +2,4 @@ export default {
|
||||
hotSongs: '人気楽曲',
|
||||
albums: 'アルバム',
|
||||
description: 'アーティスト紹介'
|
||||
};
|
||||
};
|
||||
|
||||
51
src/i18n/lang/ja-JP/bilibili.ts
Normal file
51
src/i18n/lang/ja-JP/bilibili.ts
Normal file
@@ -0,0 +1,51 @@
|
||||
export default {
|
||||
player: {
|
||||
loading: 'オーディオ読み込み中...',
|
||||
retry: '再試行',
|
||||
playNow: '今すぐ再生',
|
||||
loadingTitle: '読み込み中...',
|
||||
totalDuration: '総再生時間: {duration}',
|
||||
partsList: 'パートリスト ({count}話)',
|
||||
playStarted: '再生を開始しました',
|
||||
switchingPart: 'パートを切り替え中: {part}',
|
||||
preloadingNext: '次のパートをプリロード中: {part}',
|
||||
playingCurrent: '現在選択されたパートを再生中: {name}',
|
||||
num: '万',
|
||||
errors: {
|
||||
invalidVideoId: '無効な動画ID',
|
||||
loadVideoDetailFailed: '動画詳細の取得に失敗しました',
|
||||
loadPartInfoFailed: '動画パート情報の読み込みができません',
|
||||
loadAudioUrlFailed: 'オーディオ再生URLの取得に失敗しました',
|
||||
videoDetailNotLoaded: '動画詳細が読み込まれていません',
|
||||
missingParams: '必要なパラメータが不足しています',
|
||||
noAvailableAudioUrl: '利用可能なオーディオURLが見つかりません',
|
||||
loadPartAudioFailed: 'パートオーディオURLの読み込みに失敗しました',
|
||||
audioListEmpty: 'オーディオリストが空です。再試行してください',
|
||||
currentPartNotFound: '現在のパートのオーディオが見つかりません',
|
||||
audioUrlFailed: 'オーディオURLの取得に失敗しました',
|
||||
playFailed: '再生に失敗しました。再試行してください',
|
||||
getAudioUrlFailed: 'オーディオURLの取得に失敗しました。再試行してください',
|
||||
audioNotFound: '対応するオーディオが見つかりません。再試行してください',
|
||||
preloadFailed: '次のパートのプリロードに失敗しました',
|
||||
switchPartFailed: 'パート切り替え時のオーディオURL読み込みに失敗しました'
|
||||
},
|
||||
console: {
|
||||
loadingDetail: 'Bilibiliビデオ詳細を読み込み中',
|
||||
detailData: 'Bilibiliビデオ詳細データ',
|
||||
multipleParts: 'ビデオに複数のパートがあります。合計{count}個',
|
||||
noPartsData: 'ビデオにパートがないか、パートデータが空です',
|
||||
loadingAudioSource: 'オーディオソースを読み込み中',
|
||||
generatedAudioList: 'オーディオリストを生成しました。合計{count}個',
|
||||
getDashAudioUrl: 'dashオーディオURLを取得しました',
|
||||
getDurlAudioUrl: 'durlオーディオURLを取得しました',
|
||||
loadingPartAudio: 'パートオーディオURLを読み込み中: {part}, cid: {cid}',
|
||||
loadPartAudioFailed: 'パートオーディオURLの読み込みに失敗: {part}',
|
||||
switchToPart: 'パートに切り替え中: {part}',
|
||||
audioNotFoundInList: '対応するオーディオアイテムが見つかりません',
|
||||
preparingToPlay: '現在選択されたパートの再生準備中: {name}',
|
||||
preloadingNextPart: '次のパートをプリロード中: {part}',
|
||||
playingSelectedPart: '現在選択されたパートを再生中: {name}、オーディオURL: {url}',
|
||||
preloadNextFailed: '次のパートのプリロードに失敗しました'
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -53,4 +53,4 @@ export default {
|
||||
play: '再生',
|
||||
favorite: 'お気に入り'
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
@@ -38,10 +38,12 @@ export default {
|
||||
nowUpdate: '今すぐ更新',
|
||||
downloadFailed: 'ダウンロードに失敗しました。再試行するか手動でダウンロードしてください',
|
||||
startFailed: 'ダウンロードの開始に失敗しました。再試行するか手動でダウンロードしてください',
|
||||
noDownloadUrl: '現在のシステムに適したインストールパッケージが見つかりません。手動でダウンロードしてください',
|
||||
noDownloadUrl:
|
||||
'現在のシステムに適したインストールパッケージが見つかりません。手動でダウンロードしてください',
|
||||
installConfirmTitle: '更新をインストール',
|
||||
installConfirmContent: 'アプリを閉じて更新をインストールしますか?',
|
||||
manualInstallTip: 'アプリを閉じた後にインストーラーが正常に起動しない場合は、ダウンロードフォルダでファイルを見つけて手動で開いてください。',
|
||||
manualInstallTip:
|
||||
'アプリを閉じた後にインストーラーが正常に起動しない場合は、ダウンロードフォルダでファイルを見つけて手動で開いてください。',
|
||||
yesInstall: '今すぐインストール',
|
||||
noThanks: '後でインストール',
|
||||
fileLocation: 'ファイルの場所',
|
||||
@@ -172,7 +174,8 @@ export default {
|
||||
noTasks: 'インポートタスクがありません',
|
||||
clearTasks: 'タスクをクリア',
|
||||
clearTasksConfirmTitle: 'クリア確認',
|
||||
clearTasksConfirmContent: 'すべてのインポートタスク記録をクリアしますか?この操作は元に戻せません。',
|
||||
clearTasksConfirmContent:
|
||||
'すべてのインポートタスク記録をクリアしますか?この操作は元に戻せません。',
|
||||
confirm: '確認',
|
||||
cancel: 'キャンセル',
|
||||
clearTasksSuccess: 'タスクリストをクリアしました',
|
||||
@@ -187,4 +190,4 @@ export default {
|
||||
mv: 'MV',
|
||||
home: 'ホーム',
|
||||
search: '検索'
|
||||
};
|
||||
};
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
export default {
|
||||
description: 'あなたの寄付は開発・保守作業をサポートするために使用され、サーバー保守、ドメイン更新などが含まれます。',
|
||||
description:
|
||||
'あなたの寄付は開発・保守作業をサポートするために使用され、サーバー保守、ドメイン更新などが含まれます。',
|
||||
message: 'メッセージを残す際は、メールアドレスやGitHubユーザー名を記載してください。',
|
||||
refresh: 'リストを更新',
|
||||
toDonateList: 'コーヒーをおごる',
|
||||
noMessage: 'メッセージがありません',
|
||||
title: '寄付リスト'
|
||||
};
|
||||
};
|
||||
|
||||
@@ -36,7 +36,8 @@ export default {
|
||||
},
|
||||
clear: {
|
||||
title: 'ダウンロード記録をクリア',
|
||||
message: 'すべてのダウンロード記録をクリアしますか?この操作はダウンロード済みの音楽ファイルを削除しませんが、すべての記録をクリアします。',
|
||||
message:
|
||||
'すべてのダウンロード記録をクリアしますか?この操作はダウンロード済みの音楽ファイルを削除しませんが、すべての記録をクリアします。',
|
||||
confirm: 'クリア確認',
|
||||
cancel: 'キャンセル',
|
||||
success: 'ダウンロード記録をクリアしました'
|
||||
@@ -84,4 +85,4 @@ export default {
|
||||
albumName: 'アルバム名'
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
@@ -10,4 +10,4 @@ export default {
|
||||
selectSongsFirst: 'まずダウンロードする楽曲を選択してください',
|
||||
descending: '降順',
|
||||
ascending: '昇順'
|
||||
};
|
||||
};
|
||||
|
||||
@@ -1,5 +1,37 @@
|
||||
export default {
|
||||
title: '再生履歴',
|
||||
heatmapTitle: 'ヒートマップ',
|
||||
playCount: '{count}',
|
||||
getHistoryFailed: '履歴の取得に失敗しました'
|
||||
};
|
||||
getHistoryFailed: '履歴の取得に失敗しました',
|
||||
tabs: {
|
||||
all: 'すべての記録',
|
||||
local: 'ローカル記録',
|
||||
cloud: 'クラウド記録'
|
||||
},
|
||||
getCloudRecordFailed: 'クラウド記録の取得に失敗しました',
|
||||
needLogin: 'cookieを使用してログインしてクラウド記録を表示できます',
|
||||
merging: '記録を統合中...',
|
||||
heatmap: {
|
||||
title: '再生ヒートマップ',
|
||||
loading: 'データを読み込み中...',
|
||||
unit: '回再生',
|
||||
footerText: 'ホバーして詳細を表示',
|
||||
playCount: '{count} 回再生',
|
||||
topSongs: 'その日の人気曲',
|
||||
times: '回',
|
||||
totalPlays: '総再生回数',
|
||||
activeDays: 'アクティブ日数',
|
||||
noData: '再生記録がありません',
|
||||
colorTheme: 'カラーテーマ',
|
||||
colors: {
|
||||
green: 'グリーン',
|
||||
blue: 'ブルー',
|
||||
orange: 'オレンジ',
|
||||
purple: 'パープル',
|
||||
red: 'レッド'
|
||||
},
|
||||
mostPlayedSong: '最も再生された曲',
|
||||
mostActiveDay: '最もアクティブな日',
|
||||
latestNightSong: '深夜に再生した曲'
|
||||
}
|
||||
};
|
||||
|
||||
@@ -41,8 +41,10 @@ export default {
|
||||
uidLoginFailed: 'UIDログインに失敗しました。ユーザーIDが正しいか確認してください',
|
||||
autoGetCookieSuccess: 'Cookie自動取得成功',
|
||||
autoGetCookieFailed: 'Cookie自動取得失敗',
|
||||
autoGetCookieTip: 'NetEase Cloud Musicのログインページを開きます。ログイン完了後、ウィンドウを閉じてください'
|
||||
autoGetCookieTip:
|
||||
'NetEase Cloud Musicのログインページを開きます。ログイン完了後、ウィンドウを閉じてください'
|
||||
},
|
||||
qrTitle: 'NetEase Cloud Music QRコードログイン',
|
||||
uidWarning: '注意:UIDログインはユーザーの公開情報を表示するためのみ使用でき、ログイン権限が必要な機能にはアクセスできません。'
|
||||
};
|
||||
uidWarning:
|
||||
'注意:UIDログインはユーザーの公開情報を表示するためのみ使用でき、ログイン権限が必要な機能にはアクセスできません。'
|
||||
};
|
||||
|
||||
@@ -1,123 +1,137 @@
|
||||
export default {
|
||||
nowPlaying: '再生中',
|
||||
playlist: 'プレイリスト',
|
||||
lyrics: '歌詞',
|
||||
previous: '前へ',
|
||||
play: '再生',
|
||||
pause: '一時停止',
|
||||
next: '次へ',
|
||||
volumeUp: '音量を上げる',
|
||||
volumeDown: '音量を下げる',
|
||||
mute: 'ミュート',
|
||||
unmute: 'ミュート解除',
|
||||
songNum: '楽曲総数:{num}',
|
||||
addCorrection: '{num}秒早める',
|
||||
subtractCorrection: '{num}秒遅らせる',
|
||||
playFailed: '現在の楽曲の再生に失敗しました。次の曲を再生します',
|
||||
playMode: {
|
||||
sequence: '順次再生',
|
||||
loop: 'リピート再生',
|
||||
random: 'ランダム再生'
|
||||
},
|
||||
fullscreen: {
|
||||
enter: 'フルスクリーン',
|
||||
exit: 'フルスクリーン終了'
|
||||
},
|
||||
close: '閉じる',
|
||||
modeHint: {
|
||||
single: 'リピート再生',
|
||||
list: '自動で次の曲を再生'
|
||||
},
|
||||
lrc: {
|
||||
noLrc: '歌詞がありません。お楽しみください'
|
||||
},
|
||||
reparse: {
|
||||
title: '解析音源を選択',
|
||||
desc: '音源をクリックして直接解析します。次回この楽曲を再生する際は選択した音源を使用します',
|
||||
success: '再解析成功',
|
||||
failed: '再解析失敗',
|
||||
warning: '音源を選択してください',
|
||||
bilibiliNotSupported: 'Bilibili動画は再解析をサポートしていません',
|
||||
processing: '解析中...',
|
||||
clear: 'カスタム音源をクリア'
|
||||
},
|
||||
playBar: {
|
||||
expand: '歌詞を展開',
|
||||
collapse: '歌詞を折りたたみ',
|
||||
like: 'いいね',
|
||||
lyric: '歌詞',
|
||||
noSongPlaying: '再生中の楽曲がありません',
|
||||
eq: 'イコライザー',
|
||||
playList: 'プレイリスト',
|
||||
reparse: '再解析',
|
||||
playMode: {
|
||||
sequence: '順次再生',
|
||||
loop: 'ループ再生',
|
||||
random: 'ランダム再生'
|
||||
},
|
||||
play: '再生開始',
|
||||
pause: '再生一時停止',
|
||||
prev: '前の曲',
|
||||
next: '次の曲',
|
||||
volume: '音量',
|
||||
favorite: '{name}をお気に入りに追加しました',
|
||||
unFavorite: '{name}をお気に入りから削除しました',
|
||||
miniPlayBar: 'ミニ再生バー',
|
||||
playbackSpeed: '再生速度',
|
||||
advancedControls: 'その他の設定'
|
||||
},
|
||||
eq: {
|
||||
title: 'イコライザー',
|
||||
reset: 'リセット',
|
||||
on: 'オン',
|
||||
off: 'オフ',
|
||||
bass: '低音',
|
||||
midrange: '中音',
|
||||
treble: '高音',
|
||||
presets: {
|
||||
flat: 'フラット',
|
||||
pop: 'ポップ',
|
||||
rock: 'ロック',
|
||||
classical: 'クラシック',
|
||||
jazz: 'ジャズ',
|
||||
electronic: 'エレクトロニック',
|
||||
hiphop: 'ヒップホップ',
|
||||
rb: 'R&B',
|
||||
metal: 'メタル',
|
||||
vocal: 'ボーカル',
|
||||
dance: 'ダンス',
|
||||
acoustic: 'アコースティック',
|
||||
custom: 'カスタム'
|
||||
}
|
||||
},
|
||||
// タイマー機能関連
|
||||
sleepTimer: {
|
||||
title: 'スリープタイマー',
|
||||
cancel: 'タイマーをキャンセル',
|
||||
timeMode: '時間で停止',
|
||||
songsMode: '楽曲数で停止',
|
||||
playlistEnd: 'プレイリスト終了後に停止',
|
||||
afterPlaylist: 'プレイリスト終了後に停止',
|
||||
activeUntilEnd: 'リスト終了まで再生',
|
||||
minutes: '分',
|
||||
hours: '時間',
|
||||
songs: '曲',
|
||||
set: '設定',
|
||||
timerSetSuccess: '{minutes}分後に停止するよう設定しました',
|
||||
songsSetSuccess: '{songs}曲再生後に停止するよう設定しました',
|
||||
playlistEndSetSuccess: 'プレイリスト終了後に停止するよう設定しました',
|
||||
timerCancelled: 'スリープタイマーをキャンセルしました',
|
||||
timerEnded: 'スリープタイマーが作動しました',
|
||||
playbackStopped: '音楽再生を停止しました',
|
||||
minutesRemaining: '残り{minutes}分',
|
||||
songsRemaining: '残り{count}曲'
|
||||
},
|
||||
playList: {
|
||||
clearAll: 'プレイリストをクリア',
|
||||
alreadyEmpty: 'プレイリストは既に空です',
|
||||
cleared: 'プレイリストをクリアしました',
|
||||
empty: 'プレイリストが空です',
|
||||
clearConfirmTitle: 'プレイリストをクリア',
|
||||
clearConfirmContent: 'これによりプレイリスト内のすべての楽曲がクリアされ、現在の再生が停止されます。続行しますか?'
|
||||
}
|
||||
};
|
||||
export default {
|
||||
nowPlaying: '再生中',
|
||||
playlist: 'プレイリスト',
|
||||
lyrics: '歌詞',
|
||||
previous: '前へ',
|
||||
play: '再生',
|
||||
pause: '一時停止',
|
||||
next: '次へ',
|
||||
volumeUp: '音量を上げる',
|
||||
volumeDown: '音量を下げる',
|
||||
mute: 'ミュート',
|
||||
unmute: 'ミュート解除',
|
||||
songNum: '楽曲総数:{num}',
|
||||
addCorrection: '{num}秒早める',
|
||||
subtractCorrection: '{num}秒遅らせる',
|
||||
playFailed: '現在の楽曲の再生に失敗しました。次の曲を再生します',
|
||||
playMode: {
|
||||
sequence: '順次再生',
|
||||
loop: 'リピート再生',
|
||||
random: 'ランダム再生'
|
||||
},
|
||||
fullscreen: {
|
||||
enter: 'フルスクリーン',
|
||||
exit: 'フルスクリーン終了'
|
||||
},
|
||||
close: '閉じる',
|
||||
modeHint: {
|
||||
single: 'リピート再生',
|
||||
list: '自動で次の曲を再生'
|
||||
},
|
||||
lrc: {
|
||||
noLrc: '歌詞がありません。お楽しみください',
|
||||
noAutoScroll: '本歌詞は自動スクロールをサポートしていません'
|
||||
},
|
||||
reparse: {
|
||||
title: '解析音源を選択',
|
||||
desc: '音源をクリックして直接解析します。次回この楽曲を再生する際は選択した音源を使用します',
|
||||
success: '再解析成功',
|
||||
failed: '再解析失敗',
|
||||
warning: '音源を選択してください',
|
||||
bilibiliNotSupported: 'Bilibili動画は再解析をサポートしていません',
|
||||
processing: '解析中...',
|
||||
clear: 'カスタム音源をクリア',
|
||||
customApiFailed: 'カスタムAPIの解析に失敗しました。内蔵音源を試しています...',
|
||||
customApiError: 'カスタムAPIのリクエストでエラーが発生しました。内蔵音源を試しています...'
|
||||
},
|
||||
playBar: {
|
||||
expand: '歌詞を展開',
|
||||
collapse: '歌詞を折りたたみ',
|
||||
like: 'いいね',
|
||||
lyric: '歌詞',
|
||||
noSongPlaying: '再生中の楽曲がありません',
|
||||
eq: 'イコライザー',
|
||||
playList: 'プレイリスト',
|
||||
reparse: '再解析',
|
||||
playMode: {
|
||||
sequence: '順次再生',
|
||||
loop: 'ループ再生',
|
||||
random: 'ランダム再生'
|
||||
},
|
||||
play: '再生開始',
|
||||
pause: '再生一時停止',
|
||||
prev: '前の曲',
|
||||
next: '次の曲',
|
||||
volume: '音量',
|
||||
favorite: '{name}をお気に入りに追加しました',
|
||||
unFavorite: '{name}をお気に入りから削除しました',
|
||||
miniPlayBar: 'ミニ再生バー',
|
||||
playbackSpeed: '再生速度',
|
||||
advancedControls: 'その他の設定',
|
||||
intelligenceMode: {
|
||||
title: 'インテリジェンスモード',
|
||||
needCookieLogin: 'Cookie方式でログインしてからインテリジェンスモードを使用してください',
|
||||
noFavoritePlaylist: '「お気に入りの音楽」プレイリストが見つかりません',
|
||||
noLikedSongs: 'まだ「いいね」した楽曲がありません',
|
||||
loading: 'インテリジェンスモードを読み込み中',
|
||||
success: '{count} 曲を読み込みました',
|
||||
failed: 'インテリジェンスモードのリスト取得に失敗しました',
|
||||
error: 'インテリジェンスモードの再生でエラーが発生しました'
|
||||
}
|
||||
},
|
||||
eq: {
|
||||
title: 'イコライザー',
|
||||
reset: 'リセット',
|
||||
on: 'オン',
|
||||
off: 'オフ',
|
||||
bass: '低音',
|
||||
midrange: '中音',
|
||||
treble: '高音',
|
||||
presets: {
|
||||
flat: 'フラット',
|
||||
pop: 'ポップ',
|
||||
rock: 'ロック',
|
||||
classical: 'クラシック',
|
||||
jazz: 'ジャズ',
|
||||
electronic: 'エレクトロニック',
|
||||
hiphop: 'ヒップホップ',
|
||||
rb: 'R&B',
|
||||
metal: 'メタル',
|
||||
vocal: 'ボーカル',
|
||||
dance: 'ダンス',
|
||||
acoustic: 'アコースティック',
|
||||
custom: 'カスタム'
|
||||
}
|
||||
},
|
||||
// タイマー機能関連
|
||||
sleepTimer: {
|
||||
title: 'スリープタイマー',
|
||||
cancel: 'タイマーをキャンセル',
|
||||
timeMode: '時間で停止',
|
||||
songsMode: '楽曲数で停止',
|
||||
playlistEnd: 'プレイリスト終了後に停止',
|
||||
afterPlaylist: 'プレイリスト終了後に停止',
|
||||
activeUntilEnd: 'リスト終了まで再生',
|
||||
minutes: '分',
|
||||
hours: '時間',
|
||||
songs: '曲',
|
||||
set: '設定',
|
||||
timerSetSuccess: '{minutes}分後に停止するよう設定しました',
|
||||
songsSetSuccess: '{songs}曲再生後に停止するよう設定しました',
|
||||
playlistEndSetSuccess: 'プレイリスト終了後に停止するよう設定しました',
|
||||
timerCancelled: 'スリープタイマーをキャンセルしました',
|
||||
timerEnded: 'スリープタイマーが作動しました',
|
||||
playbackStopped: '音楽再生を停止しました',
|
||||
minutesRemaining: '残り{minutes}分',
|
||||
songsRemaining: '残り{count}曲'
|
||||
},
|
||||
playList: {
|
||||
clearAll: 'プレイリストをクリア',
|
||||
alreadyEmpty: 'プレイリストは既に空です',
|
||||
cleared: 'プレイリストをクリアしました',
|
||||
empty: 'プレイリストが空です',
|
||||
clearConfirmTitle: 'プレイリストをクリア',
|
||||
clearConfirmContent:
|
||||
'これによりプレイリスト内のすべての楽曲がクリアされ、現在の再生が停止されます。続行しますか?'
|
||||
}
|
||||
};
|
||||
|
||||
@@ -24,4 +24,4 @@ export default {
|
||||
mv: 'MV',
|
||||
bilibili: 'Bilibili'
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
@@ -1,322 +1,363 @@
|
||||
export default {
|
||||
theme: 'テーマ',
|
||||
language: '言語',
|
||||
regard: 'について',
|
||||
logout: 'ログアウト',
|
||||
sections: {
|
||||
basic: '基本設定',
|
||||
playback: '再生設定',
|
||||
application: 'アプリケーション設定',
|
||||
network: 'ネットワーク設定',
|
||||
system: 'システム管理',
|
||||
donation: '寄付サポート',
|
||||
regard: 'について'
|
||||
},
|
||||
basic: {
|
||||
themeMode: 'テーマモード',
|
||||
themeModeDesc: 'ライト/ダークテーマの切り替え',
|
||||
autoTheme: 'システムに従う',
|
||||
manualTheme: '手動切り替え',
|
||||
language: '言語設定',
|
||||
languageDesc: '表示言語を切り替え',
|
||||
tokenManagement: 'Cookie管理',
|
||||
tokenManagementDesc: 'NetEase Cloud MusicログインCookieを管理',
|
||||
tokenStatus: '現在のCookieステータス',
|
||||
tokenSet: '設定済み',
|
||||
tokenNotSet: '未設定',
|
||||
setToken: 'Cookieを設定',
|
||||
modifyToken: 'Cookieを変更',
|
||||
clearToken: 'Cookieをクリア',
|
||||
font: 'フォント設定',
|
||||
fontDesc: 'フォントを選択します。前に配置されたフォントが優先されます',
|
||||
fontScope: {
|
||||
global: 'グローバル',
|
||||
lyric: '歌詞のみ'
|
||||
},
|
||||
animation: 'アニメーション速度',
|
||||
animationDesc: 'アニメーションを有効にするかどうか',
|
||||
animationSpeed: {
|
||||
slow: '非常に遅い',
|
||||
normal: '通常',
|
||||
fast: '非常に速い'
|
||||
},
|
||||
fontPreview: {
|
||||
title: 'フォントプレビュー',
|
||||
chinese: '中国語',
|
||||
english: 'English',
|
||||
japanese: '日本語',
|
||||
korean: '韓国語',
|
||||
chineseText: '静夜思 床前明月光 疑是地上霜',
|
||||
englishText: 'The quick brown fox jumps over the lazy dog',
|
||||
japaneseText: 'あいうえお かきくけこ さしすせそ',
|
||||
koreanText: '가나다라마 바사아자차 카타파하'
|
||||
}
|
||||
},
|
||||
playback: {
|
||||
quality: '音質設定',
|
||||
qualityDesc: '音楽再生の音質を選択(NetEase Cloud VIP)',
|
||||
qualityOptions: {
|
||||
standard: '標準',
|
||||
higher: '高音質',
|
||||
exhigh: '超高音質',
|
||||
lossless: 'ロスレス',
|
||||
hires: 'Hi-Res',
|
||||
jyeffect: 'HD サラウンド',
|
||||
sky: 'イマーシブサラウンド',
|
||||
dolby: 'Dolby Atmos',
|
||||
jymaster: '超高解像度マスター'
|
||||
},
|
||||
musicSources: '音源設定',
|
||||
musicSourcesDesc: '音楽解析に使用する音源プラットフォームを選択',
|
||||
musicSourcesWarning: '少なくとも1つの音源プラットフォームを選択する必要があります',
|
||||
musicUnblockEnable: '音楽解析を有効にする',
|
||||
musicUnblockEnableDesc: '有効にすると、再生できない音楽の解析を試みます',
|
||||
configureMusicSources: '音源を設定',
|
||||
selectedMusicSources: '選択された音源:',
|
||||
noMusicSources: '音源が選択されていません',
|
||||
gdmusicInfo: 'GD音楽台は複数のプラットフォーム音源を自動解析し、最適な結果を自動選択できます',
|
||||
autoPlay: '自動再生',
|
||||
autoPlayDesc: 'アプリを再起動した際に自動的に再生を継続するかどうか',
|
||||
showStatusBar: 'ステータスバーコントロール機能を表示するかどうか',
|
||||
showStatusBarContent: 'Macのステータスバーに音楽コントロール機能を表示できます(再起動後に有効)'
|
||||
},
|
||||
application: {
|
||||
closeAction: '閉じる動作',
|
||||
closeActionDesc: 'ウィンドウを閉じる際の動作を選択',
|
||||
closeOptions: {
|
||||
ask: '毎回確認',
|
||||
minimize: 'トレイに最小化',
|
||||
close: '直接終了'
|
||||
},
|
||||
shortcut: 'ショートカット設定',
|
||||
shortcutDesc: 'グローバルショートカットをカスタマイズ',
|
||||
download: 'ダウンロード管理',
|
||||
downloadDesc: 'ダウンロードリストボタンを常に表示するかどうか',
|
||||
unlimitedDownload: '無制限ダウンロード',
|
||||
unlimitedDownloadDesc: '有効にすると音楽を無制限でダウンロードします(ダウンロード失敗の可能性があります)。デフォルトは300曲制限',
|
||||
downloadPath: 'ダウンロードディレクトリ',
|
||||
downloadPathDesc: '音楽ファイルのダウンロード場所を選択',
|
||||
remoteControl: 'リモートコントロール',
|
||||
remoteControlDesc: 'リモートコントロール機能を設定'
|
||||
},
|
||||
network: {
|
||||
apiPort: '音楽APIポート',
|
||||
apiPortDesc: '変更後はアプリの再起動が必要です',
|
||||
proxy: 'プロキシ設定',
|
||||
proxyDesc: '音楽にアクセスできない場合はプロキシを有効にできます',
|
||||
proxyHost: 'プロキシアドレス',
|
||||
proxyHostPlaceholder: 'プロキシアドレスを入力してください',
|
||||
proxyPort: 'プロキシポート',
|
||||
proxyPortPlaceholder: 'プロキシポートを入力してください',
|
||||
realIP: 'realIP設定',
|
||||
realIPDesc: '制限により、このプロジェクトは海外での使用が制限されます。realIPパラメータを使用して国内IPを渡すことで解決できます',
|
||||
messages: {
|
||||
proxySuccess: 'プロキシ設定を保存しました。アプリ再起動後に有効になります',
|
||||
proxyError: '入力が正しいかどうか確認してください',
|
||||
realIPSuccess: '実IPアドレス設定を保存しました',
|
||||
realIPError: '有効なIPアドレスを入力してください'
|
||||
}
|
||||
},
|
||||
system: {
|
||||
cache: 'キャッシュ管理',
|
||||
cacheDesc: 'キャッシュをクリア',
|
||||
cacheClearTitle: 'クリアするキャッシュタイプを選択してください:',
|
||||
cacheTypes: {
|
||||
history: {
|
||||
label: '再生履歴',
|
||||
description: '再生した楽曲の記録をクリア'
|
||||
},
|
||||
favorite: {
|
||||
label: 'お気に入り記録',
|
||||
description: 'ローカルのお気に入り楽曲記録をクリア(クラウドのお気に入りには影響しません)'
|
||||
},
|
||||
user: {
|
||||
label: 'ユーザーデータ',
|
||||
description: 'ログイン情報とユーザー関連データをクリア'
|
||||
},
|
||||
settings: {
|
||||
label: 'アプリ設定',
|
||||
description: 'アプリのすべてのカスタム設定をクリア'
|
||||
},
|
||||
downloads: {
|
||||
label: 'ダウンロード記録',
|
||||
description: 'ダウンロード履歴をクリア(ダウンロード済みファイルは削除されません)'
|
||||
},
|
||||
resources: {
|
||||
label: '音楽リソース',
|
||||
description: '読み込み済みの音楽ファイル、歌詞などのリソースキャッシュをクリア'
|
||||
},
|
||||
lyrics: {
|
||||
label: '歌詞リソース',
|
||||
description: '読み込み済みの歌詞リソースキャッシュをクリア'
|
||||
}
|
||||
},
|
||||
restart: '再起動',
|
||||
restartDesc: 'アプリを再起動',
|
||||
messages: {
|
||||
clearSuccess: 'クリア成功。一部の設定は再起動後に有効になります'
|
||||
}
|
||||
},
|
||||
about: {
|
||||
version: 'バージョン',
|
||||
checkUpdate: '更新を確認',
|
||||
checking: '確認中...',
|
||||
latest: '現在最新バージョンです',
|
||||
hasUpdate: '新しいバージョンが見つかりました',
|
||||
gotoUpdate: '更新へ',
|
||||
gotoGithub: 'Githubへ',
|
||||
author: '作者',
|
||||
authorDesc: 'algerkong スターを付けてください🌟',
|
||||
messages: {
|
||||
checkError: '更新確認に失敗しました。後でもう一度お試しください'
|
||||
}
|
||||
},
|
||||
validation: {
|
||||
selectProxyProtocol: 'プロキシプロトコルを選択してください',
|
||||
proxyHost: 'プロキシアドレスを入力してください',
|
||||
portNumber: '有効なポート番号を入力してください(1-65535)'
|
||||
},
|
||||
lyricSettings: {
|
||||
title: '歌詞設定',
|
||||
tabs: {
|
||||
display: '表示',
|
||||
interface: 'インターフェース',
|
||||
typography: 'テキスト',
|
||||
mobile: 'モバイル'
|
||||
},
|
||||
pureMode: 'ピュアモード',
|
||||
hideCover: 'カバーを非表示',
|
||||
centerDisplay: '中央表示',
|
||||
showTranslation: '翻訳を表示',
|
||||
hideLyrics: '歌詞を非表示',
|
||||
hidePlayBar: '再生バーを非表示',
|
||||
hideMiniPlayBar: 'ミニ再生バーを非表示',
|
||||
showMiniPlayBar: 'ミニ再生バーを表示',
|
||||
backgroundTheme: '背景テーマ',
|
||||
themeOptions: {
|
||||
default: 'デフォルト',
|
||||
light: 'ライト',
|
||||
dark: 'ダーク'
|
||||
},
|
||||
fontSize: 'フォントサイズ',
|
||||
fontSizeMarks: {
|
||||
small: '小',
|
||||
medium: '中',
|
||||
large: '大'
|
||||
},
|
||||
letterSpacing: '文字間隔',
|
||||
letterSpacingMarks: {
|
||||
compact: 'コンパクト',
|
||||
default: 'デフォルト',
|
||||
loose: 'ゆったり'
|
||||
},
|
||||
lineHeight: '行の高さ',
|
||||
lineHeightMarks: {
|
||||
compact: 'コンパクト',
|
||||
default: 'デフォルト',
|
||||
loose: 'ゆったり'
|
||||
},
|
||||
mobileLayout: 'モバイルレイアウト',
|
||||
layoutOptions: {
|
||||
default: 'デフォルト',
|
||||
ios: 'iOSスタイル',
|
||||
android: 'Androidスタイル'
|
||||
},
|
||||
mobileCoverStyle: 'カバースタイル',
|
||||
coverOptions: {
|
||||
record: 'レコード',
|
||||
square: '正方形',
|
||||
full: 'フルスクリーン'
|
||||
},
|
||||
lyricLines: '歌詞行数',
|
||||
mobileUnavailable: 'この設定はモバイルでのみ利用可能です'
|
||||
},
|
||||
themeColor: {
|
||||
title: '歌詞テーマカラー',
|
||||
presetColors: 'プリセットカラー',
|
||||
customColor: 'カスタムカラー',
|
||||
preview: 'プレビュー効果',
|
||||
previewText: '歌詞効果',
|
||||
colorNames: {
|
||||
'spotify-green': 'Spotify グリーン',
|
||||
'apple-blue': 'Apple ブルー',
|
||||
'youtube-red': 'YouTube レッド',
|
||||
orange: 'バイタルオレンジ',
|
||||
purple: 'ミステリアスパープル',
|
||||
pink: 'サクラピンク'
|
||||
},
|
||||
tooltips: {
|
||||
openColorPicker: 'カラーパレットを開く',
|
||||
closeColorPicker: 'カラーパレットを閉じる'
|
||||
},
|
||||
placeholder: '#1db954'
|
||||
},
|
||||
shortcutSettings: {
|
||||
title: 'ショートカット設定',
|
||||
shortcut: 'ショートカット',
|
||||
shortcutDesc: 'ショートカットをカスタマイズ',
|
||||
shortcutConflict: 'ショートカットの競合',
|
||||
inputPlaceholder: 'クリックしてショートカットを入力',
|
||||
resetShortcuts: 'デフォルトに戻す',
|
||||
disableAll: 'すべて無効',
|
||||
enableAll: 'すべて有効',
|
||||
togglePlay: '再生/一時停止',
|
||||
prevPlay: '前の曲',
|
||||
nextPlay: '次の曲',
|
||||
volumeUp: '音量を上げる',
|
||||
volumeDown: '音量を下げる',
|
||||
toggleFavorite: 'お気に入り/お気に入り解除',
|
||||
toggleWindow: 'ウィンドウ表示/非表示',
|
||||
scopeGlobal: 'グローバル',
|
||||
scopeApp: 'アプリ内',
|
||||
enabled: '有効',
|
||||
disabled: '無効',
|
||||
messages: {
|
||||
resetSuccess: 'デフォルトのショートカットに戻しました。保存を忘れずに',
|
||||
conflict: '競合するショートカットがあります。再設定してください',
|
||||
saveSuccess: 'ショートカット設定を保存しました',
|
||||
saveError: 'ショートカットの保存に失敗しました。再試行してください',
|
||||
cancelEdit: '変更をキャンセルしました',
|
||||
disableAll: 'すべてのショートカットを無効にしました。保存を忘れずに',
|
||||
enableAll: 'すべてのショートカットを有効にしました。保存を忘れずに'
|
||||
}
|
||||
},
|
||||
remoteControl: {
|
||||
title: 'リモートコントロール',
|
||||
enable: 'リモートコントロールを有効にする',
|
||||
port: 'サービスポート',
|
||||
allowedIps: '許可されたIPアドレス',
|
||||
addIp: 'IPを追加',
|
||||
emptyListHint: '空のリストはすべてのIPアクセスを許可することを意味します',
|
||||
saveSuccess: 'リモートコントロール設定を保存しました',
|
||||
accessInfo: 'リモートコントロールアクセスアドレス:'
|
||||
},
|
||||
cookie: {
|
||||
title: 'Cookie設定',
|
||||
description: 'NetEase Cloud MusicのCookieを入力してください:',
|
||||
placeholder: '完全なCookieを貼り付けてください...',
|
||||
help: {
|
||||
format: 'Cookieは通常「MUSIC_U=」で始まります',
|
||||
source: 'ブラウザの開発者ツールのネットワークリクエストから取得できます',
|
||||
storage: 'Cookie設定後、自動的にローカルストレージに保存されます'
|
||||
},
|
||||
action: {
|
||||
save: 'Cookieを保存',
|
||||
paste: '貼り付け',
|
||||
clear: 'クリア'
|
||||
},
|
||||
validation: {
|
||||
required: 'Cookieを入力してください',
|
||||
format: 'Cookie形式が正しくない可能性があります。MUSIC_Uが含まれているか確認してください'
|
||||
},
|
||||
message: {
|
||||
saveSuccess: 'Cookieの保存に成功しました',
|
||||
saveError: 'Cookieの保存に失敗しました',
|
||||
pasteSuccess: '貼り付けに成功しました',
|
||||
pasteError: '貼り付けに失敗しました。手動でコピーしてください'
|
||||
},
|
||||
info: {
|
||||
length: '現在の長さ:{length} 文字'
|
||||
}
|
||||
}
|
||||
};
|
||||
export default {
|
||||
theme: 'テーマ',
|
||||
language: '言語',
|
||||
regard: 'について',
|
||||
logout: 'ログアウト',
|
||||
sections: {
|
||||
basic: '基本設定',
|
||||
playback: '再生設定',
|
||||
application: 'アプリケーション設定',
|
||||
network: 'ネットワーク設定',
|
||||
system: 'システム管理',
|
||||
donation: '寄付サポート',
|
||||
regard: 'について'
|
||||
},
|
||||
basic: {
|
||||
themeMode: 'テーマモード',
|
||||
themeModeDesc: 'ライト/ダークテーマの切り替え',
|
||||
autoTheme: 'システムに従う',
|
||||
manualTheme: '手動切り替え',
|
||||
language: '言語設定',
|
||||
languageDesc: '表示言語を切り替え',
|
||||
tokenManagement: 'Cookie管理',
|
||||
tokenManagementDesc: 'NetEase Cloud MusicログインCookieを管理',
|
||||
tokenStatus: '現在のCookieステータス',
|
||||
tokenSet: '設定済み',
|
||||
tokenNotSet: '未設定',
|
||||
setToken: 'Cookieを設定',
|
||||
modifyToken: 'Cookieを変更',
|
||||
clearToken: 'Cookieをクリア',
|
||||
font: 'フォント設定',
|
||||
fontDesc: 'フォントを選択します。前に配置されたフォントが優先されます',
|
||||
fontScope: {
|
||||
global: 'グローバル',
|
||||
lyric: '歌詞のみ'
|
||||
},
|
||||
animation: 'アニメーション速度',
|
||||
animationDesc: 'アニメーションを有効にするかどうか',
|
||||
animationSpeed: {
|
||||
slow: '非常に遅い',
|
||||
normal: '通常',
|
||||
fast: '非常に速い'
|
||||
},
|
||||
fontPreview: {
|
||||
title: 'フォントプレビュー',
|
||||
chinese: '中国語',
|
||||
english: 'English',
|
||||
japanese: '日本語',
|
||||
korean: '韓国語',
|
||||
chineseText: '静夜思 床前明月光 疑是地上霜',
|
||||
englishText: 'The quick brown fox jumps over the lazy dog',
|
||||
japaneseText: 'あいうえお かきくけこ さしすせそ',
|
||||
koreanText: '가나다라마 바사아자차 카타파하'
|
||||
},
|
||||
gpuAcceleration: 'GPUアクセラレーション',
|
||||
gpuAccelerationDesc:
|
||||
'ハードウェアアクセラレーションを有効または無効にします。レンダリングパフォーマンスを向上させますが、GPU負荷が増える可能性があります',
|
||||
gpuAccelerationRestart: 'GPUアクセラレーション設定の変更はアプリの再起動後に有効になります',
|
||||
gpuAccelerationChangeSuccess:
|
||||
'GPUアクセラレーション設定を更新しました。アプリの再起動後に有効になります',
|
||||
gpuAccelerationChangeError: 'GPUアクセラレーション設定の更新に失敗しました',
|
||||
tabletMode: 'タブレットモード',
|
||||
tabletModeDesc:
|
||||
'タブレットモードを有効にすると、モバイルデバイスでPCスタイルのインターフェースを使用できます'
|
||||
},
|
||||
playback: {
|
||||
quality: '音質設定',
|
||||
qualityDesc: '音楽再生の音質を選択(NetEase Cloud VIP)',
|
||||
qualityOptions: {
|
||||
standard: '標準',
|
||||
higher: '高音質',
|
||||
exhigh: '超高音質',
|
||||
lossless: 'ロスレス',
|
||||
hires: 'Hi-Res',
|
||||
jyeffect: 'HD サラウンド',
|
||||
sky: 'イマーシブサラウンド',
|
||||
dolby: 'Dolby Atmos',
|
||||
jymaster: '超高解像度マスター'
|
||||
},
|
||||
musicSources: '音源設定',
|
||||
musicSourcesDesc: '音楽解析に使用する音源プラットフォームを選択',
|
||||
musicSourcesWarning: '少なくとも1つの音源プラットフォームを選択する必要があります',
|
||||
musicUnblockEnable: '音楽解析を有効にする',
|
||||
musicUnblockEnableDesc: '有効にすると、再生できない音楽の解析を試みます',
|
||||
configureMusicSources: '音源を設定',
|
||||
selectedMusicSources: '選択された音源:',
|
||||
noMusicSources: '音源が選択されていません',
|
||||
gdmusicInfo: 'GD音楽台は複数のプラットフォーム音源を自動解析し、最適な結果を自動選択できます',
|
||||
autoPlay: '自動再生',
|
||||
autoPlayDesc: 'アプリを再起動した際に自動的に再生を継続するかどうか',
|
||||
showStatusBar: 'ステータスバーコントロール機能を表示するかどうか',
|
||||
showStatusBarContent:
|
||||
'Macのステータスバーに音楽コントロール機能を表示できます(再起動後に有効)',
|
||||
fallbackParser: '代替解析サービス (GD音楽台)',
|
||||
fallbackParserDesc:
|
||||
'「GD音楽台」にチェックが入っていて、通常の音源で再生できない場合、このサービスが使用されます。',
|
||||
parserGD: 'GD 音楽台 (内蔵)',
|
||||
parserCustom: 'カスタム API',
|
||||
sourceLabels: {
|
||||
migu: 'Migu',
|
||||
kugou: 'Kugou',
|
||||
pyncmd: 'NetEase (内蔵)',
|
||||
bilibili: 'Bilibili',
|
||||
gdmusic: 'GD 音楽台',
|
||||
custom: 'カスタム API'
|
||||
},
|
||||
customApi: {
|
||||
sectionTitle: 'カスタム API 設定',
|
||||
enableHint:
|
||||
'カスタム API を有効にするには、まずカスタム API をインポートする必要があります。',
|
||||
importConfig: 'JSON設定をインポート',
|
||||
currentSource: '現在の音源',
|
||||
notImported: 'カスタム音源はまだインポートされていません。',
|
||||
importSuccess: '音源のインポートに成功しました: {name}',
|
||||
importFailed: 'インポートに失敗しました: {message}'
|
||||
}
|
||||
},
|
||||
application: {
|
||||
closeAction: '閉じる動作',
|
||||
closeActionDesc: 'ウィンドウを閉じる際の動作を選択',
|
||||
closeOptions: {
|
||||
ask: '毎回確認',
|
||||
minimize: 'トレイに最小化',
|
||||
close: '直接終了'
|
||||
},
|
||||
shortcut: 'ショートカット設定',
|
||||
shortcutDesc: 'グローバルショートカットをカスタマイズ',
|
||||
download: 'ダウンロード管理',
|
||||
downloadDesc: 'ダウンロードリストボタンを常に表示するかどうか',
|
||||
unlimitedDownload: '無制限ダウンロード',
|
||||
unlimitedDownloadDesc:
|
||||
'有効にすると音楽を無制限でダウンロードします(ダウンロード失敗の可能性があります)。デフォルトは300曲制限',
|
||||
downloadPath: 'ダウンロードディレクトリ',
|
||||
downloadPathDesc: '音楽ファイルのダウンロード場所を選択',
|
||||
remoteControl: 'リモートコントロール',
|
||||
remoteControlDesc: 'リモートコントロール機能を設定'
|
||||
},
|
||||
network: {
|
||||
apiPort: '音楽APIポート',
|
||||
apiPortDesc: '変更後はアプリの再起動が必要です',
|
||||
proxy: 'プロキシ設定',
|
||||
proxyDesc: '音楽にアクセスできない場合はプロキシを有効にできます',
|
||||
proxyHost: 'プロキシアドレス',
|
||||
proxyHostPlaceholder: 'プロキシアドレスを入力してください',
|
||||
proxyPort: 'プロキシポート',
|
||||
proxyPortPlaceholder: 'プロキシポートを入力してください',
|
||||
realIP: 'realIP設定',
|
||||
realIPDesc:
|
||||
'制限により、このプロジェクトは海外での使用が制限されます。realIPパラメータを使用して国内IPを渡すことで解決できます',
|
||||
messages: {
|
||||
proxySuccess: 'プロキシ設定を保存しました。アプリ再起動後に有効になります',
|
||||
proxyError: '入力が正しいかどうか確認してください',
|
||||
realIPSuccess: '実IPアドレス設定を保存しました',
|
||||
realIPError: '有効なIPアドレスを入力してください'
|
||||
}
|
||||
},
|
||||
system: {
|
||||
cache: 'キャッシュ管理',
|
||||
cacheDesc: 'キャッシュをクリア',
|
||||
cacheClearTitle: 'クリアするキャッシュタイプを選択してください:',
|
||||
cacheTypes: {
|
||||
history: {
|
||||
label: '再生履歴',
|
||||
description: '再生した楽曲の記録をクリア'
|
||||
},
|
||||
favorite: {
|
||||
label: 'お気に入り記録',
|
||||
description: 'ローカルのお気に入り楽曲記録をクリア(クラウドのお気に入りには影響しません)'
|
||||
},
|
||||
user: {
|
||||
label: 'ユーザーデータ',
|
||||
description: 'ログイン情報とユーザー関連データをクリア'
|
||||
},
|
||||
settings: {
|
||||
label: 'アプリ設定',
|
||||
description: 'アプリのすべてのカスタム設定をクリア'
|
||||
},
|
||||
downloads: {
|
||||
label: 'ダウンロード記録',
|
||||
description: 'ダウンロード履歴をクリア(ダウンロード済みファイルは削除されません)'
|
||||
},
|
||||
resources: {
|
||||
label: '音楽リソース',
|
||||
description: '読み込み済みの音楽ファイル、歌詞などのリソースキャッシュをクリア'
|
||||
},
|
||||
lyrics: {
|
||||
label: '歌詞リソース',
|
||||
description: '読み込み済みの歌詞リソースキャッシュをクリア'
|
||||
}
|
||||
},
|
||||
restart: '再起動',
|
||||
restartDesc: 'アプリを再起動',
|
||||
messages: {
|
||||
clearSuccess: 'クリア成功。一部の設定は再起動後に有効になります'
|
||||
}
|
||||
},
|
||||
about: {
|
||||
version: 'バージョン',
|
||||
checkUpdate: '更新を確認',
|
||||
checking: '確認中...',
|
||||
latest: '現在最新バージョンです',
|
||||
hasUpdate: '新しいバージョンが見つかりました',
|
||||
gotoUpdate: '更新へ',
|
||||
gotoGithub: 'Githubへ',
|
||||
author: '作者',
|
||||
authorDesc: 'algerkong スターを付けてください🌟',
|
||||
messages: {
|
||||
checkError: '更新確認に失敗しました。後でもう一度お試しください'
|
||||
}
|
||||
},
|
||||
validation: {
|
||||
selectProxyProtocol: 'プロキシプロトコルを選択してください',
|
||||
proxyHost: 'プロキシアドレスを入力してください',
|
||||
portNumber: '有効なポート番号を入力してください(1-65535)'
|
||||
},
|
||||
lyricSettings: {
|
||||
title: '歌詞設定',
|
||||
tabs: {
|
||||
display: '表示',
|
||||
interface: 'インターフェース',
|
||||
typography: 'テキスト',
|
||||
mobile: 'モバイル'
|
||||
},
|
||||
pureMode: 'ピュアモード',
|
||||
hideCover: 'カバーを非表示',
|
||||
centerDisplay: '中央表示',
|
||||
showTranslation: '翻訳を表示',
|
||||
hideLyrics: '歌詞を非表示',
|
||||
hidePlayBar: '再生バーを非表示',
|
||||
hideMiniPlayBar: 'ミニ再生バーを非表示',
|
||||
showMiniPlayBar: 'ミニ再生バーを表示',
|
||||
backgroundTheme: '背景テーマ',
|
||||
themeOptions: {
|
||||
default: 'デフォルト',
|
||||
light: 'ライト',
|
||||
dark: 'ダーク'
|
||||
},
|
||||
fontSize: 'フォントサイズ',
|
||||
fontSizeMarks: {
|
||||
small: '小',
|
||||
medium: '中',
|
||||
large: '大'
|
||||
},
|
||||
letterSpacing: '文字間隔',
|
||||
letterSpacingMarks: {
|
||||
compact: 'コンパクト',
|
||||
default: 'デフォルト',
|
||||
loose: 'ゆったり'
|
||||
},
|
||||
lineHeight: '行の高さ',
|
||||
lineHeightMarks: {
|
||||
compact: 'コンパクト',
|
||||
default: 'デフォルト',
|
||||
loose: 'ゆったり'
|
||||
},
|
||||
mobileLayout: 'モバイルレイアウト',
|
||||
layoutOptions: {
|
||||
default: 'デフォルト',
|
||||
ios: 'iOSスタイル',
|
||||
android: 'Androidスタイル'
|
||||
},
|
||||
mobileCoverStyle: 'カバースタイル',
|
||||
coverOptions: {
|
||||
record: 'レコード',
|
||||
square: '正方形',
|
||||
full: 'フルスクリーン'
|
||||
},
|
||||
lyricLines: '歌詞行数',
|
||||
mobileUnavailable: 'この設定はモバイルでのみ利用可能です'
|
||||
},
|
||||
translationEngine: '歌詞翻訳エンジン',
|
||||
translationEngineOptions: {
|
||||
none: 'オフ',
|
||||
opencc: 'OpenCC 繁体字化'
|
||||
},
|
||||
themeColor: {
|
||||
title: '歌詞テーマカラー',
|
||||
presetColors: 'プリセットカラー',
|
||||
customColor: 'カスタムカラー',
|
||||
preview: 'プレビュー効果',
|
||||
previewText: '歌詞効果',
|
||||
colorNames: {
|
||||
'spotify-green': 'Spotify グリーン',
|
||||
'apple-blue': 'Apple ブルー',
|
||||
'youtube-red': 'YouTube レッド',
|
||||
orange: 'バイタルオレンジ',
|
||||
purple: 'ミステリアスパープル',
|
||||
pink: 'サクラピンク'
|
||||
},
|
||||
tooltips: {
|
||||
openColorPicker: 'カラーパレットを開く',
|
||||
closeColorPicker: 'カラーパレットを閉じる'
|
||||
},
|
||||
placeholder: '#1db954'
|
||||
},
|
||||
shortcutSettings: {
|
||||
title: 'ショートカット設定',
|
||||
shortcut: 'ショートカット',
|
||||
shortcutDesc: 'ショートカットをカスタマイズ',
|
||||
shortcutConflict: 'ショートカットの競合',
|
||||
inputPlaceholder: 'クリックしてショートカットを入力',
|
||||
resetShortcuts: 'デフォルトに戻す',
|
||||
disableAll: 'すべて無効',
|
||||
enableAll: 'すべて有効',
|
||||
togglePlay: '再生/一時停止',
|
||||
prevPlay: '前の曲',
|
||||
nextPlay: '次の曲',
|
||||
volumeUp: '音量を上げる',
|
||||
volumeDown: '音量を下げる',
|
||||
toggleFavorite: 'お気に入り/お気に入り解除',
|
||||
toggleWindow: 'ウィンドウ表示/非表示',
|
||||
scopeGlobal: 'グローバル',
|
||||
scopeApp: 'アプリ内',
|
||||
enabled: '有効',
|
||||
disabled: '無効',
|
||||
messages: {
|
||||
resetSuccess: 'デフォルトのショートカットに戻しました。保存を忘れずに',
|
||||
conflict: '競合するショートカットがあります。再設定してください',
|
||||
saveSuccess: 'ショートカット設定を保存しました',
|
||||
saveError: 'ショートカットの保存に失敗しました。再試行してください',
|
||||
cancelEdit: '変更をキャンセルしました',
|
||||
disableAll: 'すべてのショートカットを無効にしました。保存を忘れずに',
|
||||
enableAll: 'すべてのショートカットを有効にしました。保存を忘れずに'
|
||||
}
|
||||
},
|
||||
remoteControl: {
|
||||
title: 'リモートコントロール',
|
||||
enable: 'リモートコントロールを有効にする',
|
||||
port: 'サービスポート',
|
||||
allowedIps: '許可されたIPアドレス',
|
||||
addIp: 'IPを追加',
|
||||
emptyListHint: '空のリストはすべてのIPアクセスを許可することを意味します',
|
||||
saveSuccess: 'リモートコントロール設定を保存しました',
|
||||
accessInfo: 'リモートコントロールアクセスアドレス:'
|
||||
},
|
||||
cookie: {
|
||||
title: 'Cookie設定',
|
||||
description: 'NetEase Cloud MusicのCookieを入力してください:',
|
||||
placeholder: '完全なCookieを貼り付けてください...',
|
||||
help: {
|
||||
format: 'Cookieは通常「MUSIC_U=」で始まります',
|
||||
source: 'ブラウザの開発者ツールのネットワークリクエストから取得できます',
|
||||
storage: 'Cookie設定後、自動的にローカルストレージに保存されます'
|
||||
},
|
||||
action: {
|
||||
save: 'Cookieを保存',
|
||||
paste: '貼り付け',
|
||||
clear: 'クリア'
|
||||
},
|
||||
validation: {
|
||||
required: 'Cookieを入力してください',
|
||||
format: 'Cookie形式が正しくない可能性があります。MUSIC_Uが含まれているか確認してください'
|
||||
},
|
||||
message: {
|
||||
saveSuccess: 'Cookieの保存に成功しました',
|
||||
saveError: 'Cookieの保存に失敗しました',
|
||||
pasteSuccess: '貼り付けに成功しました',
|
||||
pasteError: '貼り付けに失敗しました。手動でコピーしてください'
|
||||
},
|
||||
info: {
|
||||
length: '現在の長さ:{length} 文字'
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -25,4 +25,4 @@ export default {
|
||||
negativeText: 'キャンセル'
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
@@ -10,6 +10,11 @@ export default {
|
||||
trackCount: '{count}曲',
|
||||
playCount: '{count}回再生'
|
||||
},
|
||||
tabs: {
|
||||
created: '作成',
|
||||
favorite: 'お気に入り',
|
||||
album: 'アルバム'
|
||||
},
|
||||
ranking: {
|
||||
title: '聴取ランキング',
|
||||
playCount: '{count}回'
|
||||
@@ -45,4 +50,4 @@ export default {
|
||||
deleteSuccess: '削除成功',
|
||||
deleteFailed: '削除失敗'
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
@@ -2,4 +2,4 @@ export default {
|
||||
hotSongs: '인기 곡',
|
||||
albums: '앨범',
|
||||
description: '아티스트 소개'
|
||||
};
|
||||
};
|
||||
|
||||
51
src/i18n/lang/ko-KR/bilibili.ts
Normal file
51
src/i18n/lang/ko-KR/bilibili.ts
Normal file
@@ -0,0 +1,51 @@
|
||||
export default {
|
||||
player: {
|
||||
loading: '오디오 로딩 중...',
|
||||
retry: '다시 시도',
|
||||
playNow: '지금 재생',
|
||||
loadingTitle: '로딩 중...',
|
||||
totalDuration: '총 재생시간: {duration}',
|
||||
partsList: '파트 목록 ({count}화)',
|
||||
playStarted: '재생이 시작되었습니다',
|
||||
switchingPart: '파트 전환 중: {part}',
|
||||
preloadingNext: '다음 파트 미리 로딩 중: {part}',
|
||||
playingCurrent: '현재 선택된 파트 재생 중: {name}',
|
||||
num: '만',
|
||||
errors: {
|
||||
invalidVideoId: '유효하지 않은 비디오 ID',
|
||||
loadVideoDetailFailed: '비디오 세부정보 로드 실패',
|
||||
loadPartInfoFailed: '비디오 파트 정보를 로드할 수 없습니다',
|
||||
loadAudioUrlFailed: '오디오 재생 URL 가져오기 실패',
|
||||
videoDetailNotLoaded: '비디오 세부정보가 로드되지 않았습니다',
|
||||
missingParams: '필수 매개변수가 누락되었습니다',
|
||||
noAvailableAudioUrl: '사용 가능한 오디오 URL을 찾을 수 없습니다',
|
||||
loadPartAudioFailed: '파트 오디오 URL 로드 실패',
|
||||
audioListEmpty: '오디오 목록이 비어있습니다. 다시 시도해주세요',
|
||||
currentPartNotFound: '현재 파트의 오디오를 찾을 수 없습니다',
|
||||
audioUrlFailed: '오디오 URL 가져오기 실패',
|
||||
playFailed: '재생 실패. 다시 시도해주세요',
|
||||
getAudioUrlFailed: '오디오 URL 가져오기 실패. 다시 시도해주세요',
|
||||
audioNotFound: '해당 오디오를 찾을 수 없습니다. 다시 시도해주세요',
|
||||
preloadFailed: '다음 파트 미리 로딩 실패',
|
||||
switchPartFailed: '파트 전환 시 오디오 URL 로드 실패'
|
||||
},
|
||||
console: {
|
||||
loadingDetail: 'Bilibili 비디오 세부정보 로딩 중',
|
||||
detailData: 'Bilibili 비디오 세부정보 데이터',
|
||||
multipleParts: '비디오에 여러 파트가 있습니다. 총 {count}개',
|
||||
noPartsData: '비디오에 파트가 없거나 파트 데이터가 비어있습니다',
|
||||
loadingAudioSource: '오디오 소스 로딩 중',
|
||||
generatedAudioList: '오디오 목록을 생성했습니다. 총 {count}개',
|
||||
getDashAudioUrl: 'dash 오디오 URL을 가져왔습니다',
|
||||
getDurlAudioUrl: 'durl 오디오 URL을 가져왔습니다',
|
||||
loadingPartAudio: '파트 오디오 URL 로딩 중: {part}, cid: {cid}',
|
||||
loadPartAudioFailed: '파트 오디오 URL 로드 실패: {part}',
|
||||
switchToPart: '파트로 전환 중: {part}',
|
||||
audioNotFoundInList: '해당 오디오 항목을 찾을 수 없습니다',
|
||||
preparingToPlay: '현재 선택된 파트 재생 준비 중: {name}',
|
||||
preloadingNextPart: '다음 파트 미리 로딩 중: {part}',
|
||||
playingSelectedPart: '현재 선택된 파트 재생 중: {name}, 오디오 URL: {url}',
|
||||
preloadNextFailed: '다음 파트 미리 로딩 실패'
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -53,4 +53,4 @@ export default {
|
||||
play: '재생',
|
||||
favorite: '즐겨찾기'
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
@@ -41,7 +41,8 @@ export default {
|
||||
noDownloadUrl: '현재 시스템에 적합한 설치 패키지를 찾을 수 없습니다. 수동으로 다운로드해주세요',
|
||||
installConfirmTitle: '업데이트 설치',
|
||||
installConfirmContent: '앱을 닫고 업데이트를 설치하시겠습니까?',
|
||||
manualInstallTip: '앱을 닫은 후 설치 프로그램이 정상적으로 나타나지 않으면 다운로드 폴더에서 파일을 찾아 수동으로 열어주세요.',
|
||||
manualInstallTip:
|
||||
'앱을 닫은 후 설치 프로그램이 정상적으로 나타나지 않으면 다운로드 폴더에서 파일을 찾아 수동으로 열어주세요.',
|
||||
yesInstall: '지금 설치',
|
||||
noThanks: '나중에 설치',
|
||||
fileLocation: '파일 위치',
|
||||
@@ -172,7 +173,8 @@ export default {
|
||||
noTasks: '가져오기 작업이 없습니다',
|
||||
clearTasks: '작업 지우기',
|
||||
clearTasksConfirmTitle: '지우기 확인',
|
||||
clearTasksConfirmContent: '모든 가져오기 작업 기록을 지우시겠습니까? 이 작업은 되돌릴 수 없습니다.',
|
||||
clearTasksConfirmContent:
|
||||
'모든 가져오기 작업 기록을 지우시겠습니까? 이 작업은 되돌릴 수 없습니다.',
|
||||
confirm: '확인',
|
||||
cancel: '취소',
|
||||
clearTasksSuccess: '작업 목록이 지워졌습니다',
|
||||
@@ -187,4 +189,4 @@ export default {
|
||||
mv: 'MV',
|
||||
home: '홈',
|
||||
search: '검색'
|
||||
};
|
||||
};
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
export default {
|
||||
description: '귀하의 기부는 서버 유지보수, 도메인 갱신 등을 포함한 개발 및 유지보수 작업을 지원하는 데 사용됩니다.',
|
||||
description:
|
||||
'귀하의 기부는 서버 유지보수, 도메인 갱신 등을 포함한 개발 및 유지보수 작업을 지원하는 데 사용됩니다.',
|
||||
message: '메시지를 남길 때 이메일이나 GitHub 이름을 남겨주세요.',
|
||||
refresh: '목록 새로고침',
|
||||
toDonateList: '커피 한 잔 사주세요',
|
||||
noMessage: '메시지가 없습니다',
|
||||
title: '기부 목록'
|
||||
};
|
||||
};
|
||||
|
||||
@@ -36,7 +36,8 @@ export default {
|
||||
},
|
||||
clear: {
|
||||
title: '다운로드 기록 지우기',
|
||||
message: '모든 다운로드 기록을 지우시겠습니까? 이 작업은 다운로드된 음악 파일을 삭제하지 않지만 모든 기록을 지웁니다.',
|
||||
message:
|
||||
'모든 다운로드 기록을 지우시겠습니까? 이 작업은 다운로드된 음악 파일을 삭제하지 않지만 모든 기록을 지웁니다.',
|
||||
confirm: '지우기 확인',
|
||||
cancel: '취소',
|
||||
success: '다운로드 기록이 지워졌습니다'
|
||||
@@ -84,4 +85,4 @@ export default {
|
||||
albumName: '앨범명'
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
@@ -10,4 +10,4 @@ export default {
|
||||
selectSongsFirst: '먼저 다운로드할 곡을 선택해주세요',
|
||||
descending: '내림차순',
|
||||
ascending: '오름차순'
|
||||
};
|
||||
};
|
||||
|
||||
@@ -1,5 +1,37 @@
|
||||
export default {
|
||||
title: '재생 기록',
|
||||
heatmapTitle: '히트맵',
|
||||
playCount: '{count}',
|
||||
getHistoryFailed: '기록 가져오기 실패'
|
||||
};
|
||||
getHistoryFailed: '기록 가져오기 실패',
|
||||
tabs: {
|
||||
all: '전체 기록',
|
||||
local: '로컬 기록',
|
||||
cloud: '클라우드 기록'
|
||||
},
|
||||
getCloudRecordFailed: '클라우드 기록 가져오기 실패',
|
||||
needLogin: 'cookie를 사용하여 로그인하여 클라우드 기록을 볼 수 있습니다',
|
||||
merging: '기록 병합 중...',
|
||||
heatmap: {
|
||||
title: '재생 히트맵',
|
||||
loading: '데이터 로딩 중...',
|
||||
unit: '회 재생',
|
||||
footerText: '마우스를 올려서 자세히 보기',
|
||||
playCount: '{count}회 재생',
|
||||
topSongs: '오늘의 인기곡',
|
||||
times: '회',
|
||||
totalPlays: '총 재생 횟수',
|
||||
activeDays: '활동 일수',
|
||||
noData: '재생 기록이 없습니다',
|
||||
colorTheme: '색상 테마',
|
||||
colors: {
|
||||
green: '그린',
|
||||
blue: '블루',
|
||||
orange: '오렌지',
|
||||
purple: '퍼플',
|
||||
red: '레드'
|
||||
},
|
||||
mostPlayedSong: '가장 많이 재생한 노래',
|
||||
mostActiveDay: '가장 활발한 날',
|
||||
latestNightSong: '가장 늘게 재생한 노래'
|
||||
}
|
||||
};
|
||||
|
||||
@@ -41,8 +41,10 @@ export default {
|
||||
uidLoginFailed: 'UID 로그인에 실패했습니다. 사용자 ID가 올바른지 확인하세요',
|
||||
autoGetCookieSuccess: 'Cookie 자동 가져오기 성공',
|
||||
autoGetCookieFailed: 'Cookie 자동 가져오기 실패',
|
||||
autoGetCookieTip: '넷이즈 클라우드 뮤직 로그인 페이지를 열겠습니다. 로그인 완료 후 창을 닫아주세요'
|
||||
autoGetCookieTip:
|
||||
'넷이즈 클라우드 뮤직 로그인 페이지를 열겠습니다. 로그인 완료 후 창을 닫아주세요'
|
||||
},
|
||||
qrTitle: '넷이즈 클라우드 뮤직 QR코드 로그인',
|
||||
uidWarning: '주의: UID 로그인은 사용자 공개 정보를 확인하는 데만 사용할 수 있으며, 로그인 권한이 필요한 기능에 액세스할 수 없습니다.'
|
||||
};
|
||||
uidWarning:
|
||||
'주의: UID 로그인은 사용자 공개 정보를 확인하는 데만 사용할 수 있으며, 로그인 권한이 필요한 기능에 액세스할 수 없습니다.'
|
||||
};
|
||||
|
||||
@@ -1,122 +1,135 @@
|
||||
export default {
|
||||
nowPlaying: '현재 재생 중',
|
||||
playlist: '재생 목록',
|
||||
lyrics: '가사',
|
||||
previous: '이전',
|
||||
play: '재생',
|
||||
pause: '일시정지',
|
||||
next: '다음',
|
||||
volumeUp: '볼륨 증가',
|
||||
volumeDown: '볼륨 감소',
|
||||
mute: '음소거',
|
||||
unmute: '음소거 해제',
|
||||
songNum: '총 곡 수: {num}',
|
||||
addCorrection: '{num}초 앞당기기',
|
||||
subtractCorrection: '{num}초 지연',
|
||||
playFailed: '현재 곡 재생 실패, 다음 곡 재생',
|
||||
playMode: {
|
||||
sequence: '순차 재생',
|
||||
loop: '한 곡 반복',
|
||||
random: '랜덤 재생'
|
||||
},
|
||||
fullscreen: {
|
||||
enter: '전체화면',
|
||||
exit: '전체화면 종료'
|
||||
},
|
||||
close: '닫기',
|
||||
modeHint: {
|
||||
single: '한 곡 반복',
|
||||
list: '자동으로 다음 곡 재생'
|
||||
},
|
||||
lrc: {
|
||||
noLrc: '가사가 없습니다. 음악을 감상해주세요'
|
||||
},
|
||||
reparse: {
|
||||
title: '음원 선택',
|
||||
desc: '음원을 클릭하여 직접 분석하세요. 다음에 이 곡을 재생할 때 선택한 음원을 사용합니다',
|
||||
success: '재분석 성공',
|
||||
failed: '재분석 실패',
|
||||
warning: '음원을 선택해주세요',
|
||||
bilibiliNotSupported: 'B站 비디오는 재분석을 지원하지 않습니다',
|
||||
processing: '분석 중...',
|
||||
clear: '사용자 정의 음원 지우기'
|
||||
},
|
||||
playBar: {
|
||||
expand: '가사 펼치기',
|
||||
collapse: '가사 접기',
|
||||
like: '좋아요',
|
||||
lyric: '가사',
|
||||
noSongPlaying: '재생 중인 곡이 없습니다',
|
||||
eq: '이퀄라이저',
|
||||
playList: '재생 목록',
|
||||
reparse: '재분석',
|
||||
playMode: {
|
||||
sequence: '순차 재생',
|
||||
loop: '반복 재생',
|
||||
random: '랜덤 재생'
|
||||
},
|
||||
play: '재생 시작',
|
||||
pause: '재생 일시정지',
|
||||
prev: '이전 곡',
|
||||
next: '다음 곡',
|
||||
volume: '볼륨',
|
||||
favorite: '{name} 즐겨찾기 추가됨',
|
||||
unFavorite: '{name} 즐겨찾기 해제됨',
|
||||
miniPlayBar: '미니 재생바',
|
||||
playbackSpeed: '재생 속도',
|
||||
advancedControls: '고급 설정'
|
||||
},
|
||||
eq: {
|
||||
title: '이퀄라이저',
|
||||
reset: '재설정',
|
||||
on: '켜기',
|
||||
off: '끄기',
|
||||
bass: '저음',
|
||||
midrange: '중음',
|
||||
treble: '고음',
|
||||
presets: {
|
||||
flat: '플랫',
|
||||
pop: '팝',
|
||||
rock: '록',
|
||||
classical: '클래식',
|
||||
jazz: '재즈',
|
||||
electronic: '일렉트로닉',
|
||||
hiphop: '힙합',
|
||||
rb: 'R&B',
|
||||
metal: '메탈',
|
||||
vocal: '보컬',
|
||||
dance: '댄스',
|
||||
acoustic: '어쿠스틱',
|
||||
custom: '사용자 정의'
|
||||
}
|
||||
},
|
||||
sleepTimer: {
|
||||
title: '타이머 종료',
|
||||
cancel: '타이머 취소',
|
||||
timeMode: '시간으로 종료',
|
||||
songsMode: '곡 수로 종료',
|
||||
playlistEnd: '재생 목록 완료 후 종료',
|
||||
afterPlaylist: '재생 목록 완료 후 종료',
|
||||
activeUntilEnd: '목록 끝까지 재생',
|
||||
minutes: '분',
|
||||
hours: '시간',
|
||||
songs: '곡',
|
||||
set: '설정',
|
||||
timerSetSuccess: '{minutes}분 후 종료로 설정됨',
|
||||
songsSetSuccess: '{songs}곡 재생 후 종료로 설정됨',
|
||||
playlistEndSetSuccess: '재생 목록 완료 후 종료로 설정됨',
|
||||
timerCancelled: '타이머 종료 취소됨',
|
||||
timerEnded: '타이머 종료 실행됨',
|
||||
playbackStopped: '음악 재생이 중지됨',
|
||||
minutesRemaining: '남은 시간 {minutes}분',
|
||||
songsRemaining: '남은 곡 수 {count}곡'
|
||||
},
|
||||
playList: {
|
||||
clearAll: '재생 목록 비우기',
|
||||
alreadyEmpty: '재생 목록이 이미 비어있습니다',
|
||||
cleared: '재생 목록이 비워졌습니다',
|
||||
empty: '재생 목록이 비어있습니다',
|
||||
clearConfirmTitle: '재생 목록 비우기',
|
||||
clearConfirmContent: '재생 목록의 모든 곡을 삭제하고 현재 재생을 중지합니다. 계속하시겠습니까?'
|
||||
}
|
||||
};
|
||||
export default {
|
||||
nowPlaying: '현재 재생 중',
|
||||
playlist: '재생 목록',
|
||||
lyrics: '가사',
|
||||
previous: '이전',
|
||||
play: '재생',
|
||||
pause: '일시정지',
|
||||
next: '다음',
|
||||
volumeUp: '볼륨 증가',
|
||||
volumeDown: '볼륨 감소',
|
||||
mute: '음소거',
|
||||
unmute: '음소거 해제',
|
||||
songNum: '총 곡 수: {num}',
|
||||
addCorrection: '{num}초 앞당기기',
|
||||
subtractCorrection: '{num}초 지연',
|
||||
playFailed: '현재 곡 재생 실패, 다음 곡 재생',
|
||||
playMode: {
|
||||
sequence: '순차 재생',
|
||||
loop: '한 곡 반복',
|
||||
random: '랜덤 재생'
|
||||
},
|
||||
fullscreen: {
|
||||
enter: '전체화면',
|
||||
exit: '전체화면 종료'
|
||||
},
|
||||
close: '닫기',
|
||||
modeHint: {
|
||||
single: '한 곡 반복',
|
||||
list: '자동으로 다음 곡 재생'
|
||||
},
|
||||
lrc: {
|
||||
noLrc: '가사가 없습니다. 음악을 감상해주세요',
|
||||
noAutoScroll: '본 가사는 자동 스크롤을 지원하지 않습니다'
|
||||
},
|
||||
reparse: {
|
||||
title: '음원 선택',
|
||||
desc: '음원을 클릭하여 직접 분석하세요. 다음에 이 곡을 재생할 때 선택한 음원을 사용합니다',
|
||||
success: '재분석 성공',
|
||||
failed: '재분석 실패',
|
||||
warning: '음원을 선택해주세요',
|
||||
bilibiliNotSupported: 'B站 비디오는 재분석을 지원하지 않습니다',
|
||||
processing: '분석 중...',
|
||||
clear: '사용자 정의 음원 지우기',
|
||||
customApiFailed: '사용자 정의 API 분석 실패, 기본 음원을 시도합니다...',
|
||||
customApiError: '사용자 정의 API 요청 오류, 기본 음원을 시도합니다...'
|
||||
},
|
||||
playBar: {
|
||||
expand: '가사 펼치기',
|
||||
collapse: '가사 접기',
|
||||
like: '좋아요',
|
||||
lyric: '가사',
|
||||
noSongPlaying: '재생 중인 곡이 없습니다',
|
||||
eq: '이퀄라이저',
|
||||
playList: '재생 목록',
|
||||
reparse: '재분석',
|
||||
playMode: {
|
||||
sequence: '순차 재생',
|
||||
loop: '반복 재생',
|
||||
random: '랜덤 재생'
|
||||
},
|
||||
play: '재생 시작',
|
||||
pause: '재생 일시정지',
|
||||
prev: '이전 곡',
|
||||
next: '다음 곡',
|
||||
volume: '볼륨',
|
||||
favorite: '{name} 즐겨찾기 추가됨',
|
||||
unFavorite: '{name} 즐겨찾기 해제됨',
|
||||
miniPlayBar: '미니 재생바',
|
||||
playbackSpeed: '재생 속도',
|
||||
advancedControls: '고급 설정',
|
||||
intelligenceMode: {
|
||||
title: '인텔리전스 모드',
|
||||
needCookieLogin: '쿠키 방식으로 로그인한 후 인텔리전스 모드를 사용할 수 있습니다',
|
||||
noFavoritePlaylist: '내가 좋아하는 음악 재생목록을 찾을 수 없습니다',
|
||||
noLikedSongs: '아직 좋아한 노래가 없습니다',
|
||||
loading: '인텔리전스 모드를 불러오는 중',
|
||||
success: '총 {count}곡을 불러왔습니다',
|
||||
failed: '인텔리전스 모드 목록을 가져오는 데 실패했습니다',
|
||||
error: '인텔리전스 모드 재생 오류'
|
||||
}
|
||||
},
|
||||
eq: {
|
||||
title: '이퀄라이저',
|
||||
reset: '재설정',
|
||||
on: '켜기',
|
||||
off: '끄기',
|
||||
bass: '저음',
|
||||
midrange: '중음',
|
||||
treble: '고음',
|
||||
presets: {
|
||||
flat: '플랫',
|
||||
pop: '팝',
|
||||
rock: '록',
|
||||
classical: '클래식',
|
||||
jazz: '재즈',
|
||||
electronic: '일렉트로닉',
|
||||
hiphop: '힙합',
|
||||
rb: 'R&B',
|
||||
metal: '메탈',
|
||||
vocal: '보컬',
|
||||
dance: '댄스',
|
||||
acoustic: '어쿠스틱',
|
||||
custom: '사용자 정의'
|
||||
}
|
||||
},
|
||||
sleepTimer: {
|
||||
title: '타이머 종료',
|
||||
cancel: '타이머 취소',
|
||||
timeMode: '시간으로 종료',
|
||||
songsMode: '곡 수로 종료',
|
||||
playlistEnd: '재생 목록 완료 후 종료',
|
||||
afterPlaylist: '재생 목록 완료 후 종료',
|
||||
activeUntilEnd: '목록 끝까지 재생',
|
||||
minutes: '분',
|
||||
hours: '시간',
|
||||
songs: '곡',
|
||||
set: '설정',
|
||||
timerSetSuccess: '{minutes}분 후 종료로 설정됨',
|
||||
songsSetSuccess: '{songs}곡 재생 후 종료로 설정됨',
|
||||
playlistEndSetSuccess: '재생 목록 완료 후 종료로 설정됨',
|
||||
timerCancelled: '타이머 종료 취소됨',
|
||||
timerEnded: '타이머 종료 실행됨',
|
||||
playbackStopped: '음악 재생이 중지됨',
|
||||
minutesRemaining: '남은 시간 {minutes}분',
|
||||
songsRemaining: '남은 곡 수 {count}곡'
|
||||
},
|
||||
playList: {
|
||||
clearAll: '재생 목록 비우기',
|
||||
alreadyEmpty: '재생 목록이 이미 비어있습니다',
|
||||
cleared: '재생 목록이 비워졌습니다',
|
||||
empty: '재생 목록이 비어있습니다',
|
||||
clearConfirmTitle: '재생 목록 비우기',
|
||||
clearConfirmContent: '재생 목록의 모든 곡을 삭제하고 현재 재생을 중지합니다. 계속하시겠습니까?'
|
||||
}
|
||||
};
|
||||
|
||||
@@ -24,4 +24,4 @@ export default {
|
||||
mv: 'MV',
|
||||
bilibili: 'B站'
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
@@ -1,322 +1,364 @@
|
||||
export default {
|
||||
theme: '테마',
|
||||
language: '언어',
|
||||
regard: '정보',
|
||||
logout: '로그아웃',
|
||||
sections: {
|
||||
basic: '기본 설정',
|
||||
playback: '재생 설정',
|
||||
application: '애플리케이션 설정',
|
||||
network: '네트워크 설정',
|
||||
system: '시스템 관리',
|
||||
donation: '후원 지원',
|
||||
regard: '정보'
|
||||
},
|
||||
basic: {
|
||||
themeMode: '테마 모드',
|
||||
themeModeDesc: '낮/밤 테마 전환',
|
||||
autoTheme: '시스템 따라가기',
|
||||
manualTheme: '수동 전환',
|
||||
language: '언어 설정',
|
||||
languageDesc: '표시 언어 전환',
|
||||
tokenManagement: 'Cookie 관리',
|
||||
tokenManagementDesc: '넷이즈 클라우드 뮤직 로그인 Cookie 관리',
|
||||
tokenStatus: '현재 Cookie 상태',
|
||||
tokenSet: '설정됨',
|
||||
tokenNotSet: '설정되지 않음',
|
||||
setToken: 'Cookie 설정',
|
||||
modifyToken: 'Cookie 수정',
|
||||
clearToken: 'Cookie 지우기',
|
||||
font: '폰트 설정',
|
||||
fontDesc: '폰트 선택, 앞에 있는 폰트를 우선 사용',
|
||||
fontScope: {
|
||||
global: '전역',
|
||||
lyric: '가사만'
|
||||
},
|
||||
animation: '애니메이션 속도',
|
||||
animationDesc: '애니메이션 활성화 여부',
|
||||
animationSpeed: {
|
||||
slow: '매우 느림',
|
||||
normal: '보통',
|
||||
fast: '매우 빠름'
|
||||
},
|
||||
fontPreview: {
|
||||
title: '폰트 미리보기',
|
||||
chinese: '中文',
|
||||
english: 'English',
|
||||
japanese: '日本語',
|
||||
korean: '한국어',
|
||||
chineseText: '静夜思 床前明月光 疑是地上霜',
|
||||
englishText: 'The quick brown fox jumps over the lazy dog',
|
||||
japaneseText: 'あいうえお かきくけこ さしすせそ',
|
||||
koreanText: '가나다라마 바사아자차 카타파하'
|
||||
}
|
||||
},
|
||||
playback: {
|
||||
quality: '음질 설정',
|
||||
qualityDesc: '음악 재생 음질 선택 (넷이즈 클라우드 VIP)',
|
||||
qualityOptions: {
|
||||
standard: '표준',
|
||||
higher: '높음',
|
||||
exhigh: '매우 높음',
|
||||
lossless: '무손실',
|
||||
hires: 'Hi-Res',
|
||||
jyeffect: 'HD 서라운드',
|
||||
sky: '몰입형 서라운드',
|
||||
dolby: '돌비 애트모스',
|
||||
jymaster: '초고화질 마스터'
|
||||
},
|
||||
musicSources: '음원 설정',
|
||||
musicSourcesDesc: '음악 해석에 사용할 음원 플랫폼 선택',
|
||||
musicSourcesWarning: '최소 하나의 음원 플랫폼을 선택해야 합니다',
|
||||
musicUnblockEnable: '음악 해석 활성화',
|
||||
musicUnblockEnableDesc: '활성화하면 재생할 수 없는 음악을 해석하려고 시도합니다',
|
||||
configureMusicSources: '음원 구성',
|
||||
selectedMusicSources: '선택된 음원:',
|
||||
noMusicSources: '음원이 선택되지 않음',
|
||||
gdmusicInfo: 'GD 뮤직은 여러 플랫폼 음원을 자동으로 해석하고 최적의 결과를 자동 선택합니다',
|
||||
autoPlay: '자동 재생',
|
||||
autoPlayDesc: '앱을 다시 열 때 자동으로 재생을 계속할지 여부',
|
||||
showStatusBar: '상태바 제어 기능 표시 여부',
|
||||
showStatusBarContent: 'Mac 상태바에 음악 제어 기능을 표시할 수 있습니다 (재시작 후 적용)'
|
||||
},
|
||||
application: {
|
||||
closeAction: '닫기 동작',
|
||||
closeActionDesc: '창을 닫을 때의 동작 선택',
|
||||
closeOptions: {
|
||||
ask: '매번 묻기',
|
||||
minimize: '트레이로 최소화',
|
||||
close: '직접 종료'
|
||||
},
|
||||
shortcut: '단축키 설정',
|
||||
shortcutDesc: '전역 단축키 사용자 정의',
|
||||
download: '다운로드 관리',
|
||||
downloadDesc: '다운로드 목록 버튼을 항상 표시할지 여부',
|
||||
unlimitedDownload: '무제한 다운로드',
|
||||
unlimitedDownloadDesc: '활성화하면 음악을 무제한으로 다운로드합니다 (다운로드 실패가 발생할 수 있음), 기본 제한 300곡',
|
||||
downloadPath: '다운로드 디렉토리',
|
||||
downloadPathDesc: '음악 파일의 다운로드 위치 선택',
|
||||
remoteControl: '원격 제어',
|
||||
remoteControlDesc: '원격 제어 기능 설정'
|
||||
},
|
||||
network: {
|
||||
apiPort: '음악 API 포트',
|
||||
apiPortDesc: '수정 후 앱을 재시작해야 합니다',
|
||||
proxy: '프록시 설정',
|
||||
proxyDesc: '음악에 액세스할 수 없을 때 프록시를 활성화할 수 있습니다',
|
||||
proxyHost: '프록시 주소',
|
||||
proxyHostPlaceholder: '프록시 주소를 입력하세요',
|
||||
proxyPort: '프록시 포트',
|
||||
proxyPortPlaceholder: '프록시 포트를 입력하세요',
|
||||
realIP: 'realIP 설정',
|
||||
realIPDesc: '제한으로 인해 이 프로젝트는 해외에서 사용할 때 제한을 받을 수 있으며, realIP 매개변수를 사용하여 국내 IP를 전달하여 해결할 수 있습니다',
|
||||
messages: {
|
||||
proxySuccess: '프록시 설정이 저장되었습니다. 앱을 재시작한 후 적용됩니다',
|
||||
proxyError: '입력이 올바른지 확인하세요',
|
||||
realIPSuccess: '실제 IP 설정이 저장되었습니다',
|
||||
realIPError: '유효한 IP 주소를 입력하세요'
|
||||
}
|
||||
},
|
||||
system: {
|
||||
cache: '캐시 관리',
|
||||
cacheDesc: '캐시 지우기',
|
||||
cacheClearTitle: '지울 캐시 유형을 선택하세요:',
|
||||
cacheTypes: {
|
||||
history: {
|
||||
label: '재생 기록',
|
||||
description: '재생한 곡 기록 지우기'
|
||||
},
|
||||
favorite: {
|
||||
label: '즐겨찾기 기록',
|
||||
description: '로컬 즐겨찾기 곡 기록 지우기 (클라우드 즐겨찾기에는 영향 없음)'
|
||||
},
|
||||
user: {
|
||||
label: '사용자 데이터',
|
||||
description: '로그인 정보 및 사용자 관련 데이터 지우기'
|
||||
},
|
||||
settings: {
|
||||
label: '앱 설정',
|
||||
description: '앱의 모든 사용자 정의 설정 지우기'
|
||||
},
|
||||
downloads: {
|
||||
label: '다운로드 기록',
|
||||
description: '다운로드 기록 지우기 (다운로드된 파일은 삭제되지 않음)'
|
||||
},
|
||||
resources: {
|
||||
label: '음악 리소스',
|
||||
description: '로드된 음악 파일, 가사 등 리소스 캐시 지우기'
|
||||
},
|
||||
lyrics: {
|
||||
label: '가사 리소스',
|
||||
description: '로드된 가사 리소스 캐시 지우기'
|
||||
}
|
||||
},
|
||||
restart: '재시작',
|
||||
restartDesc: '앱 재시작',
|
||||
messages: {
|
||||
clearSuccess: '지우기 성공, 일부 설정은 재시작 후 적용됩니다'
|
||||
}
|
||||
},
|
||||
about: {
|
||||
version: '버전',
|
||||
checkUpdate: '업데이트 확인',
|
||||
checking: '확인 중...',
|
||||
latest: '현재 최신 버전입니다',
|
||||
hasUpdate: '새 버전 발견',
|
||||
gotoUpdate: '업데이트하러 가기',
|
||||
gotoGithub: 'Github로 이동',
|
||||
author: '작성자',
|
||||
authorDesc: 'algerkong 별점🌟 부탁드려요',
|
||||
messages: {
|
||||
checkError: '업데이트 확인 실패, 나중에 다시 시도하세요'
|
||||
}
|
||||
},
|
||||
validation: {
|
||||
selectProxyProtocol: '프록시 프로토콜을 선택하세요',
|
||||
proxyHost: '프록시 주소를 입력하세요',
|
||||
portNumber: '유효한 포트 번호를 입력하세요 (1-65535)'
|
||||
},
|
||||
lyricSettings: {
|
||||
title: '가사 설정',
|
||||
tabs: {
|
||||
display: '표시',
|
||||
interface: '인터페이스',
|
||||
typography: '텍스트',
|
||||
mobile: '모바일'
|
||||
},
|
||||
pureMode: '순수 모드',
|
||||
hideCover: '커버 숨기기',
|
||||
centerDisplay: '중앙 표시',
|
||||
showTranslation: '번역 표시',
|
||||
hideLyrics: '가사 숨기기',
|
||||
hidePlayBar: '재생바 숨기기',
|
||||
hideMiniPlayBar: '미니 재생바 숨기기',
|
||||
showMiniPlayBar: '미니 재생바 표시',
|
||||
backgroundTheme: '배경 테마',
|
||||
themeOptions: {
|
||||
default: '기본',
|
||||
light: '밝음',
|
||||
dark: '어둠'
|
||||
},
|
||||
fontSize: '폰트 크기',
|
||||
fontSizeMarks: {
|
||||
small: '작음',
|
||||
medium: '중간',
|
||||
large: '큼'
|
||||
},
|
||||
letterSpacing: '글자 간격',
|
||||
letterSpacingMarks: {
|
||||
compact: '좁음',
|
||||
default: '기본',
|
||||
loose: '넓음'
|
||||
},
|
||||
lineHeight: '줄 높이',
|
||||
lineHeightMarks: {
|
||||
compact: '좁음',
|
||||
default: '기본',
|
||||
loose: '넓음'
|
||||
},
|
||||
mobileLayout: '모바일 레이아웃',
|
||||
layoutOptions: {
|
||||
default: '기본',
|
||||
ios: 'iOS 스타일',
|
||||
android: '안드로이드 스타일'
|
||||
},
|
||||
mobileCoverStyle: '커버 스타일',
|
||||
coverOptions: {
|
||||
record: '레코드',
|
||||
square: '정사각형',
|
||||
full: '전체화면'
|
||||
},
|
||||
lyricLines: '가사 줄 수',
|
||||
mobileUnavailable: '이 설정은 모바일에서만 사용 가능합니다'
|
||||
},
|
||||
themeColor: {
|
||||
title: '가사 테마 색상',
|
||||
presetColors: '미리 설정된 색상',
|
||||
customColor: '사용자 정의 색상',
|
||||
preview: '미리보기 효과',
|
||||
previewText: '가사 효과',
|
||||
colorNames: {
|
||||
'spotify-green': 'Spotify 그린',
|
||||
'apple-blue': '애플 블루',
|
||||
'youtube-red': 'YouTube 레드',
|
||||
orange: '활력 오렌지',
|
||||
purple: '신비 퍼플',
|
||||
pink: '벚꽃 핑크'
|
||||
},
|
||||
tooltips: {
|
||||
openColorPicker: '색상 선택기 열기',
|
||||
closeColorPicker: '색상 선택기 닫기'
|
||||
},
|
||||
placeholder: '#1db954'
|
||||
},
|
||||
shortcutSettings: {
|
||||
title: '단축키 설정',
|
||||
shortcut: '단축키',
|
||||
shortcutDesc: '단축키 사용자 정의',
|
||||
shortcutConflict: '단축키 충돌',
|
||||
inputPlaceholder: '클릭하여 단축키 입력',
|
||||
resetShortcuts: '기본값 복원',
|
||||
disableAll: '모두 비활성화',
|
||||
enableAll: '모두 활성화',
|
||||
togglePlay: '재생/일시정지',
|
||||
prevPlay: '이전 곡',
|
||||
nextPlay: '다음 곡',
|
||||
volumeUp: '볼륨 증가',
|
||||
volumeDown: '볼륨 감소',
|
||||
toggleFavorite: '즐겨찾기/즐겨찾기 취소',
|
||||
toggleWindow: '창 표시/숨기기',
|
||||
scopeGlobal: '전역',
|
||||
scopeApp: '앱 내',
|
||||
enabled: '활성화',
|
||||
disabled: '비활성화',
|
||||
messages: {
|
||||
resetSuccess: '기본 단축키로 복원되었습니다. 저장을 잊지 마세요',
|
||||
conflict: '충돌하는 단축키가 있습니다. 다시 설정하세요',
|
||||
saveSuccess: '단축키 설정이 저장되었습니다',
|
||||
saveError: '단축키 저장 실패, 다시 시도하세요',
|
||||
cancelEdit: '수정이 취소되었습니다',
|
||||
disableAll: '모든 단축키가 비활성화되었습니다. 저장을 잊지 마세요',
|
||||
enableAll: '모든 단축키가 활성화되었습니다. 저장을 잊지 마세요'
|
||||
}
|
||||
},
|
||||
remoteControl: {
|
||||
title: '원격 제어',
|
||||
enable: '원격 제어 활성화',
|
||||
port: '서비스 포트',
|
||||
allowedIps: '허용된 IP 주소',
|
||||
addIp: 'IP 추가',
|
||||
emptyListHint: '빈 목록은 모든 IP 액세스를 허용함을 의미합니다',
|
||||
saveSuccess: '원격 제어 설정이 저장되었습니다',
|
||||
accessInfo: '원격 제어 액세스 주소:'
|
||||
},
|
||||
cookie: {
|
||||
title: 'Cookie 설정',
|
||||
description: '넷이즈 클라우드 뮤직의 Cookie를 입력하세요:',
|
||||
placeholder: '완전한 Cookie를 붙여넣으세요...',
|
||||
help: {
|
||||
format: 'Cookie는 일반적으로 "MUSIC_U="로 시작합니다',
|
||||
source: '브라우저 개발자 도구의 네트워크 요청에서 얻을 수 있습니다',
|
||||
storage: 'Cookie 설정 후 자동으로 로컬 저장소에 저장됩니다'
|
||||
},
|
||||
action: {
|
||||
save: 'Cookie 저장',
|
||||
paste: '붙여넣기',
|
||||
clear: '지우기'
|
||||
},
|
||||
validation: {
|
||||
required: 'Cookie를 입력하세요',
|
||||
format: 'Cookie 형식이 올바르지 않을 수 있습니다. MUSIC_U가 포함되어 있는지 확인하세요'
|
||||
},
|
||||
message: {
|
||||
saveSuccess: 'Cookie 저장 성공',
|
||||
saveError: 'Cookie 저장 실패',
|
||||
pasteSuccess: '붙여넣기 성공',
|
||||
pasteError: '붙여넣기 실패, 수동으로 복사하세요'
|
||||
},
|
||||
info: {
|
||||
length: '현재 길이: {length} 문자'
|
||||
}
|
||||
}
|
||||
};
|
||||
export default {
|
||||
theme: '테마',
|
||||
language: '언어',
|
||||
regard: '정보',
|
||||
logout: '로그아웃',
|
||||
sections: {
|
||||
basic: '기본 설정',
|
||||
playback: '재생 설정',
|
||||
application: '애플리케이션 설정',
|
||||
network: '네트워크 설정',
|
||||
system: '시스템 관리',
|
||||
donation: '후원 지원',
|
||||
regard: '정보'
|
||||
},
|
||||
basic: {
|
||||
themeMode: '테마 모드',
|
||||
themeModeDesc: '낮/밤 테마 전환',
|
||||
autoTheme: '시스템 따라가기',
|
||||
manualTheme: '수동 전환',
|
||||
language: '언어 설정',
|
||||
languageDesc: '표시 언어 전환',
|
||||
tokenManagement: 'Cookie 관리',
|
||||
tokenManagementDesc: '넷이즈 클라우드 뮤직 로그인 Cookie 관리',
|
||||
tokenStatus: '현재 Cookie 상태',
|
||||
tokenSet: '설정됨',
|
||||
tokenNotSet: '설정되지 않음',
|
||||
setToken: 'Cookie 설정',
|
||||
modifyToken: 'Cookie 수정',
|
||||
clearToken: 'Cookie 지우기',
|
||||
font: '폰트 설정',
|
||||
fontDesc: '폰트 선택, 앞에 있는 폰트를 우선 사용',
|
||||
fontScope: {
|
||||
global: '전역',
|
||||
lyric: '가사만'
|
||||
},
|
||||
animation: '애니메이션 속도',
|
||||
animationDesc: '애니메이션 활성화 여부',
|
||||
animationSpeed: {
|
||||
slow: '매우 느림',
|
||||
normal: '보통',
|
||||
fast: '매우 빠름'
|
||||
},
|
||||
fontPreview: {
|
||||
title: '폰트 미리보기',
|
||||
chinese: '中文',
|
||||
english: 'English',
|
||||
japanese: '日本語',
|
||||
korean: '한국어',
|
||||
chineseText: '静夜思 床前明月光 疑是地上霜',
|
||||
englishText: 'The quick brown fox jumps over the lazy dog',
|
||||
japaneseText: 'あいうえお かきくけこ さしすせそ',
|
||||
koreanText: '가나다라마 바사아자차 카타파하'
|
||||
},
|
||||
gpuAcceleration: 'GPU 가속',
|
||||
gpuAccelerationDesc:
|
||||
'GPU 가속을 사용하면 애니메이션이 빠르게 재생되고 애니메이션이 느리게 재생되는 것보다 느릴 수 있습니다.',
|
||||
gpuAccelerationRestart: 'GPU 가속 설정을 변경하면 애플리케이션을 다시 시작해야 합니다',
|
||||
gpuAccelerationChangeSuccess:
|
||||
'GPU 가속 설정이 업데이트되었습니다. 애플리케이션을 다시 시작하여 적용하십시오',
|
||||
gpuAccelerationChangeError: 'GPU 가속 설정 업데이트에 실패했습니다',
|
||||
tabletMode: '태블릿 모드',
|
||||
tabletModeDesc:
|
||||
'태블릿 모드를 사용하면 모바일 기기에서 PC 스타일의 인터페이스를 사용할 수 있습니다'
|
||||
},
|
||||
playback: {
|
||||
quality: '음질 설정',
|
||||
qualityDesc: '음악 재생 음질 선택 (넷이즈 클라우드 VIP)',
|
||||
qualityOptions: {
|
||||
standard: '표준',
|
||||
higher: '높음',
|
||||
exhigh: '매우 높음',
|
||||
lossless: '무손실',
|
||||
hires: 'Hi-Res',
|
||||
jyeffect: 'HD 서라운드',
|
||||
sky: '몰입형 서라운드',
|
||||
dolby: '돌비 애트모스',
|
||||
jymaster: '초고화질 마스터'
|
||||
},
|
||||
musicSources: '음원 설정',
|
||||
musicSourcesDesc: '음악 해석에 사용할 음원 플랫폼 선택',
|
||||
musicSourcesWarning: '최소 하나의 음원 플랫폼을 선택해야 합니다',
|
||||
musicUnblockEnable: '음악 해석 활성화',
|
||||
musicUnblockEnableDesc: '활성화하면 재생할 수 없는 음악을 해석하려고 시도합니다',
|
||||
configureMusicSources: '음원 구성',
|
||||
selectedMusicSources: '선택된 음원:',
|
||||
noMusicSources: '음원이 선택되지 않음',
|
||||
gdmusicInfo: 'GD 뮤직은 여러 플랫폼 음원을 자동으로 해석하고 최적의 결과를 자동 선택합니다',
|
||||
autoPlay: '자동 재생',
|
||||
autoPlayDesc: '앱을 다시 열 때 자동으로 재생을 계속할지 여부',
|
||||
showStatusBar: '상태바 제어 기능 표시 여부',
|
||||
showStatusBarContent: 'Mac 상태바에 음악 제어 기능을 표시할 수 있습니다 (재시작 후 적용)',
|
||||
fallbackParser: '대체 분석 서비스 (GD Music)',
|
||||
fallbackParserDesc:
|
||||
'"GD Music"을 선택하고 일반 음원을 사용할 수 없을 때 이 서비스를 사용합니다.',
|
||||
parserGD: 'GD Music (내장)',
|
||||
parserCustom: '사용자 지정 API',
|
||||
|
||||
// 음원 라벨
|
||||
sourceLabels: {
|
||||
migu: 'Migu',
|
||||
kugou: 'Kugou',
|
||||
pyncmd: 'NetEase (내장)',
|
||||
bilibili: 'Bilibili',
|
||||
gdmusic: 'GD Music',
|
||||
custom: '사용자 지정 API'
|
||||
},
|
||||
|
||||
customApi: {
|
||||
sectionTitle: '사용자 지정 API 설정',
|
||||
importConfig: 'JSON 설정 가져오기',
|
||||
currentSource: '현재 음원',
|
||||
notImported: '아직 사용자 지정 음원을 가져오지 않았습니다.',
|
||||
importSuccess: '음원 가져오기 성공: {name}',
|
||||
importFailed: '가져오기 실패: {message}',
|
||||
enableHint: '사용하려면 먼저 JSON 구성 파일을 가져오세요'
|
||||
}
|
||||
},
|
||||
application: {
|
||||
closeAction: '닫기 동작',
|
||||
closeActionDesc: '창을 닫을 때의 동작 선택',
|
||||
closeOptions: {
|
||||
ask: '매번 묻기',
|
||||
minimize: '트레이로 최소화',
|
||||
close: '직접 종료'
|
||||
},
|
||||
shortcut: '단축키 설정',
|
||||
shortcutDesc: '전역 단축키 사용자 정의',
|
||||
download: '다운로드 관리',
|
||||
downloadDesc: '다운로드 목록 버튼을 항상 표시할지 여부',
|
||||
unlimitedDownload: '무제한 다운로드',
|
||||
unlimitedDownloadDesc:
|
||||
'활성화하면 음악을 무제한으로 다운로드합니다 (다운로드 실패가 발생할 수 있음), 기본 제한 300곡',
|
||||
downloadPath: '다운로드 디렉토리',
|
||||
downloadPathDesc: '음악 파일의 다운로드 위치 선택',
|
||||
remoteControl: '원격 제어',
|
||||
remoteControlDesc: '원격 제어 기능 설정'
|
||||
},
|
||||
network: {
|
||||
apiPort: '음악 API 포트',
|
||||
apiPortDesc: '수정 후 앱을 재시작해야 합니다',
|
||||
proxy: '프록시 설정',
|
||||
proxyDesc: '음악에 액세스할 수 없을 때 프록시를 활성화할 수 있습니다',
|
||||
proxyHost: '프록시 주소',
|
||||
proxyHostPlaceholder: '프록시 주소를 입력하세요',
|
||||
proxyPort: '프록시 포트',
|
||||
proxyPortPlaceholder: '프록시 포트를 입력하세요',
|
||||
realIP: 'realIP 설정',
|
||||
realIPDesc:
|
||||
'제한으로 인해 이 프로젝트는 해외에서 사용할 때 제한을 받을 수 있으며, realIP 매개변수를 사용하여 국내 IP를 전달하여 해결할 수 있습니다',
|
||||
messages: {
|
||||
proxySuccess: '프록시 설정이 저장되었습니다. 앱을 재시작한 후 적용됩니다',
|
||||
proxyError: '입력이 올바른지 확인하세요',
|
||||
realIPSuccess: '실제 IP 설정이 저장되었습니다',
|
||||
realIPError: '유효한 IP 주소를 입력하세요'
|
||||
}
|
||||
},
|
||||
system: {
|
||||
cache: '캐시 관리',
|
||||
cacheDesc: '캐시 지우기',
|
||||
cacheClearTitle: '지울 캐시 유형을 선택하세요:',
|
||||
cacheTypes: {
|
||||
history: {
|
||||
label: '재생 기록',
|
||||
description: '재생한 곡 기록 지우기'
|
||||
},
|
||||
favorite: {
|
||||
label: '즐겨찾기 기록',
|
||||
description: '로컬 즐겨찾기 곡 기록 지우기 (클라우드 즐겨찾기에는 영향 없음)'
|
||||
},
|
||||
user: {
|
||||
label: '사용자 데이터',
|
||||
description: '로그인 정보 및 사용자 관련 데이터 지우기'
|
||||
},
|
||||
settings: {
|
||||
label: '앱 설정',
|
||||
description: '앱의 모든 사용자 정의 설정 지우기'
|
||||
},
|
||||
downloads: {
|
||||
label: '다운로드 기록',
|
||||
description: '다운로드 기록 지우기 (다운로드된 파일은 삭제되지 않음)'
|
||||
},
|
||||
resources: {
|
||||
label: '음악 리소스',
|
||||
description: '로드된 음악 파일, 가사 등 리소스 캐시 지우기'
|
||||
},
|
||||
lyrics: {
|
||||
label: '가사 리소스',
|
||||
description: '로드된 가사 리소스 캐시 지우기'
|
||||
}
|
||||
},
|
||||
restart: '재시작',
|
||||
restartDesc: '앱 재시작',
|
||||
messages: {
|
||||
clearSuccess: '지우기 성공, 일부 설정은 재시작 후 적용됩니다'
|
||||
}
|
||||
},
|
||||
about: {
|
||||
version: '버전',
|
||||
checkUpdate: '업데이트 확인',
|
||||
checking: '확인 중...',
|
||||
latest: '현재 최신 버전입니다',
|
||||
hasUpdate: '새 버전 발견',
|
||||
gotoUpdate: '업데이트하러 가기',
|
||||
gotoGithub: 'Github로 이동',
|
||||
author: '작성자',
|
||||
authorDesc: 'algerkong 별점🌟 부탁드려요',
|
||||
messages: {
|
||||
checkError: '업데이트 확인 실패, 나중에 다시 시도하세요'
|
||||
}
|
||||
},
|
||||
validation: {
|
||||
selectProxyProtocol: '프록시 프로토콜을 선택하세요',
|
||||
proxyHost: '프록시 주소를 입력하세요',
|
||||
portNumber: '유효한 포트 번호를 입력하세요 (1-65535)'
|
||||
},
|
||||
lyricSettings: {
|
||||
title: '가사 설정',
|
||||
tabs: {
|
||||
display: '표시',
|
||||
interface: '인터페이스',
|
||||
typography: '텍스트',
|
||||
mobile: '모바일'
|
||||
},
|
||||
pureMode: '순수 모드',
|
||||
hideCover: '커버 숨기기',
|
||||
centerDisplay: '중앙 표시',
|
||||
showTranslation: '번역 표시',
|
||||
hideLyrics: '가사 숨기기',
|
||||
hidePlayBar: '재생바 숨기기',
|
||||
hideMiniPlayBar: '미니 재생바 숨기기',
|
||||
showMiniPlayBar: '미니 재생바 표시',
|
||||
backgroundTheme: '배경 테마',
|
||||
themeOptions: {
|
||||
default: '기본',
|
||||
light: '밝음',
|
||||
dark: '어둠'
|
||||
},
|
||||
fontSize: '폰트 크기',
|
||||
fontSizeMarks: {
|
||||
small: '작음',
|
||||
medium: '중간',
|
||||
large: '큼'
|
||||
},
|
||||
letterSpacing: '글자 간격',
|
||||
letterSpacingMarks: {
|
||||
compact: '좁음',
|
||||
default: '기본',
|
||||
loose: '넓음'
|
||||
},
|
||||
lineHeight: '줄 높이',
|
||||
lineHeightMarks: {
|
||||
compact: '좁음',
|
||||
default: '기본',
|
||||
loose: '넓음'
|
||||
},
|
||||
mobileLayout: '모바일 레이아웃',
|
||||
layoutOptions: {
|
||||
default: '기본',
|
||||
ios: 'iOS 스타일',
|
||||
android: '안드로이드 스타일'
|
||||
},
|
||||
mobileCoverStyle: '커버 스타일',
|
||||
coverOptions: {
|
||||
record: '레코드',
|
||||
square: '정사각형',
|
||||
full: '전체화면'
|
||||
},
|
||||
lyricLines: '가사 줄 수',
|
||||
mobileUnavailable: '이 설정은 모바일에서만 사용 가능합니다'
|
||||
},
|
||||
translationEngine: '가사 번역 엔진',
|
||||
translationEngineOptions: {
|
||||
none: '닫기',
|
||||
opencc: 'OpenCC 중국어 번체'
|
||||
},
|
||||
themeColor: {
|
||||
title: '가사 테마 색상',
|
||||
presetColors: '미리 설정된 색상',
|
||||
customColor: '사용자 정의 색상',
|
||||
preview: '미리보기 효과',
|
||||
previewText: '가사 효과',
|
||||
colorNames: {
|
||||
'spotify-green': 'Spotify 그린',
|
||||
'apple-blue': '애플 블루',
|
||||
'youtube-red': 'YouTube 레드',
|
||||
orange: '활력 오렌지',
|
||||
purple: '신비 퍼플',
|
||||
pink: '벚꽃 핑크'
|
||||
},
|
||||
tooltips: {
|
||||
openColorPicker: '색상 선택기 열기',
|
||||
closeColorPicker: '색상 선택기 닫기'
|
||||
},
|
||||
placeholder: '#1db954'
|
||||
},
|
||||
shortcutSettings: {
|
||||
title: '단축키 설정',
|
||||
shortcut: '단축키',
|
||||
shortcutDesc: '단축키 사용자 정의',
|
||||
shortcutConflict: '단축키 충돌',
|
||||
inputPlaceholder: '클릭하여 단축키 입력',
|
||||
resetShortcuts: '기본값 복원',
|
||||
disableAll: '모두 비활성화',
|
||||
enableAll: '모두 활성화',
|
||||
togglePlay: '재생/일시정지',
|
||||
prevPlay: '이전 곡',
|
||||
nextPlay: '다음 곡',
|
||||
volumeUp: '볼륨 증가',
|
||||
volumeDown: '볼륨 감소',
|
||||
toggleFavorite: '즐겨찾기/즐겨찾기 취소',
|
||||
toggleWindow: '창 표시/숨기기',
|
||||
scopeGlobal: '전역',
|
||||
scopeApp: '앱 내',
|
||||
enabled: '활성화',
|
||||
disabled: '비활성화',
|
||||
messages: {
|
||||
resetSuccess: '기본 단축키로 복원되었습니다. 저장을 잊지 마세요',
|
||||
conflict: '충돌하는 단축키가 있습니다. 다시 설정하세요',
|
||||
saveSuccess: '단축키 설정이 저장되었습니다',
|
||||
saveError: '단축키 저장 실패, 다시 시도하세요',
|
||||
cancelEdit: '수정이 취소되었습니다',
|
||||
disableAll: '모든 단축키가 비활성화되었습니다. 저장을 잊지 마세요',
|
||||
enableAll: '모든 단축키가 활성화되었습니다. 저장을 잊지 마세요'
|
||||
}
|
||||
},
|
||||
remoteControl: {
|
||||
title: '원격 제어',
|
||||
enable: '원격 제어 활성화',
|
||||
port: '서비스 포트',
|
||||
allowedIps: '허용된 IP 주소',
|
||||
addIp: 'IP 추가',
|
||||
emptyListHint: '빈 목록은 모든 IP 액세스를 허용함을 의미합니다',
|
||||
saveSuccess: '원격 제어 설정이 저장되었습니다',
|
||||
accessInfo: '원격 제어 액세스 주소:'
|
||||
},
|
||||
cookie: {
|
||||
title: 'Cookie 설정',
|
||||
description: '넷이즈 클라우드 뮤직의 Cookie를 입력하세요:',
|
||||
placeholder: '완전한 Cookie를 붙여넣으세요...',
|
||||
help: {
|
||||
format: 'Cookie는 일반적으로 "MUSIC_U="로 시작합니다',
|
||||
source: '브라우저 개발자 도구의 네트워크 요청에서 얻을 수 있습니다',
|
||||
storage: 'Cookie 설정 후 자동으로 로컬 저장소에 저장됩니다'
|
||||
},
|
||||
action: {
|
||||
save: 'Cookie 저장',
|
||||
paste: '붙여넣기',
|
||||
clear: '지우기'
|
||||
},
|
||||
validation: {
|
||||
required: 'Cookie를 입력하세요',
|
||||
format: 'Cookie 형식이 올바르지 않을 수 있습니다. MUSIC_U가 포함되어 있는지 확인하세요'
|
||||
},
|
||||
message: {
|
||||
saveSuccess: 'Cookie 저장 성공',
|
||||
saveError: 'Cookie 저장 실패',
|
||||
pasteSuccess: '붙여넣기 성공',
|
||||
pasteError: '붙여넣기 실패, 수동으로 복사하세요'
|
||||
},
|
||||
info: {
|
||||
length: '현재 길이: {length} 문자'
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -25,4 +25,4 @@ export default {
|
||||
negativeText: '취소'
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
@@ -10,6 +10,11 @@ export default {
|
||||
trackCount: '{count}곡',
|
||||
playCount: '{count}회 재생'
|
||||
},
|
||||
tabs: {
|
||||
created: '생성',
|
||||
favorite: '즐겨찾기',
|
||||
album: '앨범'
|
||||
},
|
||||
ranking: {
|
||||
title: '음악 청취 순위',
|
||||
playCount: '{count}회'
|
||||
@@ -45,4 +50,4 @@ export default {
|
||||
deleteSuccess: '삭제 성공',
|
||||
deleteFailed: '삭제 실패'
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
51
src/i18n/lang/zh-CN/bilibili.ts
Normal file
51
src/i18n/lang/zh-CN/bilibili.ts
Normal file
@@ -0,0 +1,51 @@
|
||||
export default {
|
||||
player: {
|
||||
loading: '听书加载中...',
|
||||
retry: '重试',
|
||||
playNow: '立即播放',
|
||||
loadingTitle: '加载中...',
|
||||
totalDuration: '总时长: {duration}',
|
||||
partsList: '分P列表 (共{count}集)',
|
||||
playStarted: '已开始播放',
|
||||
switchingPart: '切换到分P: {part}',
|
||||
preloadingNext: '预加载下一个分P: {part}',
|
||||
playingCurrent: '播放当前选中的分P: {name}',
|
||||
num: '万',
|
||||
errors: {
|
||||
invalidVideoId: '视频ID无效',
|
||||
loadVideoDetailFailed: '获取视频详情失败',
|
||||
loadPartInfoFailed: '无法加载视频分P信息',
|
||||
loadAudioUrlFailed: '获取音频播放地址失败',
|
||||
videoDetailNotLoaded: '视频详情未加载',
|
||||
missingParams: '缺少必要参数',
|
||||
noAvailableAudioUrl: '未找到可用的音频地址',
|
||||
loadPartAudioFailed: '加载分P音频URL失败',
|
||||
audioListEmpty: '音频列表为空,请重试',
|
||||
currentPartNotFound: '未找到当前分P的音频',
|
||||
audioUrlFailed: '获取音频URL失败',
|
||||
playFailed: '播放失败,请重试',
|
||||
getAudioUrlFailed: '获取音频地址失败,请重试',
|
||||
audioNotFound: '未找到对应的音频,请重试',
|
||||
preloadFailed: '预加载下一个分P失败',
|
||||
switchPartFailed: '切换分P时加载音频URL失败'
|
||||
},
|
||||
console: {
|
||||
loadingDetail: '加载B站视频详情',
|
||||
detailData: 'B站视频详情数据',
|
||||
multipleParts: '视频有多个分P,共{count}个',
|
||||
noPartsData: '视频无分P或分P数据为空',
|
||||
loadingAudioSource: '加载音频源',
|
||||
generatedAudioList: '已生成音频列表,共{count}首',
|
||||
getDashAudioUrl: '获取到dash音频URL',
|
||||
getDurlAudioUrl: '获取到durl音频URL',
|
||||
loadingPartAudio: '加载分P音频URL: {part}, cid: {cid}',
|
||||
loadPartAudioFailed: '加载分P音频URL失败: {part}',
|
||||
switchToPart: '切换到分P: {part}',
|
||||
audioNotFoundInList: '未找到对应的音频项',
|
||||
preparingToPlay: '准备播放当前选中的分P: {name}',
|
||||
preloadingNextPart: '预加载下一个分P: {part}',
|
||||
playingSelectedPart: '播放当前选中的分P: {name},音频URL: {url}',
|
||||
preloadNextFailed: '预加载下一个分P失败'
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -43,6 +43,8 @@ export default {
|
||||
collapse: '收起',
|
||||
songCount: '{count}首',
|
||||
language: '语言',
|
||||
today: '今天',
|
||||
yesterday: '昨天',
|
||||
tray: {
|
||||
show: '显示',
|
||||
quit: '退出',
|
||||
|
||||
@@ -117,7 +117,11 @@ export default {
|
||||
cancelCollect: '取消收藏',
|
||||
addToPlaylist: '添加到播放列表',
|
||||
addToPlaylistSuccess: '添加到播放列表成功',
|
||||
songsAlreadyInPlaylist: '歌曲已存在于播放列表中'
|
||||
songsAlreadyInPlaylist: '歌曲已存在于播放列表中',
|
||||
historyRecommend: '历史日推',
|
||||
fetchDatesFailed: '获取日期列表失败',
|
||||
fetchSongsFailed: '获取歌曲列表失败',
|
||||
noSongs: '暂无歌曲'
|
||||
},
|
||||
playlist: {
|
||||
import: {
|
||||
|
||||
@@ -1,5 +1,44 @@
|
||||
export default {
|
||||
title: '播放历史',
|
||||
heatmapTitle: '热力图',
|
||||
playCount: '{count}',
|
||||
getHistoryFailed: '获取历史记录失败'
|
||||
getHistoryFailed: '获取历史记录失败',
|
||||
categoryTabs: {
|
||||
songs: '歌曲',
|
||||
playlists: '歌单',
|
||||
albums: '专辑'
|
||||
},
|
||||
tabs: {
|
||||
all: '全部记录',
|
||||
local: '本地记录',
|
||||
cloud: '云端记录'
|
||||
},
|
||||
getCloudRecordFailed: '获取云端记录失败',
|
||||
needLogin: '请使用cookie登录以查看云端记录',
|
||||
merging: '正在合并记录...',
|
||||
noDescription: '暂无描述',
|
||||
noData: '暂无记录',
|
||||
heatmap: {
|
||||
title: '播放热力图',
|
||||
loading: '正在加载数据...',
|
||||
unit: '次播放',
|
||||
footerText: '鼠标悬停查看详细信息',
|
||||
playCount: '播放 {count} 次',
|
||||
topSongs: '当天热门歌曲',
|
||||
times: '次',
|
||||
totalPlays: '总播放次数',
|
||||
activeDays: '活跃天数',
|
||||
noData: '暂无播放记录',
|
||||
colorTheme: '配色方案',
|
||||
colors: {
|
||||
green: '绿色',
|
||||
blue: '蓝色',
|
||||
orange: '橙色',
|
||||
purple: '紫色',
|
||||
red: '红色'
|
||||
},
|
||||
mostPlayedSong: '播放最多的歌曲',
|
||||
mostActiveDay: '最活跃的一天',
|
||||
latestNightSong: '最晚播放的歌曲'
|
||||
}
|
||||
};
|
||||
|
||||
@@ -29,7 +29,8 @@ export default {
|
||||
list: '自动播放下一个'
|
||||
},
|
||||
lrc: {
|
||||
noLrc: '暂无歌词, 请欣赏'
|
||||
noLrc: '暂无歌词, 请欣赏',
|
||||
noAutoScroll: '本歌词不支持自动滚动'
|
||||
},
|
||||
reparse: {
|
||||
title: '选择解析音源',
|
||||
@@ -39,7 +40,9 @@ export default {
|
||||
warning: '请选择一个音源',
|
||||
bilibiliNotSupported: 'B站视频不支持重新解析',
|
||||
processing: '解析中...',
|
||||
clear: '清除自定义音源'
|
||||
clear: '清除自定义音源',
|
||||
customApiFailed: '自定义API解析失败,正在尝试使用内置音源...',
|
||||
customApiError: '自定义API请求出错,正在尝试使用内置音源...'
|
||||
},
|
||||
playBar: {
|
||||
expand: '展开歌词',
|
||||
@@ -64,7 +67,17 @@ export default {
|
||||
unFavorite: '已取消收藏{name}',
|
||||
miniPlayBar: '迷你播放栏',
|
||||
playbackSpeed: '播放速度',
|
||||
advancedControls: '更多设置s'
|
||||
advancedControls: '更多设置',
|
||||
intelligenceMode: {
|
||||
title: '心动模式',
|
||||
needCookieLogin: '请使用 Cookie 方式登录后使用心动模式',
|
||||
noFavoritePlaylist: '未找到我喜欢的音乐歌单',
|
||||
noLikedSongs: '您还没有喜欢的歌曲',
|
||||
loading: '正在加载心动模式',
|
||||
success: '已加载 {count} 首歌曲',
|
||||
failed: '获取心动模式列表失败',
|
||||
error: '心动模式播放出错'
|
||||
}
|
||||
},
|
||||
eq: {
|
||||
title: '均衡器',
|
||||
|
||||
@@ -50,7 +50,14 @@ export default {
|
||||
englishText: 'The quick brown fox jumps over the lazy dog',
|
||||
japaneseText: 'あいうえお かきくけこ さしすせそ',
|
||||
koreanText: '가나다라마 바사아자차 카타파하'
|
||||
}
|
||||
},
|
||||
gpuAcceleration: 'GPU加速',
|
||||
gpuAccelerationDesc: '启用或禁用硬件加速,可以提高渲染性能但可能会增加GPU负载',
|
||||
gpuAccelerationRestart: '更改GPU加速设置需要重启应用后生效',
|
||||
gpuAccelerationChangeSuccess: 'GPU加速设置已更新,重启应用后生效',
|
||||
gpuAccelerationChangeError: 'GPU加速设置更新失败',
|
||||
tabletMode: '平板模式',
|
||||
tabletModeDesc: '启用后将在移动设备上使用PC样式界面,适合平板等大屏设备'
|
||||
},
|
||||
playback: {
|
||||
quality: '音质设置',
|
||||
@@ -78,7 +85,34 @@ export default {
|
||||
autoPlay: '自动播放',
|
||||
autoPlayDesc: '重新打开应用时是否自动继续播放',
|
||||
showStatusBar: '是否显示状态栏控制功能',
|
||||
showStatusBarContent: '可以在您的mac状态栏显示音乐控制功能(重启后生效)'
|
||||
showStatusBarContent: '可以在您的mac状态栏显示音乐控制功能(重启后生效)',
|
||||
|
||||
fallbackParser: 'GD音乐台(music.gdstudio.xyz)设置',
|
||||
fallbackParserDesc:
|
||||
'GD音乐台将自动尝试多个音乐平台进行解析,无需额外配置。优先级高于其他解析方式,但是请求可能较慢。感谢(music.gdstudio.xyz)\n',
|
||||
parserGD: 'GD 音乐台 (内置)',
|
||||
parserCustom: '自定义 API',
|
||||
|
||||
// 音源标签
|
||||
sourceLabels: {
|
||||
migu: '咪咕音乐',
|
||||
kugou: '酷狗音乐',
|
||||
pyncmd: '网易云(内置)',
|
||||
bilibili: 'Bilibili',
|
||||
gdmusic: 'GD音乐台',
|
||||
custom: '自定义 API'
|
||||
},
|
||||
|
||||
// 自定义API相关的提示
|
||||
customApi: {
|
||||
sectionTitle: '自定义 API 设置',
|
||||
importConfig: '导入 JSON 配置',
|
||||
currentSource: '当前音源',
|
||||
notImported: '尚未导入自定义音源。',
|
||||
importSuccess: '成功导入音源: {name}',
|
||||
importFailed: '导入失败: {message}',
|
||||
enableHint: '请先导入 JSON 配置文件才能启用'
|
||||
}
|
||||
},
|
||||
application: {
|
||||
closeAction: '关闭行为',
|
||||
@@ -231,6 +265,11 @@ export default {
|
||||
lyricLines: '歌词行数',
|
||||
mobileUnavailable: '此设置仅在移动端可用'
|
||||
},
|
||||
translationEngine: '歌詞翻譯引擎',
|
||||
translationEngineOptions: {
|
||||
none: '关闭',
|
||||
opencc: 'OpenCC 繁化'
|
||||
},
|
||||
themeColor: {
|
||||
title: '歌词主题色',
|
||||
presetColors: '预设颜色',
|
||||
|
||||
@@ -10,6 +10,11 @@ export default {
|
||||
trackCount: '{count}首',
|
||||
playCount: '播放{count}次'
|
||||
},
|
||||
tabs: {
|
||||
created: '创建',
|
||||
favorite: '收藏',
|
||||
album: '专辑'
|
||||
},
|
||||
ranking: {
|
||||
title: '听歌排行',
|
||||
playCount: '{count}次'
|
||||
|
||||
51
src/i18n/lang/zh-Hant/bilibili.ts
Normal file
51
src/i18n/lang/zh-Hant/bilibili.ts
Normal file
@@ -0,0 +1,51 @@
|
||||
export default {
|
||||
player: {
|
||||
loading: '聽書載入中...',
|
||||
retry: '重試',
|
||||
playNow: '立即播放',
|
||||
loadingTitle: '載入中...',
|
||||
totalDuration: '總時長: {duration}',
|
||||
partsList: '分P列表 (共{count}集)',
|
||||
playStarted: '已開始播放',
|
||||
switchingPart: '切換到分P: {part}',
|
||||
preloadingNext: '預載入下一個分P: {part}',
|
||||
playingCurrent: '播放當前選中的分P: {name}',
|
||||
num: '萬',
|
||||
errors: {
|
||||
invalidVideoId: '影片ID無效',
|
||||
loadVideoDetailFailed: '獲取影片詳情失敗',
|
||||
loadPartInfoFailed: '無法載入影片分P資訊',
|
||||
loadAudioUrlFailed: '獲取音訊播放地址失敗',
|
||||
videoDetailNotLoaded: '影片詳情未載入',
|
||||
missingParams: '缺少必要參數',
|
||||
noAvailableAudioUrl: '未找到可用的音訊地址',
|
||||
loadPartAudioFailed: '載入分P音訊URL失敗',
|
||||
audioListEmpty: '音訊列表為空,請重試',
|
||||
currentPartNotFound: '未找到當前分P的音訊',
|
||||
audioUrlFailed: '獲取音訊URL失敗',
|
||||
playFailed: '播放失敗,請重試',
|
||||
getAudioUrlFailed: '獲取音訊地址失敗,請重試',
|
||||
audioNotFound: '未找到對應的音訊,請重試',
|
||||
preloadFailed: '預載入下一個分P失敗',
|
||||
switchPartFailed: '切換分P時載入音訊URL失敗'
|
||||
},
|
||||
console: {
|
||||
loadingDetail: '載入B站影片詳情',
|
||||
detailData: 'B站影片詳情資料',
|
||||
multipleParts: '影片有多個分P,共{count}個',
|
||||
noPartsData: '影片無分P或分P資料為空',
|
||||
loadingAudioSource: '載入音訊來源',
|
||||
generatedAudioList: '已生成音訊列表,共{count}首',
|
||||
getDashAudioUrl: '獲取到dash音訊URL',
|
||||
getDurlAudioUrl: '獲取到durl音訊URL',
|
||||
loadingPartAudio: '載入分P音訊URL: {part}, cid: {cid}',
|
||||
loadPartAudioFailed: '載入分P音訊URL失敗: {part}',
|
||||
switchToPart: '切換到分P: {part}',
|
||||
audioNotFoundInList: '未找到對應的音訊項目',
|
||||
preparingToPlay: '準備播放當前選中的分P: {name}',
|
||||
preloadingNextPart: '預載入下一個分P: {part}',
|
||||
playingSelectedPart: '播放當前選中的分P: {name},音訊URL: {url}',
|
||||
preloadNextFailed: '預載入下一個分P失敗'
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -1,5 +1,44 @@
|
||||
export default {
|
||||
title: '播放歷史',
|
||||
heatmapTitle: '熱力圖',
|
||||
playCount: '{count}',
|
||||
getHistoryFailed: '取得歷史記錄失敗'
|
||||
getHistoryFailed: '取得歷史記錄失敗',
|
||||
categoryTabs: {
|
||||
songs: '歌曲',
|
||||
playlists: '歌單',
|
||||
albums: '專輯'
|
||||
},
|
||||
tabs: {
|
||||
all: '全部記錄',
|
||||
local: '本地記錄',
|
||||
cloud: '雲端記錄'
|
||||
},
|
||||
getCloudRecordFailed: '取得雲端記錄失敗',
|
||||
needLogin: '請使用cookie登入以查看雲端記錄',
|
||||
merging: '正在合併記錄...',
|
||||
noDescription: '暫無描述',
|
||||
noData: '暫無記錄',
|
||||
heatmap: {
|
||||
title: '播放熱力圖',
|
||||
loading: '正在載入數據...',
|
||||
unit: '次播放',
|
||||
footerText: '滑鼠懸停查看詳細信息',
|
||||
playCount: '播放 {count} 次',
|
||||
topSongs: '當天熱門歌曲',
|
||||
times: '次',
|
||||
totalPlays: '總播放次數',
|
||||
activeDays: '活躍天數',
|
||||
noData: '暫無播放記錄',
|
||||
colorTheme: '配色方案',
|
||||
colors: {
|
||||
green: '綠色',
|
||||
blue: '藍色',
|
||||
orange: '橙色',
|
||||
purple: '紫色',
|
||||
red: '紅色'
|
||||
},
|
||||
mostPlayedSong: '播放最多的歌曲',
|
||||
mostActiveDay: '最活躍的一天',
|
||||
latestNightSong: '最晚播放的歌曲'
|
||||
}
|
||||
};
|
||||
|
||||
@@ -29,7 +29,8 @@ export default {
|
||||
list: '自動播放下一個'
|
||||
},
|
||||
lrc: {
|
||||
noLrc: '暫無歌詞, 請欣賞'
|
||||
noLrc: '暫無歌詞, 請欣賞',
|
||||
noAutoScroll: '本歌詞不支持自動滾動'
|
||||
},
|
||||
reparse: {
|
||||
title: '選擇解析音源',
|
||||
@@ -39,7 +40,9 @@ export default {
|
||||
warning: '請選擇一個音源',
|
||||
bilibiliNotSupported: 'B站影片不支援重新解析',
|
||||
processing: '解析中...',
|
||||
clear: '清除自訂音源'
|
||||
clear: '清除自訂音源',
|
||||
customApiFailed: '自定義API解析失敗,正在嘗試使用內置音源...',
|
||||
customApiError: '自定義API請求出錯,正在嘗試使用內置音源...'
|
||||
},
|
||||
playBar: {
|
||||
expand: '展開歌詞',
|
||||
@@ -64,7 +67,17 @@ export default {
|
||||
unFavorite: '已取消收藏{name}',
|
||||
miniPlayBar: '迷你播放列',
|
||||
playbackSpeed: '播放速度',
|
||||
advancedControls: '更多設定s'
|
||||
advancedControls: '更多設定',
|
||||
intelligenceMode: {
|
||||
title: '心動模式',
|
||||
needCookieLogin: '請使用 Cookie 方式登入後使用心動模式',
|
||||
noFavoritePlaylist: '未找到我喜歡的音樂歌單',
|
||||
noLikedSongs: '您還沒有喜歡的歌曲',
|
||||
loading: '正在載入心動模式',
|
||||
success: '已載入 {count} 首歌曲',
|
||||
failed: '取得心動模式清單失敗',
|
||||
error: '心動模式播放出錯'
|
||||
}
|
||||
},
|
||||
eq: {
|
||||
title: '等化器',
|
||||
|
||||
@@ -50,7 +50,14 @@ export default {
|
||||
englishText: 'The quick brown fox jumps over the lazy dog',
|
||||
japaneseText: 'あいうえお かきくけこ さしすせそ',
|
||||
koreanText: '가나다라마 바사아자차 카타파하'
|
||||
}
|
||||
},
|
||||
gpuAcceleration: 'GPU加速',
|
||||
gpuAccelerationDesc: '啟用或禁用硬體加速,可以提高渲染性能,但可能會增加GPU負載',
|
||||
gpuAccelerationRestart: '更改GPU加速設定需要重啟應用後生效',
|
||||
gpuAccelerationChangeSuccess: 'GPU加速設定已更新,重啟應用後生效',
|
||||
gpuAccelerationChangeError: 'GPU加速設定更新失敗',
|
||||
tabletMode: '平板模式',
|
||||
tabletModeDesc: '啟用後將在移動設備上使用PC樣式界面,適合平板等大屏設備'
|
||||
},
|
||||
playback: {
|
||||
quality: '音質設定',
|
||||
@@ -78,7 +85,31 @@ export default {
|
||||
autoPlay: '自動播放',
|
||||
autoPlayDesc: '重新開啟應用程式時是否自動繼續播放',
|
||||
showStatusBar: '是否顯示狀態列控制功能',
|
||||
showStatusBarContent: '可以在您的mac狀態列顯示音樂控制功能(重啟後生效)'
|
||||
showStatusBarContent: '可以在您的mac狀態列顯示音樂控制功能(重啟後生效)',
|
||||
fallbackParser: '備用解析服務 (GD音樂台)',
|
||||
fallbackParserDesc: '當勾選「GD音樂台」且常規音源無法播放時,將使用此服務嘗試解析。',
|
||||
parserGD: 'GD 音樂台 (內建)',
|
||||
parserCustom: '自訂 API',
|
||||
|
||||
// 音源標籤
|
||||
sourceLabels: {
|
||||
migu: '咪咕音樂',
|
||||
kugou: '酷狗音樂',
|
||||
pyncmd: '網易雲(內建)',
|
||||
bilibili: 'Bilibili',
|
||||
gdmusic: 'GD音樂台',
|
||||
custom: '自訂 API'
|
||||
},
|
||||
|
||||
customApi: {
|
||||
sectionTitle: '自訂 API 設定',
|
||||
importConfig: '匯入 JSON 設定',
|
||||
currentSource: '目前音源',
|
||||
notImported: '尚未匯入自訂音源。',
|
||||
importSuccess: '成功匯入音源:{name}',
|
||||
importFailed: '匯入失敗:{message}',
|
||||
enableHint: '請先匯入 JSON 設定檔才能啟用'
|
||||
}
|
||||
},
|
||||
application: {
|
||||
closeAction: '關閉行為',
|
||||
@@ -231,6 +262,11 @@ export default {
|
||||
},
|
||||
placeholder: '#1db954'
|
||||
},
|
||||
translationEngine: '歌詞翻譯引擎',
|
||||
translationEngineOptions: {
|
||||
none: '關閉',
|
||||
opencc: 'OpenCC 繁化'
|
||||
},
|
||||
cookie: {
|
||||
title: 'Cookie設定',
|
||||
description: '請輸入網易雲音樂的Cookie:',
|
||||
|
||||
@@ -10,6 +10,11 @@ export default {
|
||||
trackCount: '{count}首',
|
||||
playCount: '播放{count}次'
|
||||
},
|
||||
tabs: {
|
||||
created: '建立',
|
||||
favorite: '收藏',
|
||||
album: '專輯'
|
||||
},
|
||||
ranking: {
|
||||
title: '聽歌排行',
|
||||
playCount: '{count}次'
|
||||
|
||||
@@ -9,6 +9,7 @@ import { initializeConfig } from './modules/config';
|
||||
import { initializeFileManager } from './modules/fileManager';
|
||||
import { initializeFonts } from './modules/fonts';
|
||||
import { initializeLoginWindow } from './modules/loginWindow';
|
||||
import { initializeOtherApi } from './modules/otherApi';
|
||||
import { initializeRemoteControl } from './modules/remoteControl';
|
||||
import { initializeShortcuts, registerShortcuts } from './modules/shortcuts';
|
||||
import { initializeTray, updateCurrentSong, updatePlayState, updateTrayMenu } from './modules/tray';
|
||||
@@ -26,9 +27,9 @@ const icon = nativeImage.createFromPath(
|
||||
let mainWindow: Electron.BrowserWindow;
|
||||
|
||||
// 初始化应用
|
||||
function initialize() {
|
||||
// 初始化配置管理
|
||||
const store = initializeConfig();
|
||||
function initialize(configStore: any) {
|
||||
// 使用已初始化的配置存储
|
||||
const store = configStore;
|
||||
|
||||
// 设置初始语言
|
||||
const savedLanguage = store.get('set.language') as Language;
|
||||
@@ -38,6 +39,8 @@ function initialize() {
|
||||
|
||||
// 初始化文件管理
|
||||
initializeFileManager();
|
||||
// 初始化其他 API (搜索建议等)
|
||||
initializeOtherApi();
|
||||
// 初始化窗口管理
|
||||
initializeWindowManager();
|
||||
// 初始化字体管理
|
||||
@@ -73,6 +76,23 @@ const isSingleInstance = app.requestSingleInstanceLock();
|
||||
if (!isSingleInstance) {
|
||||
app.quit();
|
||||
} else {
|
||||
// 在应用准备就绪前初始化GPU加速设置
|
||||
// 必须在 app.ready 之前调用 disableHardwareAcceleration
|
||||
try {
|
||||
// 初始化配置管理以获取GPU加速设置
|
||||
const store = initializeConfig();
|
||||
const enableGpuAcceleration = store.get('set.enableGpuAcceleration', true) as boolean;
|
||||
|
||||
if (!enableGpuAcceleration) {
|
||||
console.log('GPU加速已禁用');
|
||||
app.disableHardwareAcceleration();
|
||||
} else {
|
||||
console.log('GPU加速已启用');
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('GPU加速设置初始化失败:', error);
|
||||
// 如果配置读取失败,默认启用GPU加速
|
||||
}
|
||||
// 当第二个实例启动时,将焦点转移到第一个实例的窗口
|
||||
app.on('second-instance', () => {
|
||||
if (mainWindow) {
|
||||
@@ -97,12 +117,15 @@ if (!isSingleInstance) {
|
||||
// 初始化窗口大小管理器
|
||||
initWindowSizeManager();
|
||||
|
||||
// 重新初始化配置管理以获取完整的配置存储
|
||||
const store = initializeConfig();
|
||||
|
||||
// 初始化应用
|
||||
initialize();
|
||||
initialize(store);
|
||||
|
||||
// macOS 激活应用时的处理
|
||||
app.on('activate', () => {
|
||||
if (mainWindow === null) initialize();
|
||||
if (mainWindow === null) initialize(store);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -218,9 +218,6 @@ export const loadLyricWindow = (ipcMain: IpcMain, mainWin: BrowserWindow): void
|
||||
// 记录原始窗口大小
|
||||
const [width, height] = lyricWindow.getSize();
|
||||
originalSize = { width, height };
|
||||
|
||||
// 在拖动时暂时禁用大小调整
|
||||
lyricWindow.setResizable(false);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -230,9 +227,6 @@ export const loadLyricWindow = (ipcMain: IpcMain, mainWin: BrowserWindow): void
|
||||
if (lyricWindow && !lyricWindow.isDestroyed()) {
|
||||
// 确保窗口大小恢复原样
|
||||
lyricWindow.setSize(originalSize.width, originalSize.height);
|
||||
|
||||
// 拖动结束后恢复可调整大小
|
||||
lyricWindow.setResizable(true);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -25,6 +25,7 @@ type SetConfig = {
|
||||
fontScope: 'global' | 'lyric';
|
||||
language: string;
|
||||
showTopAction: boolean;
|
||||
enableGpuAcceleration: boolean;
|
||||
};
|
||||
interface StoreType {
|
||||
set: SetConfig;
|
||||
@@ -57,6 +58,23 @@ export function initializeConfig() {
|
||||
_.returnValue = value || '';
|
||||
});
|
||||
|
||||
// GPU加速设置更新处理
|
||||
// 注意:GPU加速设置必须在应用启动时在app.ready之前设置才能生效
|
||||
ipcMain.on('update-gpu-acceleration', (event, enabled: boolean) => {
|
||||
try {
|
||||
console.log('GPU加速设置更新:', enabled);
|
||||
store.set('set.enableGpuAcceleration', enabled);
|
||||
|
||||
// GPU加速设置需要重启应用才能生效
|
||||
event.sender.send('gpu-acceleration-updated', enabled);
|
||||
console.log('GPU加速设置已保存,重启应用后生效');
|
||||
} catch (error) {
|
||||
console.error('GPU加速设置更新失败:', error);
|
||||
const errorMessage = error instanceof Error ? error.message : String(error);
|
||||
event.sender.send('gpu-acceleration-update-error', errorMessage);
|
||||
}
|
||||
});
|
||||
|
||||
return store;
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ import axios from 'axios';
|
||||
import { app, dialog, ipcMain, Notification, protocol, shell } from 'electron';
|
||||
import Store from 'electron-store';
|
||||
import { fileTypeFromFile } from 'file-type';
|
||||
import { FlacTagMap, writeFlacTags } from 'flac-tagger';
|
||||
import * as fs from 'fs';
|
||||
import * as http from 'http';
|
||||
import * as https from 'https';
|
||||
@@ -9,6 +10,7 @@ import * as mm from 'music-metadata';
|
||||
import * as NodeID3 from 'node-id3';
|
||||
import * as os from 'os';
|
||||
import * as path from 'path';
|
||||
import sharp from 'sharp';
|
||||
|
||||
import { getStore } from './config';
|
||||
|
||||
@@ -275,6 +277,39 @@ export function initializeFileManager() {
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// 处理导入自定义API插件的请求
|
||||
ipcMain.handle('import-custom-api-plugin', async () => {
|
||||
const result = await dialog.showOpenDialog({
|
||||
title: '选择自定义音源配置文件',
|
||||
filters: [{ name: 'JSON Files', extensions: ['json'] }],
|
||||
properties: ['openFile']
|
||||
});
|
||||
|
||||
if (result.canceled || result.filePaths.length === 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const filePath = result.filePaths[0];
|
||||
try {
|
||||
const fileContent = fs.readFileSync(filePath, 'utf-8');
|
||||
|
||||
// 基础验证,确保它是个合法的JSON并且包含关键字段
|
||||
const pluginData = JSON.parse(fileContent);
|
||||
if (!pluginData.name || !pluginData.apiUrl) {
|
||||
throw new Error('无效的插件文件,缺少 name 或 apiUrl 字段。');
|
||||
}
|
||||
|
||||
return {
|
||||
name: pluginData.name,
|
||||
content: fileContent // 返回完整的JSON字符串
|
||||
};
|
||||
} catch (error: any) {
|
||||
console.error('读取或解析插件文件失败:', error);
|
||||
// 向渲染进程抛出错误,以便UI可以显示提示
|
||||
throw new Error(`文件读取或解析失败: ${error.message}`);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -386,7 +421,7 @@ async function downloadMusic(
|
||||
let formattedFilename = filename;
|
||||
if (songInfo) {
|
||||
// 准备替换变量
|
||||
const artistName = songInfo.ar?.map((a: any) => a.name).join('/') || '未知艺术家';
|
||||
const artistName = songInfo.ar?.map((a: any) => a.name).join('、') || '未知艺术家';
|
||||
const songName = songInfo.name || filename;
|
||||
const albumName = songInfo.al?.name || '未知专辑';
|
||||
|
||||
@@ -576,8 +611,38 @@ async function downloadMusic(
|
||||
timeout: 10000
|
||||
});
|
||||
|
||||
// 获取封面图片的buffer
|
||||
coverImageBuffer = Buffer.from(coverResponse.data);
|
||||
const originalCoverBuffer = Buffer.from(coverResponse.data);
|
||||
const TWO_MB = 2 * 1024 * 1024;
|
||||
// 检查图片大小是否超过2MB
|
||||
if (originalCoverBuffer.length > TWO_MB) {
|
||||
const originalSizeMB = (originalCoverBuffer.length / (1024 * 1024)).toFixed(2);
|
||||
console.log(`封面图大于2MB (${originalSizeMB} MB),开始压缩...`);
|
||||
try {
|
||||
// 使用 sharp 进行压缩
|
||||
coverImageBuffer = await sharp(originalCoverBuffer)
|
||||
.resize({
|
||||
width: 1600,
|
||||
height: 1600,
|
||||
fit: 'inside',
|
||||
withoutEnlargement: true
|
||||
})
|
||||
.jpeg({
|
||||
quality: 80,
|
||||
mozjpeg: true
|
||||
})
|
||||
.toBuffer();
|
||||
|
||||
const compressedSizeMB = (coverImageBuffer.length / (1024 * 1024)).toFixed(2);
|
||||
console.log(`封面图压缩完成,新大小: ${compressedSizeMB} MB`);
|
||||
} catch (compressionError) {
|
||||
console.error('封面图压缩失败,将使用原图:', compressionError);
|
||||
coverImageBuffer = originalCoverBuffer; // 如果压缩失败,则回退使用原始图片
|
||||
}
|
||||
} else {
|
||||
// 如果图片不大于2MB,直接使用原图
|
||||
coverImageBuffer = originalCoverBuffer;
|
||||
}
|
||||
|
||||
console.log('封面已准备好,将写入元数据');
|
||||
}
|
||||
}
|
||||
@@ -588,7 +653,7 @@ async function downloadMusic(
|
||||
|
||||
const fileFormat = fileExtension.toLowerCase();
|
||||
const artistNames =
|
||||
(songInfo?.ar || songInfo?.song?.artists)?.map((a: any) => a.name).join('/ ') || '未知艺术家';
|
||||
(songInfo?.ar || songInfo?.song?.artists)?.map((a: any) => a.name).join('、') || '未知艺术家';
|
||||
|
||||
// 根据文件类型处理元数据
|
||||
if (['.mp3'].includes(fileFormat)) {
|
||||
@@ -598,7 +663,7 @@ async function downloadMusic(
|
||||
NodeID3.removeTags(finalFilePath);
|
||||
|
||||
const tags = {
|
||||
title: filename,
|
||||
title: songInfo?.name,
|
||||
artist: artistNames,
|
||||
TPE1: artistNames,
|
||||
TPE2: artistNames,
|
||||
@@ -634,10 +699,35 @@ async function downloadMusic(
|
||||
} catch (err) {
|
||||
console.error('Error writing ID3 tags:', err);
|
||||
}
|
||||
} else {
|
||||
// 对于非MP3文件,使用music-metadata来写入元数据可能需要专门的库
|
||||
// 或者根据不同文件类型使用专用工具,暂时只记录但不处理
|
||||
console.log(`文件类型 ${fileFormat} 不支持使用NodeID3写入标签,跳过元数据写入`);
|
||||
} else if (['.flac'].includes(fileFormat)) {
|
||||
try {
|
||||
const tagMap: FlacTagMap = {
|
||||
TITLE: songInfo?.name,
|
||||
ARTIST: artistNames,
|
||||
ALBUM: songInfo?.al?.name || songInfo?.song?.album?.name || songInfo?.name || filename,
|
||||
LYRICS: lyricsContent || '',
|
||||
TRACKNUMBER: songInfo?.no ? String(songInfo.no) : undefined,
|
||||
DATE: songInfo?.publishTime
|
||||
? new Date(songInfo.publishTime).getFullYear().toString()
|
||||
: undefined
|
||||
};
|
||||
|
||||
await writeFlacTags(
|
||||
{
|
||||
tagMap,
|
||||
picture: coverImageBuffer
|
||||
? {
|
||||
buffer: coverImageBuffer,
|
||||
mime: 'image/jpeg'
|
||||
}
|
||||
: undefined
|
||||
},
|
||||
finalFilePath
|
||||
);
|
||||
console.log('FLAC tags written successfully');
|
||||
} catch (err) {
|
||||
console.error('Error writing FLAC tags:', err);
|
||||
}
|
||||
}
|
||||
|
||||
// 保存下载信息
|
||||
@@ -683,7 +773,7 @@ async function downloadMusic(
|
||||
// 发送桌面通知
|
||||
try {
|
||||
const artistNames =
|
||||
(songInfo?.ar || songInfo?.song?.artists)?.map((a: any) => a.name).join('/') ||
|
||||
(songInfo?.ar || songInfo?.song?.artists)?.map((a: any) => a.name).join('、') ||
|
||||
'未知艺术家';
|
||||
const notification = new Notification({
|
||||
title: '下载完成',
|
||||
|
||||
28
src/main/modules/otherApi.ts
Normal file
28
src/main/modules/otherApi.ts
Normal file
@@ -0,0 +1,28 @@
|
||||
import axios from 'axios';
|
||||
import { ipcMain } from 'electron';
|
||||
|
||||
/**
|
||||
* 初始化其他杂项 API(如搜索建议等)
|
||||
*/
|
||||
export function initializeOtherApi() {
|
||||
// 搜索建议(从酷狗获取)
|
||||
ipcMain.handle('get-search-suggestions', async (_, keyword: string) => {
|
||||
if (!keyword || !keyword.trim()) {
|
||||
return [];
|
||||
}
|
||||
try {
|
||||
console.log(`[Main Process Proxy] Forwarding suggestion request for: ${keyword}`);
|
||||
const response = await axios.get('http://msearchcdn.kugou.com/new/app/i/search.php', {
|
||||
params: {
|
||||
cmd: 302,
|
||||
keyword: keyword
|
||||
},
|
||||
timeout: 5000
|
||||
});
|
||||
return response.data;
|
||||
} catch (error: any) {
|
||||
console.error('[Main Process Proxy] Failed to fetch search suggestions:', error.message);
|
||||
return [];
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -59,6 +59,13 @@ function getSongTitle(song: SongInfo | null): string {
|
||||
return artistStr ? `${song.name} - ${artistStr}` : song.name;
|
||||
}
|
||||
|
||||
// 截断歌曲标题,防止菜单中显示过长
|
||||
function getTruncatedSongTitle(song: SongInfo | null, maxLength: number = 14): string {
|
||||
const fullTitle = getSongTitle(song);
|
||||
if (fullTitle.length <= maxLength) return fullTitle;
|
||||
return fullTitle.slice(0, maxLength) + '...';
|
||||
}
|
||||
|
||||
// 更新当前播放的音乐信息
|
||||
export function updateCurrentSong(song: SongInfo | null) {
|
||||
currentSong = song;
|
||||
@@ -143,7 +150,7 @@ export function updateTrayMenu(mainWindow: BrowserWindow) {
|
||||
if (currentSong) {
|
||||
menu.append(
|
||||
new MenuItem({
|
||||
label: getSongTitle(currentSong),
|
||||
label: getTruncatedSongTitle(currentSong),
|
||||
enabled: false,
|
||||
type: 'normal'
|
||||
})
|
||||
@@ -250,7 +257,7 @@ export function updateTrayMenu(mainWindow: BrowserWindow) {
|
||||
...((currentSong
|
||||
? [
|
||||
{
|
||||
label: getSongTitle(currentSong),
|
||||
label: getTruncatedSongTitle(currentSong),
|
||||
enabled: false,
|
||||
type: 'normal'
|
||||
},
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
"musicApiPort": 30488,
|
||||
"closeAction": "ask",
|
||||
"musicQuality": "higher",
|
||||
"lyricTranslationEngine": "none",
|
||||
"fontFamily": "system-ui",
|
||||
"fontScope": "global",
|
||||
"autoPlay": false,
|
||||
@@ -27,5 +28,9 @@
|
||||
"showTopAction": false,
|
||||
"contentZoomFactor": 1,
|
||||
"autoTheme": false,
|
||||
"manualTheme": "light"
|
||||
"manualTheme": "light",
|
||||
"isMenuExpanded": false,
|
||||
"customApiPlugin": "",
|
||||
"customApiPluginName": "",
|
||||
"enableGpuAcceleration": true
|
||||
}
|
||||
|
||||
2
src/preload/index.d.ts
vendored
2
src/preload/index.d.ts
vendored
@@ -21,7 +21,9 @@ interface API {
|
||||
onDownloadComplete: (callback: (success: boolean, filePath: string) => void) => void;
|
||||
onLanguageChanged: (callback: (locale: string) => void) => void;
|
||||
removeDownloadListeners: () => void;
|
||||
importCustomApiPlugin: () => Promise<{ name: string; content: string } | null>;
|
||||
invoke: (channel: string, ...args: any[]) => Promise<any>;
|
||||
getSearchSuggestions: (keyword: string) => Promise<any>;
|
||||
}
|
||||
|
||||
// 自定义IPC渲染进程通信接口
|
||||
|
||||
@@ -18,6 +18,7 @@ const api = {
|
||||
sendSong: (data) => ipcRenderer.send('update-current-song', data),
|
||||
unblockMusic: (id, data, enabledSources) =>
|
||||
ipcRenderer.invoke('unblock-music', id, data, enabledSources),
|
||||
importCustomApiPlugin: () => ipcRenderer.invoke('import-custom-api-plugin'),
|
||||
// 歌词窗口关闭事件
|
||||
onLyricWindowClosed: (callback: () => void) => {
|
||||
ipcRenderer.on('lyric-window-closed', () => callback());
|
||||
@@ -54,7 +55,9 @@ const api = {
|
||||
return ipcRenderer.invoke(channel, ...args);
|
||||
}
|
||||
return Promise.reject(new Error(`未授权的 IPC 通道: ${channel}`));
|
||||
}
|
||||
},
|
||||
// 搜索建议
|
||||
getSearchSuggestions: (keyword: string) => ipcRenderer.invoke('get-search-suggestions', keyword)
|
||||
};
|
||||
|
||||
// 创建带类型的ipcRenderer对象,暴露给渲染进程
|
||||
|
||||
@@ -19,11 +19,11 @@ import { useI18n } from 'vue-i18n';
|
||||
import { useRouter } from 'vue-router';
|
||||
|
||||
import TrafficWarningDrawer from '@/components/TrafficWarningDrawer.vue';
|
||||
import homeRouter from '@/router/home';
|
||||
import { useMenuStore } from '@/store/modules/menu';
|
||||
import { usePlayerStore } from '@/store/modules/player';
|
||||
import { useSettingsStore } from '@/store/modules/settings';
|
||||
import { useUserStore } from '@/store/modules/user';
|
||||
import { isElectron, isLyricWindow } from '@/utils';
|
||||
import { checkLoginStatus } from '@/utils/auth';
|
||||
|
||||
import { initAudioListeners, initMusicHook } from './hooks/MusicHook';
|
||||
import { audioService } from './services/audioService';
|
||||
@@ -32,8 +32,8 @@ import { useAppShortcuts } from './utils/appShortcuts';
|
||||
|
||||
const { locale } = useI18n();
|
||||
const settingsStore = useSettingsStore();
|
||||
const menuStore = useMenuStore();
|
||||
const playerStore = usePlayerStore();
|
||||
const userStore = useUserStore();
|
||||
const router = useRouter();
|
||||
|
||||
// 监听语言变化
|
||||
@@ -75,8 +75,16 @@ if (!isLyricWindow.value) {
|
||||
settingsStore.initializeSettings();
|
||||
settingsStore.initializeTheme();
|
||||
settingsStore.initializeSystemFonts();
|
||||
if (isMobile.value) {
|
||||
menuStore.setMenus(homeRouter.filter((item) => item.meta.isMobile));
|
||||
|
||||
// 初始化登录状态 - 从 localStorage 恢复用户信息和登录类型
|
||||
const loginInfo = checkLoginStatus();
|
||||
if (loginInfo.isLoggedIn) {
|
||||
if (loginInfo.user && !userStore.user) {
|
||||
userStore.setUser(loginInfo.user);
|
||||
}
|
||||
if (loginInfo.loginType && !userStore.loginType) {
|
||||
userStore.setLoginType(loginInfo.loginType);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import type { IBilibiliPlayUrl, IBilibiliVideoDetail } from '@/types/bilibili';
|
||||
import type { IBilibiliPage, IBilibiliPlayUrl, IBilibiliVideoDetail } from '@/types/bilibili';
|
||||
import type { SongResult } from '@/types/music';
|
||||
import { getSetData, isElectron } from '@/utils';
|
||||
import request from '@/utils/request';
|
||||
|
||||
@@ -10,14 +11,50 @@ interface ISearchParams {
|
||||
}
|
||||
|
||||
/**
|
||||
* 搜索B站视频
|
||||
* 搜索B站视频(带自动重试)
|
||||
* 最多重试10次,每次间隔100ms
|
||||
* @param params 搜索参数
|
||||
*/
|
||||
export const searchBilibili = (params: ISearchParams) => {
|
||||
export const searchBilibili = async (params: ISearchParams): Promise<any> => {
|
||||
console.log('调用B站搜索API,参数:', params);
|
||||
return request.get('/bilibili/search', {
|
||||
params
|
||||
});
|
||||
const maxRetries = 10;
|
||||
const delayMs = 100;
|
||||
const delay = (ms: number) => new Promise((res) => setTimeout(res, ms));
|
||||
|
||||
let lastError: unknown = null;
|
||||
for (let attempt = 1; attempt <= maxRetries; attempt++) {
|
||||
try {
|
||||
const response = await request.get('/bilibili/search', { params });
|
||||
console.log('B站搜索API响应:', response);
|
||||
const hasTitle = Boolean(response?.data?.data?.result?.length);
|
||||
if (response?.status === 200 && hasTitle) {
|
||||
return response;
|
||||
}
|
||||
|
||||
lastError = new Error(
|
||||
`搜索结果不符合成功条件(缺少 data.title ) (attempt ${attempt}/${maxRetries})`
|
||||
);
|
||||
console.warn('B站搜索API响应不符合要求,将重试。调试信息:', {
|
||||
status: response?.status,
|
||||
hasData: Boolean(response?.data),
|
||||
hasInnerData: Boolean(response?.data?.data),
|
||||
title: response?.data?.data?.title
|
||||
});
|
||||
} catch (error) {
|
||||
lastError = error;
|
||||
console.warn(`B站搜索API错误[第${attempt}次],将重试:`, error);
|
||||
}
|
||||
|
||||
if (attempt === maxRetries) {
|
||||
console.error('B站搜索API重试达到上限,仍然失败');
|
||||
if (lastError instanceof Error) throw lastError;
|
||||
throw new Error('B站搜索失败且达到最大重试次数');
|
||||
}
|
||||
|
||||
await delay(delayMs);
|
||||
}
|
||||
// 理论上不会到达这里,添加以满足TS控制流分析
|
||||
throw new Error('B站搜索在重试后未返回有效结果');
|
||||
};
|
||||
|
||||
interface IBilibiliResponse<T> {
|
||||
@@ -139,7 +176,7 @@ export const getBilibiliAudioUrl = async (bvid: string, cid: number): Promise<st
|
||||
let url = '';
|
||||
|
||||
if (playUrlData.dash && playUrlData.dash.audio && playUrlData.dash.audio.length > 0) {
|
||||
url = playUrlData.dash.audio[0].baseUrl;
|
||||
url = playUrlData.dash.audio[playUrlData.dash.audio.length - 1].baseUrl;
|
||||
} else if (playUrlData.durl && playUrlData.durl.length > 0) {
|
||||
url = playUrlData.durl[0].url;
|
||||
} else {
|
||||
@@ -158,6 +195,9 @@ export const searchAndGetBilibiliAudioUrl = async (keyword: string): Promise<str
|
||||
try {
|
||||
// 搜索B站视频,取第一页第一个结果
|
||||
const res = await searchBilibili({ keyword, page: 1, pagesize: 1 });
|
||||
if (!res) {
|
||||
throw new Error('B站搜索返回为空');
|
||||
}
|
||||
const result = res.data?.data?.result;
|
||||
if (!result || result.length === 0) {
|
||||
throw new Error('未找到相关B站视频');
|
||||
@@ -178,3 +218,227 @@ export const searchAndGetBilibiliAudioUrl = async (keyword: string): Promise<str
|
||||
throw error;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* 解析B站ID格式
|
||||
* @param biliId B站ID,可能是字符串格式(bvid--pid--cid)
|
||||
* @returns 解析后的对象 {bvid, pid, cid} 或 null
|
||||
*/
|
||||
export const parseBilibiliId = (
|
||||
biliId: string | number
|
||||
): { bvid: string; pid: string; cid: number } | null => {
|
||||
const strBiliId = String(biliId);
|
||||
|
||||
if (strBiliId.includes('--')) {
|
||||
const [bvid, pid, cid] = strBiliId.split('--');
|
||||
if (!bvid || !pid || !cid) {
|
||||
console.warn(`B站ID格式错误: ${strBiliId}, 正确格式应为 bvid--pid--cid`);
|
||||
return null;
|
||||
}
|
||||
return { bvid, pid, cid: Number(cid) };
|
||||
}
|
||||
|
||||
return null;
|
||||
};
|
||||
|
||||
/**
|
||||
* 创建默认的Artist对象
|
||||
* @param name 艺术家名称
|
||||
* @param id 艺术家ID
|
||||
* @returns Artist对象
|
||||
*/
|
||||
const createDefaultArtist = (name: string, id: number = 0) => ({
|
||||
name,
|
||||
id,
|
||||
picId: 0,
|
||||
img1v1Id: 0,
|
||||
briefDesc: '',
|
||||
img1v1Url: '',
|
||||
albumSize: 0,
|
||||
alias: [],
|
||||
trans: '',
|
||||
musicSize: 0,
|
||||
topicPerson: 0,
|
||||
picUrl: ''
|
||||
});
|
||||
|
||||
/**
|
||||
* 创建默认的Album对象
|
||||
* @param name 专辑名称
|
||||
* @param picUrl 专辑图片URL
|
||||
* @param artistName 艺术家名称
|
||||
* @param artistId 艺术家ID
|
||||
* @returns Album对象
|
||||
*/
|
||||
const createDefaultAlbum = (
|
||||
name: string,
|
||||
picUrl: string,
|
||||
artistName: string,
|
||||
artistId: number = 0
|
||||
) => ({
|
||||
name,
|
||||
picUrl,
|
||||
id: 0,
|
||||
type: '',
|
||||
size: 0,
|
||||
picId: 0,
|
||||
blurPicUrl: '',
|
||||
companyId: 0,
|
||||
pic: 0,
|
||||
publishTime: 0,
|
||||
description: '',
|
||||
tags: '',
|
||||
company: '',
|
||||
briefDesc: '',
|
||||
artist: createDefaultArtist(artistName, artistId),
|
||||
songs: [],
|
||||
alias: [],
|
||||
status: 0,
|
||||
copyrightId: 0,
|
||||
commentThreadId: '',
|
||||
artists: [],
|
||||
subType: '',
|
||||
transName: null,
|
||||
onSale: false,
|
||||
mark: 0,
|
||||
picId_str: ''
|
||||
});
|
||||
|
||||
/**
|
||||
* 创建基础的B站SongResult对象
|
||||
* @param config 配置对象
|
||||
* @returns SongResult对象
|
||||
*/
|
||||
const createBaseBilibiliSong = (config: {
|
||||
id: string | number;
|
||||
name: string;
|
||||
picUrl: string;
|
||||
artistName: string;
|
||||
artistId?: number;
|
||||
albumName: string;
|
||||
bilibiliData?: { bvid: string; cid: number };
|
||||
playMusicUrl?: string;
|
||||
duration?: number;
|
||||
}): SongResult => {
|
||||
const {
|
||||
id,
|
||||
name,
|
||||
picUrl,
|
||||
artistName,
|
||||
artistId = 0,
|
||||
albumName,
|
||||
bilibiliData,
|
||||
playMusicUrl,
|
||||
duration
|
||||
} = config;
|
||||
|
||||
const baseResult: SongResult = {
|
||||
id,
|
||||
name,
|
||||
picUrl,
|
||||
ar: [createDefaultArtist(artistName, artistId)],
|
||||
al: createDefaultAlbum(albumName, picUrl, artistName, artistId),
|
||||
count: 0,
|
||||
source: 'bilibili' as const
|
||||
};
|
||||
|
||||
if (bilibiliData) {
|
||||
baseResult.bilibiliData = bilibiliData;
|
||||
}
|
||||
|
||||
if (playMusicUrl) {
|
||||
baseResult.playMusicUrl = playMusicUrl;
|
||||
}
|
||||
|
||||
if (duration !== undefined) {
|
||||
baseResult.duration = duration;
|
||||
}
|
||||
|
||||
return baseResult as SongResult;
|
||||
};
|
||||
|
||||
/**
|
||||
* 从B站视频详情和分P信息创建SongResult对象
|
||||
* @param videoDetail B站视频详情
|
||||
* @param page 分P信息
|
||||
* @param bvid B站视频ID
|
||||
* @returns SongResult对象
|
||||
*/
|
||||
export const createSongFromBilibiliVideo = (
|
||||
videoDetail: IBilibiliVideoDetail,
|
||||
page: IBilibiliPage,
|
||||
bvid: string
|
||||
): SongResult => {
|
||||
const pageName = page.part || '';
|
||||
const title = `${pageName} - ${videoDetail.title}`;
|
||||
const songId = `${bvid}--${page.page}--${page.cid}`;
|
||||
const picUrl = getBilibiliProxyUrl(videoDetail.pic);
|
||||
|
||||
return createBaseBilibiliSong({
|
||||
id: songId,
|
||||
name: title,
|
||||
picUrl,
|
||||
artistName: videoDetail.owner.name,
|
||||
artistId: videoDetail.owner.mid,
|
||||
albumName: videoDetail.title,
|
||||
bilibiliData: {
|
||||
bvid,
|
||||
cid: page.cid
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* 创建简化的SongResult对象(用于搜索结果直接播放)
|
||||
* @param item 搜索结果项
|
||||
* @param audioUrl 音频URL
|
||||
* @returns SongResult对象
|
||||
*/
|
||||
export const createSimpleBilibiliSong = (item: any, audioUrl: string): SongResult => {
|
||||
const duration = typeof item.duration === 'string' ? 0 : item.duration * 1000; // 转换为毫秒
|
||||
|
||||
return createBaseBilibiliSong({
|
||||
id: item.id,
|
||||
name: item.title,
|
||||
picUrl: item.pic,
|
||||
artistName: item.author,
|
||||
albumName: item.title,
|
||||
playMusicUrl: audioUrl,
|
||||
duration
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* 批量处理B站视频,从ID列表获取SongResult列表
|
||||
* @param bilibiliIds B站ID列表
|
||||
* @returns SongResult列表
|
||||
*/
|
||||
export const processBilibiliVideos = async (
|
||||
bilibiliIds: (string | number)[]
|
||||
): Promise<SongResult[]> => {
|
||||
const bilibiliSongs: SongResult[] = [];
|
||||
|
||||
for (const biliId of bilibiliIds) {
|
||||
const parsedId = parseBilibiliId(biliId);
|
||||
if (!parsedId) continue;
|
||||
|
||||
try {
|
||||
const res = await getBilibiliVideoDetail(parsedId.bvid);
|
||||
const videoDetail = res.data;
|
||||
|
||||
// 找到对应的分P
|
||||
const page = videoDetail.pages.find((p) => p.cid === parsedId.cid);
|
||||
if (!page) {
|
||||
console.warn(`未找到对应的分P: cid=${parsedId.cid}`);
|
||||
continue;
|
||||
}
|
||||
|
||||
const songData = createSongFromBilibiliVideo(videoDetail, page, parsedId.bvid);
|
||||
bilibiliSongs.push(songData);
|
||||
} catch (error) {
|
||||
console.error(`获取B站视频详情失败 (${biliId}):`, error);
|
||||
}
|
||||
}
|
||||
|
||||
return bilibiliSongs;
|
||||
};
|
||||
|
||||
@@ -1,15 +1,10 @@
|
||||
import { cloneDeep } from 'lodash';
|
||||
|
||||
import { musicDB } from '@/hooks/MusicHook';
|
||||
import { useSettingsStore, useUserStore } from '@/store';
|
||||
import type { ILyric } from '@/types/lyric';
|
||||
import type { SongResult } from '@/types/music';
|
||||
import { isElectron } from '@/utils';
|
||||
import request from '@/utils/request';
|
||||
import requestMusic from '@/utils/request_music';
|
||||
|
||||
import { searchAndGetBilibiliAudioUrl } from './bilibili';
|
||||
import { parseFromGDMusic } from './gdmusic';
|
||||
import { MusicParser, type MusicParseResult } from './musicParser';
|
||||
|
||||
const { addData, getData, deleteData } = musicDB;
|
||||
|
||||
@@ -30,6 +25,8 @@ export const getMusicUrl = async (id: number, isDownloaded: boolean = false) =>
|
||||
params: {
|
||||
id,
|
||||
level: settingStore.setData.musicQuality || 'higher',
|
||||
encodeType: settingStore.setData.musicQuality == 'lossless' ? 'aac' : 'flac',
|
||||
// level为lossless时,encodeType=flac时网易云会返回hires音质,encodeType=aac时网易云会返回lossless音质
|
||||
cookie: `${localStorage.getItem('token')} os=pc;`
|
||||
}
|
||||
});
|
||||
@@ -45,7 +42,8 @@ export const getMusicUrl = async (id: number, isDownloaded: boolean = false) =>
|
||||
return await request.get('/song/url/v1', {
|
||||
params: {
|
||||
id,
|
||||
level: settingStore.setData.musicQuality || 'higher'
|
||||
level: settingStore.setData.musicQuality || 'higher',
|
||||
encodeType: settingStore.setData.musicQuality == 'lossless' ? 'aac' : 'flac'
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -67,7 +65,7 @@ export const getMusicLrc = async (id: number) => {
|
||||
}
|
||||
|
||||
// 获取新的歌词数据
|
||||
const res = await request.get<ILyric>('/lyric', { params: { id } });
|
||||
const res = await request.get<ILyric>('/lyric/new', { params: { id } });
|
||||
|
||||
// 只有在成功获取新数据后才删除旧缓存并添加新缓存
|
||||
if (res?.data) {
|
||||
@@ -84,121 +82,17 @@ export const getMusicLrc = async (id: number) => {
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* 从Bilibili获取音频URL
|
||||
* @param data 歌曲数据
|
||||
* @returns 解析结果
|
||||
*/
|
||||
const getBilibiliAudio = async (data: SongResult) => {
|
||||
const songName = data?.name || '';
|
||||
const artistName =
|
||||
Array.isArray(data?.ar) && data.ar.length > 0 && data.ar[0]?.name ? data.ar[0].name : '';
|
||||
const albumName = data?.al && typeof data.al === 'object' && data.al?.name ? data.al.name : '';
|
||||
|
||||
const searchQuery = [songName, artistName, albumName].filter(Boolean).join(' ').trim();
|
||||
console.log('开始搜索bilibili音频:', searchQuery);
|
||||
|
||||
const url = await searchAndGetBilibiliAudioUrl(searchQuery);
|
||||
return {
|
||||
data: {
|
||||
code: 200,
|
||||
message: 'success',
|
||||
data: { url }
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* 从GD音乐台获取音频URL
|
||||
* @param id 歌曲ID
|
||||
* @param data 歌曲数据
|
||||
* @returns 解析结果,失败时返回null
|
||||
*/
|
||||
const getGDMusicAudio = async (id: number, data: SongResult) => {
|
||||
try {
|
||||
const gdResult = await parseFromGDMusic(id, data, '999');
|
||||
if (gdResult) {
|
||||
return gdResult;
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('GD音乐台解析失败:', error);
|
||||
}
|
||||
return null;
|
||||
};
|
||||
|
||||
/**
|
||||
* 使用unblockMusic解析音频URL
|
||||
* @param id 歌曲ID
|
||||
* @param data 歌曲数据
|
||||
* @param sources 音源列表
|
||||
* @returns 解析结果
|
||||
*/
|
||||
const getUnblockMusicAudio = (id: number, data: SongResult, sources: any[]) => {
|
||||
const filteredSources = sources.filter((source) => source !== 'gdmusic');
|
||||
console.log(`使用unblockMusic解析,音源:`, filteredSources);
|
||||
return window.api.unblockMusic(id, cloneDeep(data), cloneDeep(filteredSources));
|
||||
};
|
||||
|
||||
/**
|
||||
* 获取解析后的音乐URL
|
||||
* @param id 歌曲ID
|
||||
* @param data 歌曲数据
|
||||
* @returns 解析结果
|
||||
*/
|
||||
export const getParsingMusicUrl = async (id: number, data: SongResult) => {
|
||||
const settingStore = useSettingsStore();
|
||||
|
||||
// 如果禁用了音乐解析功能,则直接返回空结果
|
||||
if (!settingStore.setData.enableMusicUnblock) {
|
||||
return Promise.resolve({ data: { code: 404, message: '音乐解析功能已禁用' } });
|
||||
}
|
||||
|
||||
// 1. 确定使用的音源列表(自定义或全局)
|
||||
const songId = String(id);
|
||||
const savedSourceStr = localStorage.getItem(`song_source_${songId}`);
|
||||
let musicSources: any[] = [];
|
||||
|
||||
try {
|
||||
if (savedSourceStr) {
|
||||
// 使用自定义音源
|
||||
musicSources = JSON.parse(savedSourceStr);
|
||||
console.log(`使用歌曲 ${id} 自定义音源:`, musicSources);
|
||||
} else {
|
||||
// 使用全局音源设置
|
||||
musicSources = settingStore.setData.enabledMusicSources || [];
|
||||
console.log(`使用全局音源设置:`, musicSources);
|
||||
if (isElectron && musicSources.length > 0) {
|
||||
return getUnblockMusicAudio(id, data, musicSources);
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
console.error('解析音源设置失败,使用全局设置', e);
|
||||
musicSources = settingStore.setData.enabledMusicSources || [];
|
||||
}
|
||||
|
||||
// 2. 按优先级解析
|
||||
|
||||
// 2.1 Bilibili解析(优先级最高)
|
||||
if (musicSources.includes('bilibili')) {
|
||||
return await getBilibiliAudio(data);
|
||||
}
|
||||
|
||||
// 2.2 GD音乐台解析
|
||||
if (musicSources.includes('gdmusic')) {
|
||||
const gdResult = await getGDMusicAudio(id, data);
|
||||
if (gdResult) return gdResult;
|
||||
// GD解析失败,继续下一步
|
||||
console.log('GD音乐台解析失败,尝试使用其他音源');
|
||||
}
|
||||
console.log('musicSources', musicSources);
|
||||
// 2.3 使用unblockMusic解析其他音源
|
||||
if (isElectron && musicSources.length > 0) {
|
||||
return getUnblockMusicAudio(id, data, musicSources);
|
||||
}
|
||||
|
||||
// 3. 后备方案:使用API请求
|
||||
console.log('无可用音源或不在Electron环境中,使用API请求');
|
||||
return requestMusic.get<any>('/music', { params: { id } });
|
||||
export const getParsingMusicUrl = async (
|
||||
id: number,
|
||||
data: SongResult
|
||||
): Promise<MusicParseResult> => {
|
||||
return await MusicParser.parseMusic(id, data);
|
||||
};
|
||||
|
||||
// 收藏歌曲
|
||||
@@ -206,6 +100,12 @@ export const likeSong = (id: number, like: boolean = true) => {
|
||||
return request.get('/like', { params: { id, like } });
|
||||
};
|
||||
|
||||
// 将每日推荐中的歌曲标记为不感兴趣,并获取一首新歌
|
||||
export const dislikeRecommendedSong = (id: number | string) => {
|
||||
return request.get('/recommend/songs/dislike', {
|
||||
params: { id }
|
||||
});
|
||||
};
|
||||
// 获取用户喜欢的音乐列表
|
||||
export const getLikedList = (uid: number) => {
|
||||
return request.get('/likelist', {
|
||||
@@ -276,3 +176,49 @@ export function subscribePlaylist(params: { t: number; id: number }) {
|
||||
params
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 收藏/取消收藏专辑
|
||||
* @param params t: 1 收藏, 2 取消收藏; id: 专辑id
|
||||
*/
|
||||
export function subscribeAlbum(params: { t: number; id: number }) {
|
||||
return request({
|
||||
url: '/album/sub',
|
||||
method: 'post',
|
||||
params
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取历史日推可用日期列表
|
||||
*/
|
||||
export function getHistoryRecommendDates() {
|
||||
return request({
|
||||
url: '/history/recommend/songs',
|
||||
method: 'get'
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取历史日推详情数据
|
||||
* @param date 日期,格式:YYYY-MM-DD
|
||||
*/
|
||||
export function getHistoryRecommendSongs(date: string) {
|
||||
return request({
|
||||
url: '/history/recommend/songs/detail',
|
||||
method: 'get',
|
||||
params: { date }
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 心动模式/智能播放
|
||||
* @param params id: 歌曲id, pid: 歌单id, sid: 要开始播放的歌曲id(可选)
|
||||
*/
|
||||
export function getIntelligenceList(params: { id: number; pid: number; sid?: number }) {
|
||||
return request({
|
||||
url: '/playmode/intelligence/list',
|
||||
method: 'get',
|
||||
params
|
||||
});
|
||||
}
|
||||
|
||||
677
src/renderer/api/musicParser.ts
Normal file
677
src/renderer/api/musicParser.ts
Normal file
@@ -0,0 +1,677 @@
|
||||
import { cloneDeep } from 'lodash';
|
||||
|
||||
import { musicDB } from '@/hooks/MusicHook';
|
||||
import { useSettingsStore } from '@/store';
|
||||
import type { SongResult } from '@/types/music';
|
||||
import { isElectron } from '@/utils';
|
||||
import requestMusic from '@/utils/request_music';
|
||||
|
||||
import { searchAndGetBilibiliAudioUrl } from './bilibili';
|
||||
import type { ParsedMusicResult } from './gdmusic';
|
||||
import { parseFromGDMusic } from './gdmusic';
|
||||
import { parseFromCustomApi } from './parseFromCustomApi';
|
||||
|
||||
const { saveData, getData, deleteData } = musicDB;
|
||||
|
||||
/**
|
||||
* 音乐解析结果接口
|
||||
*/
|
||||
export interface MusicParseResult {
|
||||
data: {
|
||||
code: number;
|
||||
message: string;
|
||||
data?: {
|
||||
url: string;
|
||||
[key: string]: any;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* 缓存配置
|
||||
*/
|
||||
const CACHE_CONFIG = {
|
||||
// 音乐URL缓存时间:30分钟
|
||||
MUSIC_URL_CACHE_TIME: 30 * 60 * 1000,
|
||||
// 失败缓存时间:5分钟
|
||||
FAILED_CACHE_TIME: 5 * 60 * 1000,
|
||||
// 重试配置
|
||||
MAX_RETRY_COUNT: 2,
|
||||
RETRY_DELAY: 1000
|
||||
};
|
||||
|
||||
/**
|
||||
* 缓存管理器
|
||||
*/
|
||||
export class CacheManager {
|
||||
/**
|
||||
* 获取缓存的音乐URL
|
||||
*/
|
||||
static async getCachedMusicUrl(
|
||||
id: number,
|
||||
musicSources?: string[]
|
||||
): Promise<MusicParseResult | null> {
|
||||
try {
|
||||
const cached = await getData('music_url_cache', id);
|
||||
if (
|
||||
cached?.createTime &&
|
||||
Date.now() - cached.createTime < CACHE_CONFIG.MUSIC_URL_CACHE_TIME
|
||||
) {
|
||||
// 检查缓存的音源配置是否与当前配置一致
|
||||
const cachedSources = cached.musicSources || [];
|
||||
const currentSources = musicSources || [];
|
||||
|
||||
// 如果音源配置不一致,清除缓存
|
||||
if (JSON.stringify(cachedSources.sort()) !== JSON.stringify(currentSources.sort())) {
|
||||
console.log(`音源配置已变更,清除歌曲 ${id} 的缓存`);
|
||||
await deleteData('music_url_cache', id);
|
||||
return null;
|
||||
}
|
||||
|
||||
console.log(`使用缓存的音乐URL: ${id}`);
|
||||
return cached.data;
|
||||
}
|
||||
// 清理过期缓存
|
||||
if (cached) {
|
||||
await deleteData('music_url_cache', id);
|
||||
}
|
||||
} catch (error) {
|
||||
console.warn('获取缓存失败:', error);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 缓存音乐URL
|
||||
*/
|
||||
static async setCachedMusicUrl(
|
||||
id: number,
|
||||
result: MusicParseResult,
|
||||
musicSources?: string[]
|
||||
): Promise<void> {
|
||||
try {
|
||||
// 深度克隆数据,确保可以被 IndexedDB 存储
|
||||
await saveData('music_url_cache', {
|
||||
id,
|
||||
data: cloneDeep(result),
|
||||
musicSources: cloneDeep(musicSources || []),
|
||||
createTime: Date.now()
|
||||
});
|
||||
console.log(`缓存音乐URL成功: ${id}`);
|
||||
} catch (error) {
|
||||
console.error('缓存音乐URL失败:', error);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查是否在失败缓存期内
|
||||
*/
|
||||
static async isInFailedCache(id: number, strategyName: string): Promise<boolean> {
|
||||
try {
|
||||
const cacheKey = `${id}_${strategyName}`;
|
||||
const cached = await getData('music_failed_cache', cacheKey);
|
||||
if (cached?.createTime && Date.now() - cached.createTime < CACHE_CONFIG.FAILED_CACHE_TIME) {
|
||||
console.log(`策略 ${strategyName} 在失败缓存期内,跳过`);
|
||||
return true;
|
||||
}
|
||||
// 清理过期缓存
|
||||
if (cached) {
|
||||
await deleteData('music_failed_cache', cacheKey);
|
||||
}
|
||||
} catch (error) {
|
||||
console.warn('检查失败缓存失败:', error);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加失败缓存
|
||||
*/
|
||||
static async addFailedCache(id: number, strategyName: string): Promise<void> {
|
||||
try {
|
||||
const cacheKey = `${id}_${strategyName}`;
|
||||
await saveData('music_failed_cache', {
|
||||
id: cacheKey,
|
||||
createTime: Date.now()
|
||||
});
|
||||
console.log(`添加失败缓存成功: ${strategyName}`);
|
||||
} catch (error) {
|
||||
console.error('添加失败缓存失败:', error);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 清除指定歌曲的所有缓存
|
||||
*/
|
||||
static async clearMusicCache(id: number): Promise<void> {
|
||||
try {
|
||||
// 清除URL缓存
|
||||
await deleteData('music_url_cache', id);
|
||||
console.log(`清除歌曲 ${id} 的URL缓存`);
|
||||
|
||||
// 清除失败缓存 - 需要遍历所有策略
|
||||
const strategies = ['custom', 'bilibili', 'gdmusic', 'unblockMusic'];
|
||||
for (const strategy of strategies) {
|
||||
const cacheKey = `${id}_${strategy}`;
|
||||
try {
|
||||
await deleteData('music_failed_cache', cacheKey);
|
||||
} catch {
|
||||
// 忽略删除不存在缓存的错误
|
||||
}
|
||||
}
|
||||
console.log(`清除歌曲 ${id} 的失败缓存`);
|
||||
} catch (error) {
|
||||
console.error('清除缓存失败:', error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 重试工具
|
||||
*/
|
||||
class RetryHelper {
|
||||
/**
|
||||
* 带重试的异步执行
|
||||
*/
|
||||
static async withRetry<T>(
|
||||
fn: () => Promise<T>,
|
||||
maxRetries = CACHE_CONFIG.MAX_RETRY_COUNT,
|
||||
delay = CACHE_CONFIG.RETRY_DELAY
|
||||
): Promise<T> {
|
||||
let lastError: Error;
|
||||
|
||||
for (let i = 0; i <= maxRetries; i++) {
|
||||
try {
|
||||
return await fn();
|
||||
} catch (error) {
|
||||
lastError = error as Error;
|
||||
if (i < maxRetries) {
|
||||
console.log(`重试第 ${i + 1} 次,延迟 ${delay}ms`);
|
||||
await new Promise((resolve) => setTimeout(resolve, delay));
|
||||
delay *= 2; // 指数退避
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
throw lastError!;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 从Bilibili获取音频URL
|
||||
* @param data 歌曲数据
|
||||
* @returns 解析结果
|
||||
*/
|
||||
const getBilibiliAudio = async (data: SongResult) => {
|
||||
const songName = data?.name || '';
|
||||
const artistName =
|
||||
Array.isArray(data?.ar) && data.ar.length > 0 && data.ar[0]?.name ? data.ar[0].name : '';
|
||||
const albumName = data?.al && typeof data.al === 'object' && data.al?.name ? data.al.name : '';
|
||||
|
||||
const searchQuery = [songName, artistName, albumName].filter(Boolean).join(' ').trim();
|
||||
console.log('开始搜索bilibili音频:', searchQuery);
|
||||
|
||||
const url = await searchAndGetBilibiliAudioUrl(searchQuery);
|
||||
return {
|
||||
data: {
|
||||
code: 200,
|
||||
message: 'success',
|
||||
data: { url }
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* 从GD音乐台获取音频URL
|
||||
* @param id 歌曲ID
|
||||
* @param data 歌曲数据
|
||||
* @returns 解析结果,失败时返回null
|
||||
*/
|
||||
const getGDMusicAudio = async (id: number, data: SongResult): Promise<ParsedMusicResult | null> => {
|
||||
try {
|
||||
const gdResult = await parseFromGDMusic(id, data, '999');
|
||||
if (gdResult) {
|
||||
return gdResult;
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('GD音乐台解析失败:', error);
|
||||
}
|
||||
return null;
|
||||
};
|
||||
|
||||
/**
|
||||
* 使用unblockMusic解析音频URL
|
||||
* @param id 歌曲ID
|
||||
* @param data 歌曲数据
|
||||
* @param sources 音源列表
|
||||
* @returns 解析结果
|
||||
*/
|
||||
const getUnblockMusicAudio = (id: number, data: SongResult, sources: any[]) => {
|
||||
const filteredSources = sources.filter((source) => source !== 'gdmusic');
|
||||
console.log(`使用unblockMusic解析,音源:`, filteredSources);
|
||||
return window.api.unblockMusic(id, cloneDeep(data), cloneDeep(filteredSources));
|
||||
};
|
||||
|
||||
/**
|
||||
* 统一的解析结果适配器
|
||||
*/
|
||||
const adaptParseResult = (result: any): MusicParseResult | null => {
|
||||
if (!result) return null;
|
||||
|
||||
// 如果已经是标准格式
|
||||
if (result.data?.code !== undefined && result.data?.message !== undefined) {
|
||||
return result;
|
||||
}
|
||||
|
||||
// 适配GD音乐台的返回格式
|
||||
if (result.data?.data?.url) {
|
||||
return {
|
||||
data: {
|
||||
code: 200,
|
||||
message: 'success',
|
||||
data: {
|
||||
url: result.data.data.url,
|
||||
...result.data.data
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
// 适配其他格式
|
||||
if (result.url) {
|
||||
return {
|
||||
data: {
|
||||
code: 200,
|
||||
message: 'success',
|
||||
data: {
|
||||
url: result.url,
|
||||
...result
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
return null;
|
||||
};
|
||||
|
||||
/**
|
||||
* 音源解析策略接口
|
||||
*/
|
||||
interface MusicSourceStrategy {
|
||||
name: string;
|
||||
priority: number;
|
||||
canHandle: (sources: string[], settingsStore?: any) => boolean;
|
||||
parse: (
|
||||
id: number,
|
||||
data: SongResult,
|
||||
quality?: string,
|
||||
sources?: string[]
|
||||
) => Promise<MusicParseResult | null>;
|
||||
}
|
||||
|
||||
/**
|
||||
* 自定义API解析策略
|
||||
*/
|
||||
class CustomApiStrategy implements MusicSourceStrategy {
|
||||
name = 'custom';
|
||||
priority = 1;
|
||||
|
||||
canHandle(sources: string[], settingsStore?: any): boolean {
|
||||
return sources.includes('custom') && Boolean(settingsStore?.setData?.customApiPlugin);
|
||||
}
|
||||
|
||||
async parse(id: number, data: SongResult, quality = 'higher'): Promise<MusicParseResult | null> {
|
||||
// 检查失败缓存
|
||||
if (await CacheManager.isInFailedCache(id, this.name)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
try {
|
||||
console.log('尝试使用自定义API解析...');
|
||||
const result = await RetryHelper.withRetry(async () => {
|
||||
return await parseFromCustomApi(id, data, quality);
|
||||
});
|
||||
|
||||
const adaptedResult = adaptParseResult(result);
|
||||
if (adaptedResult?.data?.data?.url) {
|
||||
console.log('自定义API解析成功');
|
||||
return adaptedResult;
|
||||
}
|
||||
|
||||
// 解析失败,添加失败缓存
|
||||
await CacheManager.addFailedCache(id, this.name);
|
||||
return null;
|
||||
} catch (error) {
|
||||
console.error('自定义API解析失败:', error);
|
||||
await CacheManager.addFailedCache(id, this.name);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Bilibili解析策略
|
||||
*/
|
||||
class BilibiliStrategy implements MusicSourceStrategy {
|
||||
name = 'bilibili';
|
||||
priority = 2;
|
||||
|
||||
canHandle(sources: string[]): boolean {
|
||||
return sources.includes('bilibili');
|
||||
}
|
||||
|
||||
async parse(id: number, data: SongResult): Promise<MusicParseResult | null> {
|
||||
// 检查失败缓存
|
||||
if (await CacheManager.isInFailedCache(id, this.name)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
try {
|
||||
console.log('尝试使用Bilibili解析...');
|
||||
const result = await RetryHelper.withRetry(async () => {
|
||||
return await getBilibiliAudio(data);
|
||||
});
|
||||
|
||||
const adaptedResult = adaptParseResult(result);
|
||||
if (adaptedResult?.data?.data?.url) {
|
||||
console.log('Bilibili解析成功');
|
||||
return adaptedResult;
|
||||
}
|
||||
|
||||
// 解析失败,添加失败缓存
|
||||
await CacheManager.addFailedCache(id, this.name);
|
||||
return null;
|
||||
} catch (error) {
|
||||
console.error('Bilibili解析失败:', error);
|
||||
await CacheManager.addFailedCache(id, this.name);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* GD音乐台解析策略
|
||||
*/
|
||||
class GDMusicStrategy implements MusicSourceStrategy {
|
||||
name = 'gdmusic';
|
||||
priority = 3;
|
||||
|
||||
canHandle(sources: string[]): boolean {
|
||||
return sources.includes('gdmusic');
|
||||
}
|
||||
|
||||
async parse(id: number, data: SongResult): Promise<MusicParseResult | null> {
|
||||
// 检查失败缓存
|
||||
if (await CacheManager.isInFailedCache(id, this.name)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
try {
|
||||
console.log('尝试使用GD音乐台解析...');
|
||||
const result = await RetryHelper.withRetry(async () => {
|
||||
return await getGDMusicAudio(id, data);
|
||||
});
|
||||
|
||||
const adaptedResult = adaptParseResult(result);
|
||||
if (adaptedResult?.data?.data?.url) {
|
||||
console.log('GD音乐台解析成功');
|
||||
return adaptedResult;
|
||||
}
|
||||
|
||||
// 解析失败,添加失败缓存
|
||||
await CacheManager.addFailedCache(id, this.name);
|
||||
return null;
|
||||
} catch (error) {
|
||||
console.error('GD音乐台解析失败:', error);
|
||||
await CacheManager.addFailedCache(id, this.name);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* UnblockMusic解析策略
|
||||
*/
|
||||
class UnblockMusicStrategy implements MusicSourceStrategy {
|
||||
name = 'unblockMusic';
|
||||
priority = 4;
|
||||
|
||||
canHandle(sources: string[]): boolean {
|
||||
const unblockSources = sources.filter(
|
||||
(source) => !['custom', 'bilibili', 'gdmusic'].includes(source)
|
||||
);
|
||||
return unblockSources.length > 0;
|
||||
}
|
||||
|
||||
async parse(
|
||||
id: number,
|
||||
data: SongResult,
|
||||
_quality?: string,
|
||||
sources?: string[]
|
||||
): Promise<MusicParseResult | null> {
|
||||
// 检查失败缓存
|
||||
if (await CacheManager.isInFailedCache(id, this.name)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
try {
|
||||
const unblockSources = (sources || []).filter(
|
||||
(source) => !['custom', 'bilibili', 'gdmusic'].includes(source)
|
||||
);
|
||||
console.log('尝试使用UnblockMusic解析:', unblockSources);
|
||||
|
||||
const result = await RetryHelper.withRetry(async () => {
|
||||
return await getUnblockMusicAudio(id, data, unblockSources);
|
||||
});
|
||||
|
||||
const adaptedResult = adaptParseResult(result);
|
||||
if (adaptedResult?.data?.data?.url) {
|
||||
console.log('UnblockMusic解析成功');
|
||||
return adaptedResult;
|
||||
}
|
||||
|
||||
// 解析失败,添加失败缓存
|
||||
await CacheManager.addFailedCache(id, this.name);
|
||||
return null;
|
||||
} catch (error) {
|
||||
console.error('UnblockMusic解析失败:', error);
|
||||
await CacheManager.addFailedCache(id, this.name);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 音源策略工厂
|
||||
*/
|
||||
class MusicSourceStrategyFactory {
|
||||
private static strategies: MusicSourceStrategy[] = [
|
||||
new CustomApiStrategy(),
|
||||
new BilibiliStrategy(),
|
||||
new GDMusicStrategy(),
|
||||
new UnblockMusicStrategy()
|
||||
];
|
||||
|
||||
/**
|
||||
* 获取可用的解析策略
|
||||
* @param sources 音源列表
|
||||
* @param settingsStore 设置存储
|
||||
* @returns 排序后的可用策略列表
|
||||
*/
|
||||
static getAvailableStrategies(sources: string[], settingsStore?: any): MusicSourceStrategy[] {
|
||||
return this.strategies
|
||||
.filter((strategy) => strategy.canHandle(sources, settingsStore))
|
||||
.sort((a, b) => a.priority - b.priority);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取音源配置
|
||||
* @param id 歌曲ID
|
||||
* @param settingsStore 设置存储
|
||||
* @returns 音源列表和音质设置
|
||||
*/
|
||||
const getMusicConfig = (id: number, settingsStore?: any) => {
|
||||
const songId = String(id);
|
||||
let musicSources: string[] = [];
|
||||
let quality = 'higher';
|
||||
|
||||
try {
|
||||
// 尝试获取歌曲自定义音源
|
||||
const savedSourceStr = localStorage.getItem(`song_source_${songId}`);
|
||||
if (savedSourceStr) {
|
||||
try {
|
||||
const customSources = JSON.parse(savedSourceStr);
|
||||
if (Array.isArray(customSources)) {
|
||||
musicSources = customSources;
|
||||
console.log(`使用歌曲 ${id} 自定义音源:`, musicSources);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('解析自定义音源设置失败:', error);
|
||||
}
|
||||
}
|
||||
|
||||
// 如果没有自定义音源,使用全局设置
|
||||
if (musicSources.length === 0) {
|
||||
musicSources = settingsStore?.setData?.enabledMusicSources || [];
|
||||
console.log('使用全局音源设置:', musicSources);
|
||||
}
|
||||
|
||||
quality = settingsStore?.setData?.musicQuality || 'higher';
|
||||
} catch (error) {
|
||||
console.error('读取音源配置失败,使用默认配置:', error);
|
||||
musicSources = [];
|
||||
quality = 'higher';
|
||||
}
|
||||
|
||||
return { musicSources, quality };
|
||||
};
|
||||
|
||||
/**
|
||||
* 音乐解析器主类
|
||||
*/
|
||||
export class MusicParser {
|
||||
/**
|
||||
* 解析音乐URL
|
||||
* @param id 歌曲ID
|
||||
* @param data 歌曲数据
|
||||
* @returns 解析结果
|
||||
*/
|
||||
static async parseMusic(id: number, data: SongResult): Promise<MusicParseResult> {
|
||||
const startTime = performance.now();
|
||||
|
||||
try {
|
||||
// 非Electron环境直接使用API请求
|
||||
if (!isElectron) {
|
||||
console.log('非Electron环境,使用API请求');
|
||||
return await requestMusic.get<any>('/music', { params: { id } });
|
||||
}
|
||||
|
||||
// 获取设置存储
|
||||
let settingsStore: any;
|
||||
try {
|
||||
settingsStore = useSettingsStore();
|
||||
} catch (error) {
|
||||
console.error('无法获取设置存储,使用后备方案:', error);
|
||||
return await requestMusic.get<any>('/music', { params: { id } });
|
||||
}
|
||||
|
||||
// 获取音源配置
|
||||
const { musicSources, quality } = getMusicConfig(id, settingsStore);
|
||||
|
||||
// 检查缓存(传入音源配置用于验证缓存有效性)
|
||||
console.log(`检查歌曲 ${id} 的缓存...`);
|
||||
const cachedResult = await CacheManager.getCachedMusicUrl(id, musicSources);
|
||||
if (cachedResult) {
|
||||
const endTime = performance.now();
|
||||
console.log(`✅ 命中缓存,歌曲 ${id},耗时: ${(endTime - startTime).toFixed(2)}ms`);
|
||||
return cachedResult;
|
||||
}
|
||||
console.log(`❌ 未命中缓存,歌曲 ${id},开始解析...`);
|
||||
|
||||
// 检查音乐解析功能是否启用
|
||||
if (!settingsStore?.setData?.enableMusicUnblock) {
|
||||
console.log('音乐解析功能已禁用');
|
||||
return {
|
||||
data: {
|
||||
code: 404,
|
||||
message: '音乐解析功能已禁用',
|
||||
data: undefined
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
if (musicSources.length === 0) {
|
||||
console.warn('没有配置可用的音源,使用后备方案');
|
||||
return await requestMusic.get<any>('/music', { params: { id } });
|
||||
}
|
||||
|
||||
// 获取可用的解析策略
|
||||
const availableStrategies = MusicSourceStrategyFactory.getAvailableStrategies(
|
||||
musicSources,
|
||||
settingsStore
|
||||
);
|
||||
|
||||
if (availableStrategies.length === 0) {
|
||||
console.warn('没有可用的解析策略,使用后备方案');
|
||||
return await requestMusic.get<any>('/music', { params: { id } });
|
||||
}
|
||||
|
||||
console.log(
|
||||
`开始解析歌曲 ${id},可用策略:`,
|
||||
availableStrategies.map((s) => s.name)
|
||||
);
|
||||
|
||||
// 按优先级依次尝试解析策略
|
||||
for (const strategy of availableStrategies) {
|
||||
try {
|
||||
const result = await strategy.parse(id, data, quality, musicSources);
|
||||
if (result?.data?.data?.url) {
|
||||
const endTime = performance.now();
|
||||
console.log(
|
||||
`解析成功,使用策略: ${strategy.name},耗时: ${(endTime - startTime).toFixed(2)}ms`
|
||||
);
|
||||
|
||||
// 缓存成功结果(包含音源配置)
|
||||
await CacheManager.setCachedMusicUrl(id, result, musicSources);
|
||||
|
||||
return result;
|
||||
}
|
||||
console.log(`策略 ${strategy.name} 解析失败,继续尝试下一个策略`);
|
||||
} catch (error) {
|
||||
console.error(`策略 ${strategy.name} 解析异常:`, error);
|
||||
// 继续尝试下一个策略
|
||||
}
|
||||
}
|
||||
|
||||
console.warn('所有解析策略都失败了,使用后备方案');
|
||||
} catch (error) {
|
||||
console.error('MusicParser.parseMusic 执行异常,使用后备方案:', error);
|
||||
}
|
||||
|
||||
// 后备方案:使用API请求
|
||||
try {
|
||||
console.log('使用后备方案:API请求');
|
||||
const result = await requestMusic.get<any>('/music', { params: { id } });
|
||||
|
||||
// 如果后备方案成功,也进行缓存
|
||||
if (result?.data?.data?.url) {
|
||||
console.log('后备方案成功,缓存结果');
|
||||
await CacheManager.setCachedMusicUrl(id, result, []);
|
||||
}
|
||||
|
||||
return result;
|
||||
} catch (apiError) {
|
||||
console.error('API请求也失败了:', apiError);
|
||||
const endTime = performance.now();
|
||||
console.log(`总耗时: ${(endTime - startTime).toFixed(2)}ms`);
|
||||
return {
|
||||
data: {
|
||||
code: 500,
|
||||
message: '所有解析方式都失败了',
|
||||
data: undefined
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
107
src/renderer/api/parseFromCustomApi.ts
Normal file
107
src/renderer/api/parseFromCustomApi.ts
Normal file
@@ -0,0 +1,107 @@
|
||||
import axios from 'axios';
|
||||
import { get } from 'lodash';
|
||||
|
||||
import { useSettingsStore } from '@/store';
|
||||
|
||||
import type { ParsedMusicResult } from './gdmusic';
|
||||
|
||||
/**
|
||||
* 定义自定义API JSON插件的结构
|
||||
*/
|
||||
interface CustomApiPlugin {
|
||||
name: string;
|
||||
apiUrl: string;
|
||||
method?: 'GET' | 'POST';
|
||||
params: Record<string, string>;
|
||||
qualityMapping?: Record<string, string>;
|
||||
responseUrlPath: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* 从用户导入的自定义API JSON配置中解析音乐URL
|
||||
*/
|
||||
export const parseFromCustomApi = async (
|
||||
id: number,
|
||||
_songData: any,
|
||||
quality: string = 'higher',
|
||||
timeout: number = 10000
|
||||
): Promise<ParsedMusicResult | null> => {
|
||||
const settingsStore = useSettingsStore();
|
||||
const pluginString = settingsStore.setData.customApiPlugin;
|
||||
|
||||
if (!pluginString) {
|
||||
return null;
|
||||
}
|
||||
|
||||
let plugin: CustomApiPlugin;
|
||||
try {
|
||||
plugin = JSON.parse(pluginString);
|
||||
if (!plugin.apiUrl || !plugin.params || !plugin.responseUrlPath) {
|
||||
console.error('自定义API:JSON配置文件格式不正确。');
|
||||
return null;
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('自定义API:解析JSON配置文件失败。', error);
|
||||
return null;
|
||||
}
|
||||
|
||||
console.log(`自定义API:正在使用插件 [${plugin.name}] 进行解析...`);
|
||||
|
||||
try {
|
||||
// 1. 准备请求参数,替换占位符
|
||||
const finalParams: Record<string, string> = {};
|
||||
for (const [key, value] of Object.entries(plugin.params)) {
|
||||
if (value === '{songId}') {
|
||||
finalParams[key] = String(id);
|
||||
} else if (value === '{quality}') {
|
||||
// 使用 qualityMapping (如果存在) 进行音质翻译,否则直接使用原quality
|
||||
finalParams[key] = plugin.qualityMapping?.[quality] ?? quality;
|
||||
} else {
|
||||
// 固定值参数
|
||||
finalParams[key] = value;
|
||||
}
|
||||
}
|
||||
|
||||
// 2. 判断请求方法,默认为GET
|
||||
const method = plugin.method?.toUpperCase() === 'POST' ? 'POST' : 'GET';
|
||||
let response;
|
||||
|
||||
// 3. 根据方法发送不同的请求
|
||||
if (method === 'POST') {
|
||||
console.log('自定义API:发送 POST 请求到:', plugin.apiUrl, '参数:', finalParams);
|
||||
response = await axios.post(plugin.apiUrl, finalParams, { timeout });
|
||||
} else {
|
||||
// 默认为 GET
|
||||
const finalUrl = `${plugin.apiUrl}?${new URLSearchParams(finalParams).toString()}`;
|
||||
console.log('自定义API:发送 GET 请求到:', finalUrl);
|
||||
response = await axios.get(finalUrl, { timeout });
|
||||
}
|
||||
|
||||
// 4. 使用 lodash.get 安全地从响应数据中提取URL
|
||||
const musicUrl = get(response.data, plugin.responseUrlPath);
|
||||
|
||||
if (musicUrl && typeof musicUrl === 'string') {
|
||||
console.log('自定义API:成功获取URL!');
|
||||
// 5. 组装成应用所需的标准格式并返回
|
||||
return {
|
||||
data: {
|
||||
data: {
|
||||
url: musicUrl,
|
||||
br: parseInt(quality) * 1000,
|
||||
size: 0,
|
||||
md5: '',
|
||||
platform: plugin.name.toLowerCase().replace(/\s/g, ''),
|
||||
gain: 0
|
||||
},
|
||||
params: { id, type: 'song' }
|
||||
}
|
||||
};
|
||||
} else {
|
||||
console.error('自定义API:根据路径未能从响应中找到URL:', plugin.responseUrlPath);
|
||||
return null;
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(`自定义API [${plugin.name}] 执行失败:`, error);
|
||||
return null;
|
||||
}
|
||||
};
|
||||
@@ -1,3 +1,4 @@
|
||||
import { isElectron } from '@/utils';
|
||||
import request from '@/utils/request';
|
||||
|
||||
interface IParams {
|
||||
@@ -12,3 +13,74 @@ export const getSearch = (params: IParams) => {
|
||||
params
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* 搜索建议接口返回的数据结构
|
||||
*/
|
||||
interface Suggestion {
|
||||
keyword: string;
|
||||
}
|
||||
|
||||
interface KugouSuggestionResponse {
|
||||
data: Suggestion[];
|
||||
}
|
||||
|
||||
// 网易云搜索建议返回的数据结构(部分字段)
|
||||
interface NeteaseSuggestResult {
|
||||
result?: {
|
||||
songs?: Array<{ name: string }>;
|
||||
artists?: Array<{ name: string }>;
|
||||
albums?: Array<{ name: string }>;
|
||||
};
|
||||
code?: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* 从酷狗获取搜索建议
|
||||
* @param keyword 搜索关键词
|
||||
*/
|
||||
export const getSearchSuggestions = async (keyword: string) => {
|
||||
console.log('[API] getSearchSuggestions: 开始执行');
|
||||
|
||||
if (!keyword || !keyword.trim()) {
|
||||
return Promise.resolve([]);
|
||||
}
|
||||
|
||||
console.log(`[API] getSearchSuggestions: 准备请求,关键词: "${keyword}"`);
|
||||
|
||||
try {
|
||||
let responseData: KugouSuggestionResponse;
|
||||
if (isElectron) {
|
||||
console.log('[API] Running in Electron, using IPC proxy.');
|
||||
responseData = await window.api.getSearchSuggestions(keyword);
|
||||
} else {
|
||||
// 非 Electron 环境下,使用网易云接口
|
||||
const res = await request.get<NeteaseSuggestResult>('/search/suggest', {
|
||||
params: { keywords: keyword }
|
||||
});
|
||||
|
||||
const result = res?.data?.result || {};
|
||||
const names: string[] = [];
|
||||
if (Array.isArray(result.songs)) names.push(...result.songs.map((s) => s.name));
|
||||
if (Array.isArray(result.artists)) names.push(...result.artists.map((a) => a.name));
|
||||
if (Array.isArray(result.albums)) names.push(...result.albums.map((al) => al.name));
|
||||
|
||||
// 去重并截取前10个
|
||||
const unique = Array.from(new Set(names)).slice(0, 10);
|
||||
console.log('[API] getSearchSuggestions: 网易云建议解析成功:', unique);
|
||||
return unique;
|
||||
}
|
||||
|
||||
if (responseData && Array.isArray(responseData.data)) {
|
||||
const suggestions = responseData.data.map((item) => item.keyword).slice(0, 10);
|
||||
console.log('[API] getSearchSuggestions: 成功解析建议:', suggestions);
|
||||
return suggestions;
|
||||
}
|
||||
|
||||
console.warn('[API] getSearchSuggestions: 响应数据格式不正确,返回空数组。');
|
||||
return [];
|
||||
} catch (error) {
|
||||
console.error('[API] getSearchSuggestions: 请求失败,错误信息:', error);
|
||||
return [];
|
||||
}
|
||||
};
|
||||
|
||||
@@ -20,6 +20,33 @@ export function getUserRecord(uid: number, type: number = 0) {
|
||||
} as any);
|
||||
}
|
||||
|
||||
// 最近播放-歌曲
|
||||
// /record/recent/song
|
||||
export function getRecentSongs(limit: number = 100) {
|
||||
return request.get('/record/recent/song', {
|
||||
params: { limit },
|
||||
noRetry: true
|
||||
} as any);
|
||||
}
|
||||
|
||||
// 最近播放-歌单
|
||||
// /record/recent/playlist
|
||||
export function getRecentPlaylists(limit: number = 100) {
|
||||
return request.get('/record/recent/playlist', {
|
||||
params: { limit },
|
||||
noRetry: true
|
||||
} as any);
|
||||
}
|
||||
|
||||
// 最近播放-专辑
|
||||
// /record/recent/album
|
||||
export function getRecentAlbums(limit: number = 100) {
|
||||
return request.get('/record/recent/album', {
|
||||
params: { limit },
|
||||
noRetry: true
|
||||
} as any);
|
||||
}
|
||||
|
||||
// 获取用户关注列表
|
||||
// /user/follows?uid=32953014
|
||||
export function getUserFollows(uid: number, limit: number = 30, offset: number = 0) {
|
||||
@@ -72,3 +99,15 @@ export const getUserPlaylists = (params: { uid: string | number }) => {
|
||||
params
|
||||
});
|
||||
};
|
||||
|
||||
// 获取已收藏专辑列表
|
||||
export const getUserAlbumSublist = (params?: { limit?: number; offset?: number }) => {
|
||||
return request({
|
||||
url: '/album/sublist',
|
||||
method: 'get',
|
||||
params: {
|
||||
limit: params?.limit || 25,
|
||||
offset: params?.offset || 0
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
112
src/renderer/components/common/AlbumItem.vue
Normal file
112
src/renderer/components/common/AlbumItem.vue
Normal file
@@ -0,0 +1,112 @@
|
||||
<template>
|
||||
<div class="album-item" @click="handleClick">
|
||||
<n-image
|
||||
:src="getImgUrl(item.picUrl || '', '100y100')"
|
||||
class="album-item-img"
|
||||
lazy
|
||||
preview-disabled
|
||||
/>
|
||||
<div class="album-item-info">
|
||||
<div class="album-item-name">
|
||||
<n-ellipsis :line-clamp="1">{{ item.name }}</n-ellipsis>
|
||||
</div>
|
||||
<div class="album-item-desc">
|
||||
{{ getDescription() }}
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="showCount && item.count" class="album-item-count">
|
||||
{{ item.count }}
|
||||
</div>
|
||||
<div v-if="showDelete" class="album-item-delete" @click.stop="handleDelete">
|
||||
<i class="iconfont icon-close"></i>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { useI18n } from 'vue-i18n';
|
||||
|
||||
import type { AlbumHistoryItem } from '@/hooks/AlbumHistoryHook';
|
||||
import { getImgUrl } from '@/utils';
|
||||
|
||||
interface Props {
|
||||
item: AlbumHistoryItem;
|
||||
showCount?: boolean;
|
||||
showDelete?: boolean;
|
||||
}
|
||||
|
||||
const props = withDefaults(defineProps<Props>(), {
|
||||
showCount: false,
|
||||
showDelete: false
|
||||
});
|
||||
|
||||
const emit = defineEmits<{
|
||||
click: [item: AlbumHistoryItem];
|
||||
delete: [item: AlbumHistoryItem];
|
||||
}>();
|
||||
|
||||
const { t } = useI18n();
|
||||
|
||||
const getDescription = () => {
|
||||
const parts: string[] = [];
|
||||
|
||||
if (props.item.artist?.name) {
|
||||
parts.push(props.item.artist.name);
|
||||
}
|
||||
|
||||
if (props.item.size !== undefined) {
|
||||
parts.push(t('user.album.songCount', { count: props.item.size }));
|
||||
}
|
||||
|
||||
return parts.join(' · ') || t('history.noDescription');
|
||||
};
|
||||
|
||||
const handleClick = () => {
|
||||
emit('click', props.item);
|
||||
};
|
||||
|
||||
const handleDelete = () => {
|
||||
emit('delete', props.item);
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.album-item {
|
||||
@apply flex items-center px-2 py-2 rounded-xl cursor-pointer;
|
||||
@apply transition-all duration-200;
|
||||
@apply bg-light-100 dark:bg-dark-100;
|
||||
@apply hover:bg-light-200 dark:hover:bg-dark-200;
|
||||
@apply mb-2;
|
||||
|
||||
&-img {
|
||||
@apply flex items-center justify-center rounded-xl;
|
||||
@apply w-[60px] h-[60px] flex-shrink-0;
|
||||
@apply bg-light-300 dark:bg-dark-300;
|
||||
}
|
||||
|
||||
&-info {
|
||||
@apply ml-3 flex-1 min-w-0;
|
||||
}
|
||||
|
||||
&-name {
|
||||
@apply text-gray-900 dark:text-white text-base mb-1;
|
||||
}
|
||||
|
||||
&-desc {
|
||||
@apply text-sm text-gray-500 dark:text-gray-400;
|
||||
}
|
||||
|
||||
&-count {
|
||||
@apply px-4 text-lg text-center min-w-[60px];
|
||||
@apply text-gray-600 dark:text-gray-400;
|
||||
}
|
||||
|
||||
&-delete {
|
||||
@apply cursor-pointer rounded-full border-2 w-8 h-8 flex justify-center items-center;
|
||||
@apply border-gray-400 dark:border-gray-600;
|
||||
@apply text-gray-600 dark:text-gray-400;
|
||||
@apply hover:border-red-500 hover:text-red-500;
|
||||
@apply transition-all;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -19,8 +19,12 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { useI18n } from 'vue-i18n';
|
||||
|
||||
import type { IBilibiliSearchResult } from '@/types/bilibili';
|
||||
|
||||
const { t } = useI18n();
|
||||
|
||||
const props = defineProps<{
|
||||
item: IBilibiliSearchResult;
|
||||
}>();
|
||||
@@ -39,7 +43,7 @@ const handleClick = () => {
|
||||
const formatNumber = (num?: number) => {
|
||||
if (!num) return '0';
|
||||
if (num >= 10000) {
|
||||
return `${(num / 10000).toFixed(1)}万`;
|
||||
return `${(num / 10000).toFixed(1)}${t('bilibili.player.num')}`;
|
||||
}
|
||||
return num.toString();
|
||||
};
|
||||
|
||||
@@ -21,8 +21,13 @@ export function navigateToMusicList(
|
||||
const musicStore = useMusicStore();
|
||||
const { id, type, name, songList, listInfo, canRemove = false } = options;
|
||||
|
||||
// 保存数据到状态管理
|
||||
musicStore.setCurrentMusicList(songList, name, listInfo, canRemove);
|
||||
// 如果是每日推荐,不需要设置 musicStore,直接从 recommendStore 获取
|
||||
if (type !== 'dailyRecommend') {
|
||||
musicStore.setCurrentMusicList(songList, name, listInfo, canRemove);
|
||||
} else {
|
||||
// 确保 musicStore 的数据被清空,避免显示旧的列表
|
||||
musicStore.clearCurrentMusicList();
|
||||
}
|
||||
|
||||
// 路由跳转
|
||||
if (id) {
|
||||
@@ -33,7 +38,8 @@ export function navigateToMusicList(
|
||||
});
|
||||
} else {
|
||||
router.push({
|
||||
name: 'musicList'
|
||||
name: 'musicList',
|
||||
query: { type: 'dailyRecommend' }
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -117,6 +117,7 @@ import { createPlaylist, updatePlaylistTracks } from '@/api/music';
|
||||
import { getUserPlaylist } from '@/api/user';
|
||||
import { useUserStore } from '@/store';
|
||||
import { getImgUrl } from '@/utils';
|
||||
import { getLoginErrorMessage, hasPermission } from '@/utils/auth';
|
||||
|
||||
const store = useUserStore();
|
||||
const { t } = useI18n();
|
||||
@@ -160,6 +161,13 @@ const fetchUserPlaylists = async () => {
|
||||
return;
|
||||
}
|
||||
|
||||
// 检查是否有真实登录权限
|
||||
if (!hasPermission(true)) {
|
||||
message.error(getLoginErrorMessage(true));
|
||||
emit('update:modelValue', false);
|
||||
return;
|
||||
}
|
||||
|
||||
const res = await getUserPlaylist(user.userId, 999);
|
||||
if (res.data?.playlist) {
|
||||
playlists.value = res.data.playlist.filter((item: any) => item.userId === user.userId);
|
||||
@@ -173,6 +181,13 @@ const fetchUserPlaylists = async () => {
|
||||
// 添加到歌单
|
||||
const handleAddToPlaylist = async (playlist: any) => {
|
||||
if (!props.songId) return;
|
||||
|
||||
// 检查是否有真实登录权限
|
||||
if (!hasPermission(true)) {
|
||||
message.error(getLoginErrorMessage(true));
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
const res = await updatePlaylistTracks({
|
||||
op: 'add',
|
||||
@@ -200,6 +215,12 @@ const handleCreatePlaylist = async () => {
|
||||
return;
|
||||
}
|
||||
|
||||
// 检查是否有真实登录权限
|
||||
if (!hasPermission(true)) {
|
||||
message.error(getLoginErrorMessage(true));
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
creating.value = true;
|
||||
|
||||
|
||||
112
src/renderer/components/common/PlaylistItem.vue
Normal file
112
src/renderer/components/common/PlaylistItem.vue
Normal file
@@ -0,0 +1,112 @@
|
||||
<template>
|
||||
<div class="playlist-item" @click="handleClick">
|
||||
<n-image
|
||||
:src="getImgUrl(item.coverImgUrl || item.picUrl || '', '100y100')"
|
||||
class="playlist-item-img"
|
||||
lazy
|
||||
preview-disabled
|
||||
/>
|
||||
<div class="playlist-item-info">
|
||||
<div class="playlist-item-name">
|
||||
<n-ellipsis :line-clamp="1">{{ item.name }}</n-ellipsis>
|
||||
</div>
|
||||
<div class="playlist-item-desc">
|
||||
{{ getDescription() }}
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="showCount && item.count" class="playlist-item-count">
|
||||
{{ item.count }}
|
||||
</div>
|
||||
<div v-if="showDelete" class="playlist-item-delete" @click.stop="handleDelete">
|
||||
<i class="iconfont icon-close"></i>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { useI18n } from 'vue-i18n';
|
||||
|
||||
import type { PlaylistHistoryItem } from '@/hooks/PlaylistHistoryHook';
|
||||
import { getImgUrl } from '@/utils';
|
||||
|
||||
interface Props {
|
||||
item: PlaylistHistoryItem;
|
||||
showCount?: boolean;
|
||||
showDelete?: boolean;
|
||||
}
|
||||
|
||||
const props = withDefaults(defineProps<Props>(), {
|
||||
showCount: false,
|
||||
showDelete: false
|
||||
});
|
||||
|
||||
const emit = defineEmits<{
|
||||
click: [item: PlaylistHistoryItem];
|
||||
delete: [item: PlaylistHistoryItem];
|
||||
}>();
|
||||
|
||||
const { t } = useI18n();
|
||||
|
||||
const getDescription = () => {
|
||||
const parts: string[] = [];
|
||||
|
||||
if (props.item.trackCount !== undefined) {
|
||||
parts.push(t('user.playlist.trackCount', { count: props.item.trackCount }));
|
||||
}
|
||||
|
||||
if (props.item.creator?.nickname) {
|
||||
parts.push(props.item.creator.nickname);
|
||||
}
|
||||
|
||||
return parts.join(' · ') || t('history.noDescription');
|
||||
};
|
||||
|
||||
const handleClick = () => {
|
||||
emit('click', props.item);
|
||||
};
|
||||
|
||||
const handleDelete = () => {
|
||||
emit('delete', props.item);
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.playlist-item {
|
||||
@apply flex items-center px-2 py-2 rounded-xl cursor-pointer;
|
||||
@apply transition-all duration-200;
|
||||
@apply bg-light-100 dark:bg-dark-100;
|
||||
@apply hover:bg-light-200 dark:hover:bg-dark-200;
|
||||
@apply mb-2;
|
||||
|
||||
&-img {
|
||||
@apply flex items-center justify-center rounded-xl;
|
||||
@apply w-[60px] h-[60px] flex-shrink-0;
|
||||
@apply bg-light-300 dark:bg-dark-300;
|
||||
}
|
||||
|
||||
&-info {
|
||||
@apply ml-3 flex-1 min-w-0;
|
||||
}
|
||||
|
||||
&-name {
|
||||
@apply text-gray-900 dark:text-white text-base mb-1;
|
||||
}
|
||||
|
||||
&-desc {
|
||||
@apply text-sm text-gray-500 dark:text-gray-400;
|
||||
}
|
||||
|
||||
&-count {
|
||||
@apply px-4 text-lg text-center min-w-[60px];
|
||||
@apply text-gray-600 dark:text-gray-400;
|
||||
}
|
||||
|
||||
&-delete {
|
||||
@apply cursor-pointer rounded-full border-2 w-8 h-8 flex justify-center items-center;
|
||||
@apply border-gray-400 dark:border-gray-600;
|
||||
@apply text-gray-600 dark:text-gray-400;
|
||||
@apply hover:border-red-500 hover:text-red-500;
|
||||
@apply transition-all;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -34,7 +34,7 @@
|
||||
<template #content>
|
||||
<div class="song-item-content-compact">
|
||||
<div class="song-item-content-compact-wrapper">
|
||||
<div class="song-item-content-compact-title w-60 flex-shrink-0">
|
||||
<div class="song-item-content-compact-title">
|
||||
<n-ellipsis
|
||||
class="text-ellipsis"
|
||||
line-clamp="1"
|
||||
@@ -197,26 +197,26 @@ const formatDuration = (ms: number): string => {
|
||||
}
|
||||
|
||||
.song-item-content-compact {
|
||||
@apply flex-1 flex items-center gap-4;
|
||||
@apply flex-1 flex items-center gap-2;
|
||||
|
||||
&-wrapper {
|
||||
@apply flex-1 min-w-0 flex items-center;
|
||||
@apply flex-[2] flex items-center gap-2 min-w-0;
|
||||
}
|
||||
|
||||
&-title {
|
||||
@apply text-sm cursor-pointer text-gray-900 dark:text-white flex items-center;
|
||||
@apply flex-[2.5] min-w-0 text-sm cursor-pointer text-gray-900 dark:text-white;
|
||||
}
|
||||
|
||||
&-artist {
|
||||
@apply w-40 text-sm text-gray-500 dark:text-gray-400 ml-2 flex items-center;
|
||||
@apply flex-[1.5] min-w-0 text-sm text-gray-500 dark:text-gray-400;
|
||||
}
|
||||
|
||||
&-album {
|
||||
@apply w-32 flex items-center text-sm text-gray-500 dark:text-gray-400;
|
||||
@apply flex-[1.5] min-w-0 text-sm text-gray-500 dark:text-gray-400;
|
||||
}
|
||||
|
||||
&-duration {
|
||||
@apply w-16 flex items-center text-sm text-gray-500 dark:text-gray-400 text-right;
|
||||
@apply w-14 flex-shrink-0 text-sm text-gray-500 dark:text-gray-400 justify-end;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -21,6 +21,7 @@ import { useI18n } from 'vue-i18n';
|
||||
|
||||
import type { SongResult } from '@/types/music';
|
||||
import { getImgUrl, isElectron } from '@/utils';
|
||||
import { hasPermission } from '@/utils/auth';
|
||||
|
||||
const { t } = useI18n();
|
||||
|
||||
@@ -121,6 +122,8 @@ const renderSongPreview = () => {
|
||||
|
||||
// 下拉菜单选项
|
||||
const dropdownOptions = computed<MenuOption[]>(() => {
|
||||
const hasRealAuth = hasPermission(true);
|
||||
|
||||
const options: MenuOption[] = [
|
||||
{
|
||||
key: 'header',
|
||||
@@ -153,7 +156,8 @@ const dropdownOptions = computed<MenuOption[]>(() => {
|
||||
{
|
||||
label: t('songItem.menu.addToPlaylist'),
|
||||
key: 'addToPlaylist',
|
||||
icon: () => h('i', { class: 'iconfont ri-folder-add-line' })
|
||||
icon: () => h('i', { class: 'iconfont ri-folder-add-line' }),
|
||||
disabled: !hasRealAuth
|
||||
},
|
||||
{
|
||||
label: props.isFavorite ? t('songItem.menu.unfavorite') : t('songItem.menu.favorite'),
|
||||
@@ -162,6 +166,7 @@ const dropdownOptions = computed<MenuOption[]>(() => {
|
||||
h('i', {
|
||||
class: `iconfont ${props.isFavorite ? 'ri-heart-fill text-red-500' : 'ri-heart-line'}`
|
||||
})
|
||||
// 收藏功能不禁用,UID登录时可以本地收藏/取消收藏
|
||||
},
|
||||
{
|
||||
label: props.isDislike ? t('songItem.menu.undislike') : t('songItem.menu.dislike'),
|
||||
|
||||
205
src/renderer/components/cover/Cover3D.vue
Normal file
205
src/renderer/components/cover/Cover3D.vue
Normal file
@@ -0,0 +1,205 @@
|
||||
<template>
|
||||
<div
|
||||
ref="coverContainer"
|
||||
class="cover-3d-container relative cursor-pointer"
|
||||
@mousemove="handleMouseMove"
|
||||
@mouseleave="handleMouseLeave"
|
||||
@mouseenter="handleMouseEnter"
|
||||
>
|
||||
<div ref="coverImage" class="cover-wrapper" :style="coverTransformStyle">
|
||||
<n-image :src="src" class="cover-image" lazy preview-disabled :object-fit="objectFit" />
|
||||
<div class="cover-shine" :style="shineStyle"></div>
|
||||
</div>
|
||||
<div v-if="loading" class="loading-overlay">
|
||||
<i class="ri-loader-4-line loading-icon"></i>
|
||||
</div>
|
||||
<slot />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { computed, onBeforeUnmount, ref } from 'vue';
|
||||
|
||||
interface Props {
|
||||
src: string;
|
||||
loading?: boolean;
|
||||
maxTilt?: number;
|
||||
scale?: number;
|
||||
shineIntensity?: number;
|
||||
objectFit?: 'cover' | 'contain' | 'fill' | 'scale-down' | 'none';
|
||||
disabled?: boolean;
|
||||
}
|
||||
|
||||
const props = withDefaults(defineProps<Props>(), {
|
||||
loading: false,
|
||||
maxTilt: 12,
|
||||
scale: 1.03,
|
||||
shineIntensity: 0.25,
|
||||
objectFit: 'cover',
|
||||
disabled: false
|
||||
});
|
||||
|
||||
// 3D视差效果相关
|
||||
const coverContainer = ref<HTMLElement | null>(null);
|
||||
const coverImage = ref<HTMLElement | null>(null);
|
||||
const mouseX = ref(0.5);
|
||||
const mouseY = ref(0.5);
|
||||
const isHovering = ref(false);
|
||||
const rafId = ref<number | null>(null);
|
||||
|
||||
// 3D视差效果计算
|
||||
const coverTransformStyle = computed(() => {
|
||||
if (!isHovering.value || props.disabled) {
|
||||
return {
|
||||
transform: 'perspective(1000px) rotateX(0deg) rotateY(0deg) scale(1)',
|
||||
transition: 'transform 0.4s cubic-bezier(0.4, 0, 0.2, 1)'
|
||||
};
|
||||
}
|
||||
|
||||
const tiltX = Math.round((mouseY.value - 0.5) * props.maxTilt * 100) / 100;
|
||||
const tiltY = Math.round((mouseX.value - 0.5) * -props.maxTilt * 100) / 100;
|
||||
|
||||
return {
|
||||
transform: `perspective(1000px) rotateX(${tiltX}deg) rotateY(${tiltY}deg) scale(${props.scale})`,
|
||||
transition: 'none'
|
||||
};
|
||||
});
|
||||
|
||||
// 光泽效果计算
|
||||
const shineStyle = computed(() => {
|
||||
if (!isHovering.value || props.disabled) {
|
||||
return {
|
||||
opacity: 0,
|
||||
background: 'transparent',
|
||||
transition: 'opacity 0.3s ease-out'
|
||||
};
|
||||
}
|
||||
|
||||
const shineX = Math.round(mouseX.value * 100);
|
||||
const shineY = Math.round(mouseY.value * 100);
|
||||
|
||||
return {
|
||||
opacity: props.shineIntensity,
|
||||
background: `radial-gradient(200px circle at ${shineX}% ${shineY}%, rgba(255,255,255,0.3), transparent 50%)`,
|
||||
transition: 'none'
|
||||
};
|
||||
});
|
||||
|
||||
// 使用 requestAnimationFrame 优化鼠标事件
|
||||
const updateMousePosition = (x: number, y: number) => {
|
||||
if (rafId.value) {
|
||||
cancelAnimationFrame(rafId.value);
|
||||
}
|
||||
|
||||
rafId.value = requestAnimationFrame(() => {
|
||||
// 只在位置有显著变化时更新,减少不必要的重绘
|
||||
const deltaX = Math.abs(mouseX.value - x);
|
||||
const deltaY = Math.abs(mouseY.value - y);
|
||||
|
||||
if (deltaX > 0.01 || deltaY > 0.01) {
|
||||
mouseX.value = x;
|
||||
mouseY.value = y;
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
// 3D视差效果的鼠标事件处理
|
||||
const handleMouseMove = (event: MouseEvent) => {
|
||||
if (!coverContainer.value || !isHovering.value || props.disabled) return;
|
||||
|
||||
const rect = coverContainer.value.getBoundingClientRect();
|
||||
const x = Math.max(0, Math.min(1, (event.clientX - rect.left) / rect.width));
|
||||
const y = Math.max(0, Math.min(1, (event.clientY - rect.top) / rect.height));
|
||||
|
||||
updateMousePosition(x, y);
|
||||
};
|
||||
|
||||
const handleMouseEnter = () => {
|
||||
if (!props.disabled) {
|
||||
isHovering.value = true;
|
||||
}
|
||||
};
|
||||
|
||||
const handleMouseLeave = () => {
|
||||
isHovering.value = false;
|
||||
if (rafId.value) {
|
||||
cancelAnimationFrame(rafId.value);
|
||||
rafId.value = null;
|
||||
}
|
||||
// 平滑回到中心位置
|
||||
updateMousePosition(0.5, 0.5);
|
||||
};
|
||||
|
||||
// 清理资源
|
||||
onBeforeUnmount(() => {
|
||||
if (rafId.value) {
|
||||
cancelAnimationFrame(rafId.value);
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.cover-3d-container {
|
||||
@apply w-full h-full;
|
||||
}
|
||||
|
||||
/* 3D视差效果样式 */
|
||||
.cover-wrapper {
|
||||
@apply relative w-full h-full rounded-xl overflow-hidden;
|
||||
transform-style: preserve-3d;
|
||||
will-change: transform;
|
||||
backface-visibility: hidden;
|
||||
transform: translateZ(0); /* 强制硬件加速 */
|
||||
}
|
||||
|
||||
.cover-image {
|
||||
@apply w-full h-full;
|
||||
border-radius: inherit;
|
||||
transform: translateZ(0); /* 强制硬件加速 */
|
||||
}
|
||||
|
||||
.cover-shine {
|
||||
@apply absolute inset-0 pointer-events-none rounded-xl;
|
||||
mix-blend-mode: overlay;
|
||||
z-index: 1;
|
||||
will-change: background, opacity;
|
||||
backface-visibility: hidden;
|
||||
}
|
||||
|
||||
/* 为封面容器添加阴影效果 */
|
||||
.cover-3d-container:hover .cover-wrapper {
|
||||
filter: drop-shadow(0 15px 30px rgba(0, 0, 0, 0.25));
|
||||
}
|
||||
|
||||
@keyframes spin {
|
||||
0% {
|
||||
transform: rotate(0deg);
|
||||
}
|
||||
100% {
|
||||
transform: rotate(360deg);
|
||||
}
|
||||
}
|
||||
|
||||
.loading-overlay {
|
||||
@apply absolute inset-0 flex items-center justify-center rounded-xl;
|
||||
background-color: rgba(0, 0, 0, 0.5);
|
||||
z-index: 2;
|
||||
}
|
||||
|
||||
.loading-icon {
|
||||
font-size: 48px;
|
||||
color: white;
|
||||
animation: spin 1s linear infinite;
|
||||
}
|
||||
|
||||
/* 移动端禁用3D效果 */
|
||||
@media (max-width: 768px) {
|
||||
.cover-wrapper {
|
||||
transform: none !important;
|
||||
}
|
||||
|
||||
.cover-shine {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -130,14 +130,13 @@ import { computed, onMounted, ref, watchEffect } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useRouter } from 'vue-router';
|
||||
|
||||
import { getDayRecommend, getHotSinger } from '@/api/home';
|
||||
import { getHotSinger } from '@/api/home';
|
||||
import { getListDetail } from '@/api/list';
|
||||
import { getMusicDetail } from '@/api/music';
|
||||
import { getUserPlaylist } from '@/api/user';
|
||||
import { navigateToMusicList } from '@/components/common/MusicListNavigator';
|
||||
import { useArtist } from '@/hooks/useArtist';
|
||||
import { usePlayerStore, useUserStore } from '@/store';
|
||||
import { IDayRecommend } from '@/types/day_recommend';
|
||||
import { usePlayerStore, useRecommendStore, useUserStore } from '@/store';
|
||||
import { Playlist } from '@/types/list';
|
||||
import type { IListDetail } from '@/types/listDetail';
|
||||
import { SongResult } from '@/types/music';
|
||||
@@ -152,13 +151,21 @@ import {
|
||||
|
||||
const userStore = useUserStore();
|
||||
const playerStore = usePlayerStore();
|
||||
const recommendStore = useRecommendStore();
|
||||
const router = useRouter();
|
||||
|
||||
const { t } = useI18n();
|
||||
|
||||
// 歌手信息
|
||||
const hotSingerData = ref<IHotSinger>();
|
||||
const dayRecommendData = ref<IDayRecommend>();
|
||||
const dayRecommendData = computed(() => {
|
||||
if (recommendStore.dailyRecommendSongs.length > 0) {
|
||||
return {
|
||||
dailySongs: recommendStore.dailyRecommendSongs
|
||||
};
|
||||
}
|
||||
return null;
|
||||
});
|
||||
const userPlaylist = ref<Playlist[]>([]);
|
||||
|
||||
// 为歌单弹窗添加的状态
|
||||
@@ -230,22 +237,8 @@ onMounted(async () => {
|
||||
loadNonUserData();
|
||||
});
|
||||
|
||||
// 提取每日推荐加载逻辑到单独的函数
|
||||
const loadDayRecommendData = async () => {
|
||||
try {
|
||||
const {
|
||||
data: { data: dayRecommend }
|
||||
} = await getDayRecommend();
|
||||
const dayRecommendSource = dayRecommend as unknown as IDayRecommend;
|
||||
dayRecommendData.value = {
|
||||
...dayRecommendSource,
|
||||
dailySongs: dayRecommendSource.dailySongs.filter(
|
||||
(song: any) => !playerStore.dislikeList.includes(song.id)
|
||||
)
|
||||
};
|
||||
} catch (error) {
|
||||
console.error('获取每日推荐失败:', error);
|
||||
}
|
||||
await recommendStore.fetchDailyRecommendSongs();
|
||||
};
|
||||
|
||||
// 加载不需要登录的数据
|
||||
|
||||
@@ -9,24 +9,22 @@
|
||||
>
|
||||
<div id="drawer-target" :class="[config.theme]">
|
||||
<div
|
||||
class="control-btn absolute top-8 left-8"
|
||||
class="control-buttons-container absolute top-8 left-8 right-8"
|
||||
:class="{ 'pure-mode': config.pureModeEnabled }"
|
||||
@click="closeMusicFull"
|
||||
>
|
||||
<i class="ri-arrow-down-s-line"></i>
|
||||
</div>
|
||||
<div class="control-btn" @click="closeMusicFull">
|
||||
<i class="ri-arrow-down-s-line"></i>
|
||||
</div>
|
||||
|
||||
<n-popover trigger="click" placement="bottom">
|
||||
<template #trigger>
|
||||
<div
|
||||
class="control-btn absolute top-8 right-8"
|
||||
:class="{ 'pure-mode': config.pureModeEnabled }"
|
||||
>
|
||||
<i class="ri-settings-3-line"></i>
|
||||
</div>
|
||||
</template>
|
||||
<lyric-settings ref="lyricSettingsRef" />
|
||||
</n-popover>
|
||||
<n-popover trigger="click" placement="bottom">
|
||||
<template #trigger>
|
||||
<div class="control-btn">
|
||||
<i class="ri-settings-3-line"></i>
|
||||
</div>
|
||||
</template>
|
||||
<lyric-settings ref="lyricSettingsRef" />
|
||||
</n-popover>
|
||||
</div>
|
||||
|
||||
<div
|
||||
v-if="!config.hideCover"
|
||||
@@ -34,20 +32,18 @@
|
||||
:class="{ 'only-cover': config.hideLyrics }"
|
||||
:style="{ color: textColors.theme === 'dark' ? '#000000' : '#ffffff' }"
|
||||
>
|
||||
<div class="img-container relative">
|
||||
<n-image
|
||||
<div class="img-container">
|
||||
<cover3-d
|
||||
ref="PicImgRef"
|
||||
:src="getImgUrl(playMusic?.picUrl, '500y500')"
|
||||
class="img"
|
||||
lazy
|
||||
preview-disabled
|
||||
:loading="playMusic?.playLoading"
|
||||
:max-tilt="12"
|
||||
:scale="1.03"
|
||||
:shine-intensity="0.25"
|
||||
/>
|
||||
<div v-if="playMusic?.playLoading" class="loading-overlay">
|
||||
<i class="ri-loader-4-line loading-icon"></i>
|
||||
</div>
|
||||
</div>
|
||||
<div class="music-info">
|
||||
<div class="music-content-name">{{ playMusic.name }}</div>
|
||||
<div class="music-content-name" v-html="playMusic.name"></div>
|
||||
<div class="music-content-singer">
|
||||
<n-ellipsis
|
||||
class="text-ellipsis"
|
||||
@@ -102,7 +98,7 @@
|
||||
class="music-info-header"
|
||||
:style="{ textAlign: config.centerLyrics ? 'center' : 'left' }"
|
||||
>
|
||||
<div class="music-info-name">{{ playMusic.name }}</div>
|
||||
<div class="music-info-name" v-html="playMusic.name"></div>
|
||||
<div class="music-info-singer">
|
||||
<span
|
||||
v-for="(item, index) in artistList"
|
||||
@@ -115,15 +111,34 @@
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<!-- 无时间戳歌词提示 -->
|
||||
<div v-if="!supportAutoScroll" class="music-lrc-text no-scroll-tip">
|
||||
<span>{{ t('player.lrc.noAutoScroll') }}</span>
|
||||
</div>
|
||||
<div
|
||||
v-for="(item, index) in lrcArray"
|
||||
:id="`music-lrc-text-${index}`"
|
||||
:key="index"
|
||||
class="music-lrc-text"
|
||||
:class="{ 'now-text': index === nowIndex, 'hover-text': item.text }"
|
||||
@click="setAudioTime(index)"
|
||||
:class="{
|
||||
'now-text': index === nowIndex,
|
||||
'hover-text': item.text && item.startTime !== -1
|
||||
}"
|
||||
@click="item.startTime !== -1 ? setAudioTime(index) : null"
|
||||
>
|
||||
<span :style="getLrcStyle(index)">{{ item.text }}</span>
|
||||
<!-- 逐字歌词显示 -->
|
||||
<div
|
||||
v-if="item.hasWordByWord && item.words && item.words.length > 0"
|
||||
class="word-by-word-lyric"
|
||||
>
|
||||
<template v-for="(word, wordIndex) in item.words" :key="wordIndex">
|
||||
<span class="lyric-word" :style="getWordStyle(index, wordIndex, word)">
|
||||
{{ word.text }} </span
|
||||
><span class="lyric-word" v-if="word.space"> </span></template
|
||||
>
|
||||
</div>
|
||||
<!-- 普通歌词显示 -->
|
||||
<span v-else :style="getLrcStyle(index)">{{ item.text }}</span>
|
||||
<div v-show="config.showTranslation" class="music-lrc-text-tr">
|
||||
{{ item.trText }}
|
||||
</div>
|
||||
@@ -148,9 +163,10 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
import { useDebounceFn } from '@vueuse/core';
|
||||
import { computed, onBeforeUnmount, onMounted, ref, watch } from 'vue';
|
||||
import { computed, nextTick, onBeforeUnmount, onMounted, ref, watch } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
|
||||
import Cover3D from '@/components/cover/Cover3D.vue';
|
||||
import LyricCorrectionControl from '@/components/lyric/LyricCorrectionControl.vue';
|
||||
import LyricSettings from '@/components/lyric/LyricSettings.vue';
|
||||
import SimplePlayBar from '@/components/player/SimplePlayBar.vue';
|
||||
@@ -160,6 +176,7 @@ import {
|
||||
correctionTime,
|
||||
lrcArray,
|
||||
nowIndex,
|
||||
nowTime,
|
||||
playMusic,
|
||||
setAudioTime,
|
||||
textColors,
|
||||
@@ -182,11 +199,10 @@ const animationFrame = ref<number | null>(null);
|
||||
const isDark = ref(false);
|
||||
const showStickyHeader = ref(false);
|
||||
const lyricSettingsRef = ref<InstanceType<typeof LyricSettings>>();
|
||||
const isSongChanging = ref(false);
|
||||
|
||||
// 移除 computed 配置
|
||||
const config = ref<LyricConfig>({ ...DEFAULT_LYRIC_CONFIG });
|
||||
|
||||
// 监听设置组件的配置变化
|
||||
watch(
|
||||
() => lyricSettingsRef.value?.config,
|
||||
(newConfig) => {
|
||||
@@ -209,6 +225,10 @@ watch(
|
||||
{ deep: true }
|
||||
);
|
||||
|
||||
const supportAutoScroll = computed(() => {
|
||||
return lrcArray.value.length > 0 && lrcArray.value[0].startTime !== -1;
|
||||
});
|
||||
|
||||
const props = defineProps({
|
||||
modelValue: {
|
||||
type: Boolean,
|
||||
@@ -234,7 +254,7 @@ const isVisible = computed({
|
||||
|
||||
// 歌词滚动方法
|
||||
const lrcScroll = (behavior: ScrollBehavior = 'smooth', forceTop: boolean = false) => {
|
||||
if (!isVisible.value || !lrcSider.value) return;
|
||||
if (!isVisible.value || !lrcSider.value || !supportAutoScroll.value) return;
|
||||
|
||||
if (forceTop) {
|
||||
lrcSider.value.scrollTo({
|
||||
@@ -279,6 +299,8 @@ const mouseLeaveLayout = () => {
|
||||
};
|
||||
|
||||
watch(nowIndex, () => {
|
||||
// 歌曲切换时不自动滚动
|
||||
if (isSongChanging.value) return;
|
||||
debouncedLrcScroll();
|
||||
});
|
||||
|
||||
@@ -342,25 +364,30 @@ watch(
|
||||
{ immediate: true }
|
||||
);
|
||||
|
||||
// 修改 useLyricProgress 的使用方式
|
||||
const { getLrcStyle: originalLrcStyle } = useLyricProgress();
|
||||
|
||||
// 修改 getLrcStyle 函数
|
||||
const getLrcStyle = (index: number) => {
|
||||
const colors = textColors.value || getTextColors;
|
||||
const colors = textColors.value || getTextColors();
|
||||
const originalStyle = originalLrcStyle(index);
|
||||
|
||||
if (index === nowIndex.value) {
|
||||
// 当前播放的歌词,使用渐变效果
|
||||
return {
|
||||
...originalStyle,
|
||||
backgroundImage: originalStyle.backgroundImage
|
||||
?.replace(/#ffffff/g, colors.active)
|
||||
.replace(/#ffffff8a/g, `${colors.primary}`),
|
||||
backgroundClip: 'text',
|
||||
WebkitBackgroundClip: 'text',
|
||||
color: 'transparent'
|
||||
};
|
||||
// 当前播放的歌词
|
||||
if (originalStyle.backgroundImage) {
|
||||
// 有渐变进度时,使用渐变效果
|
||||
return {
|
||||
...originalStyle,
|
||||
backgroundImage: originalStyle.backgroundImage
|
||||
.replace(/#ffffff/g, colors.active)
|
||||
.replace(/#ffffff8a/g, `${colors.primary}`),
|
||||
backgroundClip: 'text',
|
||||
WebkitBackgroundClip: 'text',
|
||||
color: 'transparent'
|
||||
};
|
||||
} else {
|
||||
return {
|
||||
color: colors.primary
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
// 非当前播放的歌词,使用普通颜色
|
||||
@@ -369,6 +396,57 @@ const getLrcStyle = (index: number) => {
|
||||
};
|
||||
};
|
||||
|
||||
// 逐字歌词样式函数
|
||||
const getWordStyle = (lineIndex: number, _wordIndex: number, word: any) => {
|
||||
const colors = textColors.value || getTextColors();
|
||||
// 如果不是当前行,返回普通样式
|
||||
if (lineIndex !== nowIndex.value) {
|
||||
return {
|
||||
color: colors.primary,
|
||||
transition: 'color 0.3s ease',
|
||||
// 重置背景相关属性
|
||||
backgroundImage: 'none',
|
||||
WebkitTextFillColor: 'initial'
|
||||
};
|
||||
}
|
||||
|
||||
// 当前行的逐字效果,应用歌词矫正时间
|
||||
const currentTime = (nowTime.value + correctionTime.value) * 1000; // 转换为毫秒,确保与word时间单位一致
|
||||
|
||||
// 直接使用绝对时间比较
|
||||
const wordStartTime = word.startTime; // 单词开始的绝对时间(毫秒)
|
||||
const wordEndTime = word.startTime + word.duration;
|
||||
|
||||
if (currentTime >= wordStartTime && currentTime < wordEndTime) {
|
||||
// 当前正在播放的单词 - 使用渐变进度效果
|
||||
const progress = Math.min((currentTime - wordStartTime) / word.duration, 1);
|
||||
const progressPercent = Math.round(progress * 100);
|
||||
|
||||
return {
|
||||
backgroundImage: `linear-gradient(to right, ${colors.active} 0%, ${colors.active} ${progressPercent}%, ${colors.primary} ${progressPercent}%, ${colors.primary} 100%)`,
|
||||
backgroundClip: 'text',
|
||||
WebkitBackgroundClip: 'text',
|
||||
WebkitTextFillColor: 'transparent',
|
||||
textShadow: `0 0 8px ${colors.active}40`,
|
||||
transition: 'all 0.1s ease'
|
||||
};
|
||||
} else if (currentTime >= wordEndTime) {
|
||||
// 已经播放过的单词 - 纯色显示
|
||||
return {
|
||||
color: colors.active,
|
||||
WebkitTextFillColor: 'initial',
|
||||
transition: 'none'
|
||||
};
|
||||
} else {
|
||||
// 还未播放的单词 - 普通状态
|
||||
return {
|
||||
color: colors.primary,
|
||||
WebkitTextFillColor: 'initial',
|
||||
transition: 'none'
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
// 组件卸载时清理动画
|
||||
onBeforeUnmount(() => {
|
||||
if (animationFrame.value) {
|
||||
@@ -507,12 +585,24 @@ onMounted(() => {
|
||||
}
|
||||
});
|
||||
|
||||
// 添加对 playMusic 的监听
|
||||
watch(playMusic, () => {
|
||||
nextTick(() => {
|
||||
lrcScroll('instant', true);
|
||||
});
|
||||
});
|
||||
// 添加对 playMusic.id 的监听,歌曲切换时滚动到顶部
|
||||
watch(
|
||||
() => playMusic.value.id,
|
||||
(newId, oldId) => {
|
||||
// 只在歌曲真正切换时滚动到顶部
|
||||
if (newId !== oldId && newId) {
|
||||
isSongChanging.value = true;
|
||||
// 延迟滚动,确保 nowIndex 已重置
|
||||
setTimeout(() => {
|
||||
lrcScroll('instant', true);
|
||||
// 延迟恢复自动滚动,等待歌词数据更新
|
||||
setTimeout(() => {
|
||||
isSongChanging.value = false;
|
||||
}, 300);
|
||||
}, 100);
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
defineExpose({
|
||||
lrcScroll,
|
||||
@@ -525,10 +615,12 @@ defineExpose({
|
||||
0% {
|
||||
transform: rotate(0deg);
|
||||
}
|
||||
|
||||
100% {
|
||||
transform: rotate(360deg);
|
||||
}
|
||||
}
|
||||
|
||||
.drawer-back {
|
||||
@apply absolute bg-cover bg-center;
|
||||
z-index: -1;
|
||||
@@ -561,15 +653,11 @@ defineExpose({
|
||||
@apply w-[50vh] h-[50vh] mb-8;
|
||||
}
|
||||
|
||||
.img {
|
||||
@apply w-full h-full;
|
||||
}
|
||||
|
||||
.music-info {
|
||||
@apply text-center w-[600px];
|
||||
|
||||
.music-content-name {
|
||||
@apply text-4xl mb-4;
|
||||
@apply text-4xl mb-4 line-clamp-2;
|
||||
color: var(--text-color-active);
|
||||
}
|
||||
|
||||
@@ -584,10 +672,6 @@ defineExpose({
|
||||
@apply relative w-full h-full;
|
||||
}
|
||||
|
||||
.img {
|
||||
@apply rounded-xl w-full h-full shadow-2xl transition-all duration-300;
|
||||
}
|
||||
|
||||
.music-info {
|
||||
@apply w-full mt-4;
|
||||
|
||||
@@ -610,9 +694,11 @@ defineExpose({
|
||||
|
||||
&.center {
|
||||
@apply w-auto;
|
||||
|
||||
.music-lrc {
|
||||
@apply w-full max-w-3xl mx-auto;
|
||||
}
|
||||
|
||||
.music-lrc-text {
|
||||
@apply text-center;
|
||||
}
|
||||
@@ -630,6 +716,9 @@ defineExpose({
|
||||
|
||||
.music-lrc-container {
|
||||
padding-top: 30vh;
|
||||
.music-lrc-text:last-child {
|
||||
margin-bottom: 200px;
|
||||
}
|
||||
}
|
||||
|
||||
.music-lrc {
|
||||
@@ -650,7 +739,7 @@ defineExpose({
|
||||
@apply mb-8;
|
||||
|
||||
.music-info-name {
|
||||
@apply text-4xl font-bold mb-2;
|
||||
@apply text-4xl font-bold mb-2 line-clamp-2;
|
||||
color: var(--text-color-active);
|
||||
}
|
||||
|
||||
@@ -668,6 +757,20 @@ defineExpose({
|
||||
letter-spacing: var(--lyric-letter-spacing, 0) !important;
|
||||
line-height: var(--lyric-line-height, 2) !important;
|
||||
|
||||
&.no-scroll-tip {
|
||||
@apply text-base opacity-60 cursor-default py-2;
|
||||
color: var(--text-color-primary);
|
||||
font-weight: normal;
|
||||
|
||||
span {
|
||||
padding-right: 0;
|
||||
}
|
||||
|
||||
&:hover {
|
||||
background-color: transparent;
|
||||
}
|
||||
}
|
||||
|
||||
span {
|
||||
background-clip: text !important;
|
||||
-webkit-background-clip: text !important;
|
||||
@@ -679,6 +782,26 @@ defineExpose({
|
||||
opacity: 0.7;
|
||||
color: var(--text-color-primary);
|
||||
}
|
||||
|
||||
// 逐字歌词样式
|
||||
.word-by-word-lyric {
|
||||
@apply flex flex-wrap;
|
||||
|
||||
.lyric-word {
|
||||
@apply inline-block;
|
||||
padding-right: 0;
|
||||
font-weight: inherit;
|
||||
font-size: inherit;
|
||||
letter-spacing: inherit;
|
||||
line-height: inherit;
|
||||
cursor: inherit;
|
||||
position: relative;
|
||||
|
||||
&:hover {
|
||||
background-color: rgba(255, 255, 255, 0.1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.hover-text {
|
||||
@@ -697,24 +820,30 @@ defineExpose({
|
||||
.mobile {
|
||||
#drawer-target {
|
||||
@apply flex-col p-4 pt-8 justify-start;
|
||||
|
||||
.music-img {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.music-lrc {
|
||||
height: calc(100vh - 260px) !important;
|
||||
width: 100vw;
|
||||
|
||||
span {
|
||||
padding-right: 0px !important;
|
||||
}
|
||||
|
||||
.hover-text {
|
||||
&:hover {
|
||||
background-color: transparent;
|
||||
}
|
||||
}
|
||||
|
||||
.music-lrc-text {
|
||||
@apply text-xl text-center;
|
||||
}
|
||||
}
|
||||
|
||||
.music-content {
|
||||
@apply h-[calc(100vh-120px)];
|
||||
width: 100vw !important;
|
||||
@@ -751,8 +880,30 @@ defineExpose({
|
||||
}
|
||||
}
|
||||
|
||||
.control-buttons-container {
|
||||
@apply flex justify-between items-start z-[9999];
|
||||
|
||||
&.pure-mode {
|
||||
@apply pointer-events-auto; /* 容器需要能接收hover事件 */
|
||||
|
||||
.control-btn {
|
||||
@apply opacity-0 transition-all duration-300;
|
||||
pointer-events: none; /* 按钮隐藏时不接收事件 */
|
||||
}
|
||||
|
||||
&:hover .control-btn {
|
||||
@apply opacity-100;
|
||||
pointer-events: auto; /* hover时按钮可以点击 */
|
||||
}
|
||||
}
|
||||
|
||||
&:not(.pure-mode) .control-btn {
|
||||
pointer-events: auto;
|
||||
}
|
||||
}
|
||||
|
||||
.control-btn {
|
||||
@apply w-9 h-9 flex items-center justify-center rounded cursor-pointer transition-all duration-300 z-[9999];
|
||||
@apply w-9 h-9 flex items-center justify-center rounded cursor-pointer transition-all duration-300;
|
||||
background: rgba(142, 142, 142, 0.192);
|
||||
backdrop-filter: blur(12px);
|
||||
|
||||
@@ -761,48 +912,16 @@ defineExpose({
|
||||
color: var(--text-color-active);
|
||||
}
|
||||
|
||||
&.pure-mode {
|
||||
background: transparent;
|
||||
backdrop-filter: none;
|
||||
|
||||
&:not(:hover) {
|
||||
i {
|
||||
opacity: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&:hover {
|
||||
background: rgba(126, 121, 121, 0.2);
|
||||
|
||||
i {
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes spin {
|
||||
0% {
|
||||
transform: rotate(0deg);
|
||||
}
|
||||
100% {
|
||||
transform: rotate(360deg);
|
||||
}
|
||||
}
|
||||
|
||||
.loading-overlay {
|
||||
@apply absolute inset-0 flex items-center justify-center rounded-xl;
|
||||
background-color: rgba(0, 0, 0, 0.5);
|
||||
z-index: 2;
|
||||
}
|
||||
|
||||
.loading-icon {
|
||||
font-size: 48px;
|
||||
color: white;
|
||||
animation: spin 1s linear infinite;
|
||||
}
|
||||
|
||||
.lyric-correction {
|
||||
/* 仅在 hover 歌词区域时显示 */
|
||||
.music-lrc:hover & {
|
||||
opacity: 1 !important;
|
||||
pointer-events: auto !important;
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
<transition name="fade">
|
||||
<div v-if="showFullLyrics && !isLandscape" class="fullscreen-lyrics" :class="config.theme">
|
||||
<div class="fullscreen-header">
|
||||
<div class="song-title">{{ playMusic.name }}</div>
|
||||
<div class="song-title" v-html="playMusic.name"></div>
|
||||
<div class="artist-name">
|
||||
<span v-for="(item, index) in artistList" :key="index">
|
||||
{{ item.name }}{{ index < artistList.length - 1 ? ' / ' : '' }}
|
||||
@@ -49,15 +49,34 @@
|
||||
@scroll="handleScroll"
|
||||
>
|
||||
<div class="lyrics-padding-top"></div>
|
||||
<!-- 无时间戳歌词提示 -->
|
||||
<div v-if="!supportAutoScroll" class="lyric-line no-scroll-tip">
|
||||
<span>{{ t('player.lrc.noAutoScroll') }}</span>
|
||||
</div>
|
||||
<div
|
||||
v-for="(item, index) in lrcArray"
|
||||
:key="index"
|
||||
:id="`lyric-line-${index}`"
|
||||
class="lyric-line"
|
||||
:class="{ 'now-text': index === nowIndex, 'hover-text': item.text }"
|
||||
@click="jumpToLyricTime(index)"
|
||||
:class="{
|
||||
'now-text': index === nowIndex,
|
||||
'hover-text': item.text && item.startTime !== -1
|
||||
}"
|
||||
@click="item.startTime !== -1 ? setAudioTime(index) : null"
|
||||
>
|
||||
<span :style="getLrcStyle(index)">{{ item.text }}</span>
|
||||
<!-- 逐字歌词显示 -->
|
||||
<div
|
||||
v-if="item.hasWordByWord && item.words && item.words.length > 0"
|
||||
class="word-by-word-lyric"
|
||||
>
|
||||
<template v-for="(word, wordIndex) in item.words" :key="wordIndex">
|
||||
<span class="lyric-word" :style="getWordStyle(index, wordIndex, word)">
|
||||
{{ word.text }} </span
|
||||
><span class="lyric-word" v-if="word.space"> </span></template
|
||||
>
|
||||
</div>
|
||||
<!-- 普通歌词显示 -->
|
||||
<span v-else :style="getLrcStyle(index)">{{ item.text }}</span>
|
||||
<div v-if="config.showTranslation && item.trText" class="translation">
|
||||
{{ item.trText }}
|
||||
</div>
|
||||
@@ -97,7 +116,7 @@
|
||||
<!-- 歌曲信息 -->
|
||||
<div class="song-info">
|
||||
<div class="song-title-container">
|
||||
<h1 class="song-title">{{ playMusic.name }}</h1>
|
||||
<h1 class="song-title" v-html="playMusic.name"></h1>
|
||||
</div>
|
||||
<p class="song-artist">
|
||||
<span
|
||||
@@ -119,7 +138,22 @@
|
||||
<div class="lyrics-container" v-if="!config.hideLyrics" @click="showFullLyricScreen">
|
||||
<div v-if="lrcArray.length > 0" class="lyrics-wrapper">
|
||||
<div v-for="(line, idx) in visibleLyrics" :key="idx" class="lyric-line">
|
||||
{{ line.text }}
|
||||
<!-- 逐字歌词显示 -->
|
||||
<div
|
||||
v-if="line.hasWordByWord && line.words && line.words.length > 0"
|
||||
class="word-by-word-lyric"
|
||||
>
|
||||
<template v-for="(word, wordIndex) in line.words" :key="wordIndex">
|
||||
<span
|
||||
class="lyric-word"
|
||||
:style="getWordStyle(line.originalIndex, wordIndex, word)"
|
||||
>
|
||||
{{ word.text }}</span
|
||||
><span v-if="word.space"> </span></template
|
||||
>
|
||||
</div>
|
||||
<!-- 普通歌词显示 -->
|
||||
<span v-else>{{ line.text }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div v-else class="no-lyrics">
|
||||
@@ -190,7 +224,7 @@
|
||||
<!-- 歌曲信息放置在顶部 -->
|
||||
<div class="landscape-song-info">
|
||||
<div class="flex flex-col flex-1">
|
||||
<h1 class="song-title">{{ playMusic.name }}</h1>
|
||||
<h1 class="song-title" v-html="playMusic.name"></h1>
|
||||
<p class="song-artist">
|
||||
<span
|
||||
v-for="(item, index) in artistList"
|
||||
@@ -217,15 +251,34 @@
|
||||
@scroll="handleScroll"
|
||||
>
|
||||
<div class="lyrics-padding-top"></div>
|
||||
<!-- 无时间戳歌词提示 -->
|
||||
<div v-if="!supportAutoScroll" class="lyric-line no-scroll-tip">
|
||||
<span>{{ t('player.lrc.noAutoScroll') }}</span>
|
||||
</div>
|
||||
<div
|
||||
v-for="(item, index) in lrcArray"
|
||||
:key="index"
|
||||
:id="`landscape-lyric-line-${index}`"
|
||||
class="lyric-line"
|
||||
:class="{ 'now-text': index === nowIndex, 'hover-text': item.text }"
|
||||
@click="jumpToLyricTime(index)"
|
||||
:class="{
|
||||
'now-text': index === nowIndex,
|
||||
'hover-text': item.text && item.startTime !== -1
|
||||
}"
|
||||
@click="item.startTime !== -1 ? setAudioTime(index) : null"
|
||||
>
|
||||
<span :style="getLrcStyle(index)">{{ item.text }}</span>
|
||||
<!-- 逐字歌词显示 -->
|
||||
<div
|
||||
v-if="item.hasWordByWord && item.words && item.words.length > 0"
|
||||
class="word-by-word-lyric"
|
||||
>
|
||||
<template v-for="(word, wordIndex) in item.words" :key="wordIndex">
|
||||
<span class="lyric-word" :style="getWordStyle(index, wordIndex, word)">
|
||||
{{ word.text }} </span
|
||||
><span class="lyric-word" v-if="word.space"> </span></template
|
||||
>
|
||||
</div>
|
||||
<!-- 普通歌词显示 -->
|
||||
<span v-else :style="getLrcStyle(index)">{{ item.text }}</span>
|
||||
<div v-if="config.showTranslation && item.trText" class="translation">
|
||||
{{ item.trText }}
|
||||
</div>
|
||||
@@ -290,7 +343,7 @@
|
||||
<i class="ri-arrow-down-s-line"></i>
|
||||
</div>
|
||||
<div class="side-button" @click="togglePlayMode">
|
||||
<i :class="playModeIcon"></i>
|
||||
<i :class="[playModeIcon, { 'intelligence-active': playMode === 3 }]"></i>
|
||||
</div>
|
||||
<div class="main-button prev" @click="prevSong">
|
||||
<i class="ri-skip-back-fill"></i>
|
||||
@@ -318,15 +371,18 @@ import { useI18n } from 'vue-i18n';
|
||||
import {
|
||||
allTime,
|
||||
artistList,
|
||||
correctionTime,
|
||||
lrcArray,
|
||||
nowIndex,
|
||||
nowTime,
|
||||
playMusic,
|
||||
setAudioTime,
|
||||
sound,
|
||||
textColors,
|
||||
useLyricProgress
|
||||
} from '@/hooks/MusicHook';
|
||||
import { useArtist } from '@/hooks/useArtist';
|
||||
import { usePlayMode } from '@/hooks/usePlayMode';
|
||||
import { usePlayerStore } from '@/store/modules/player';
|
||||
import { DEFAULT_LYRIC_CONFIG, LyricConfig } from '@/types/lyric';
|
||||
import { getImgUrl, secondToMinute } from '@/utils';
|
||||
@@ -339,19 +395,9 @@ const playerStore = usePlayerStore();
|
||||
// 播放控制相关
|
||||
const play = computed(() => playerStore.isPlay);
|
||||
const playIcon = computed(() => (play.value ? 'ri-pause-fill' : 'ri-play-fill'));
|
||||
const playMode = computed(() => playerStore.playMode);
|
||||
const playModeIcon = computed(() => {
|
||||
switch (playMode.value) {
|
||||
case 0:
|
||||
return 'ri-repeat-line';
|
||||
case 1:
|
||||
return 'ri-repeat-one-line';
|
||||
case 2:
|
||||
return 'ri-shuffle-line';
|
||||
default:
|
||||
return 'ri-repeat-line';
|
||||
}
|
||||
});
|
||||
|
||||
// 播放模式
|
||||
const { playMode, playModeIcon, playModeText, togglePlayMode: togglePlayModeBase } = usePlayMode();
|
||||
// 打开播放列表
|
||||
const showPlaylist = () => {
|
||||
playerStore.setPlayListDrawerVisible(true);
|
||||
@@ -378,6 +424,7 @@ const isTouchScrolling = ref(false);
|
||||
const touchStartY = ref(0);
|
||||
const lastScrollTop = ref(0);
|
||||
const autoScrollTimer = ref<number | null>(null);
|
||||
const isSongChanging = ref(false);
|
||||
|
||||
// 横屏检测相关
|
||||
const { width, height } = useWindowSize();
|
||||
@@ -413,6 +460,10 @@ const showFullLyricScreen = () => {
|
||||
});
|
||||
};
|
||||
|
||||
const supportAutoScroll = computed(() => {
|
||||
return lrcArray.value.length > 0 && lrcArray.value[0].startTime !== -1;
|
||||
});
|
||||
|
||||
// 关闭全屏歌词
|
||||
const closeFullLyrics = () => {
|
||||
showFullLyrics.value = false;
|
||||
@@ -431,6 +482,11 @@ const scrollToCurrentLyric = (immediate = false, customScrollerRef?: HTMLElement
|
||||
return;
|
||||
}
|
||||
|
||||
if (!supportAutoScroll.value) {
|
||||
console.log('歌词不支持自动滚动');
|
||||
return;
|
||||
}
|
||||
|
||||
// 如果用户正在手动滚动,不打断他们的操作
|
||||
if (isTouchScrolling.value && !immediate) {
|
||||
return;
|
||||
@@ -468,6 +524,9 @@ const scrollToCurrentLyric = (immediate = false, customScrollerRef?: HTMLElement
|
||||
watch(nowIndex, (newIndex, oldIndex) => {
|
||||
console.log(`歌词索引变化: ${oldIndex} -> ${newIndex}`);
|
||||
|
||||
// 歌曲切换时不自动滚动
|
||||
if (isSongChanging.value) return;
|
||||
|
||||
// 在竖屏全屏歌词模式下滚动
|
||||
if (showFullLyrics.value) {
|
||||
nextTick(() => {
|
||||
@@ -770,7 +829,11 @@ const visibleLyrics = computed(() => {
|
||||
startIdx = Math.max(0, endIdx - numLines + 1);
|
||||
}
|
||||
|
||||
return lrcArray.value.slice(startIdx, endIdx + 1);
|
||||
// 返回带有原始索引的歌词数组
|
||||
return lrcArray.value.slice(startIdx, endIdx + 1).map((item, idx) => ({
|
||||
...item,
|
||||
originalIndex: startIdx + idx
|
||||
}));
|
||||
});
|
||||
|
||||
const props = defineProps({
|
||||
@@ -891,12 +954,8 @@ const prevSong = () => {
|
||||
};
|
||||
|
||||
const togglePlayMode = () => {
|
||||
playerStore.togglePlayMode();
|
||||
showBottomToast(
|
||||
[t('player.playMode.sequence'), t('player.playMode.loop'), t('player.playMode.random')][
|
||||
playMode.value
|
||||
]
|
||||
);
|
||||
togglePlayModeBase();
|
||||
showBottomToast(playModeText.value);
|
||||
};
|
||||
|
||||
const closeMusicFull = () => {
|
||||
@@ -914,6 +973,38 @@ watch(
|
||||
{ immediate: true }
|
||||
);
|
||||
|
||||
// 添加对 playMusic.id 的监听,歌曲切换时滚动到顶部
|
||||
watch(
|
||||
() => playMusic.value.id,
|
||||
(newId, oldId) => {
|
||||
// 只在歌曲真正切换时滚动到顶部
|
||||
if (newId !== oldId && newId) {
|
||||
isSongChanging.value = true;
|
||||
// 延迟滚动,确保 nowIndex 已重置
|
||||
setTimeout(() => {
|
||||
// 在全屏歌词模式下滚动到顶部
|
||||
if (showFullLyrics.value && lyricsScrollerRef.value) {
|
||||
lyricsScrollerRef.value.scrollTo({
|
||||
top: 0,
|
||||
behavior: 'smooth'
|
||||
});
|
||||
}
|
||||
// 在横屏模式下滚动到顶部
|
||||
else if (isLandscape.value && landscapeLyricsRef.value) {
|
||||
landscapeLyricsRef.value.scrollTo({
|
||||
top: 0,
|
||||
behavior: 'smooth'
|
||||
});
|
||||
}
|
||||
// 延迟恢复自动滚动,等待歌词数据更新
|
||||
setTimeout(() => {
|
||||
isSongChanging.value = false;
|
||||
}, 300);
|
||||
}, 100);
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
// 加载保存的配置
|
||||
onMounted(() => {
|
||||
const savedConfig = localStorage.getItem('music-full-config');
|
||||
@@ -958,42 +1049,6 @@ watch(isVisible, (newVal) => {
|
||||
}
|
||||
});
|
||||
|
||||
// 通过点击跳转到歌词对应时间点
|
||||
const jumpToLyricTime = (index: number) => {
|
||||
if (lrcArray.value[index] && 'time' in lrcArray.value[index] && sound.value) {
|
||||
// 使用类型断言确保time属性存在
|
||||
const lrcItem = lrcArray.value[index] as { time: number; text: string; trText?: string };
|
||||
const time = lrcItem.time / 1000;
|
||||
|
||||
// 更新播放位置
|
||||
sound.value.seek(time);
|
||||
nowTime.value = time;
|
||||
|
||||
// 显示反馈动画 - 处理两种模式下的歌词行
|
||||
const normalEl = document.getElementById(`lyric-line-${index}`);
|
||||
const landscapeEl = document.getElementById(`landscape-lyric-line-${index}`);
|
||||
|
||||
// 根据当前模式获取正确的元素并添加动画效果
|
||||
const activeEl = isLandscape.value ? landscapeEl : normalEl;
|
||||
|
||||
if (activeEl) {
|
||||
activeEl.classList.add('clicked');
|
||||
setTimeout(() => {
|
||||
activeEl.classList.remove('clicked');
|
||||
}, 300);
|
||||
}
|
||||
|
||||
// 如果歌词索引没有变化(例如点击当前行),手动触发滚动
|
||||
if (nowIndex.value === index) {
|
||||
if (isLandscape.value && !showFullLyrics.value) {
|
||||
scrollToCurrentLyric(true, landscapeLyricsRef.value);
|
||||
} else if (showFullLyrics.value) {
|
||||
scrollToCurrentLyric(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// 添加getLrcStyle函数
|
||||
const { getLrcStyle: originalLrcStyle } = useLyricProgress();
|
||||
|
||||
@@ -1020,6 +1075,57 @@ const getLrcStyle = (index: number) => {
|
||||
color: colors.primary
|
||||
};
|
||||
};
|
||||
|
||||
// 逐字歌词样式函数
|
||||
const getWordStyle = (lineIndex: number, _wordIndex: number, word: any) => {
|
||||
const colors = textColors.value || getTextColors();
|
||||
// 如果不是当前行,返回普通样式
|
||||
if (lineIndex !== nowIndex.value) {
|
||||
return {
|
||||
color: colors.primary,
|
||||
transition: 'color 0.3s ease',
|
||||
// 重置背景相关属性
|
||||
backgroundImage: 'none',
|
||||
WebkitTextFillColor: 'initial'
|
||||
};
|
||||
}
|
||||
|
||||
// 当前行的逐字效果,应用歌词矫正时间
|
||||
const currentTime = (nowTime.value + correctionTime.value) * 1000; // 转换为毫秒,确保与word时间单位一致
|
||||
|
||||
// 直接使用绝对时间比较
|
||||
const wordStartTime = word.startTime; // 单词开始的绝对时间(毫秒)
|
||||
const wordEndTime = word.startTime + word.duration;
|
||||
|
||||
if (currentTime >= wordStartTime && currentTime < wordEndTime) {
|
||||
// 当前正在播放的单词 - 使用渐变进度效果
|
||||
const progress = Math.min((currentTime - wordStartTime) / word.duration, 1);
|
||||
const progressPercent = Math.round(progress * 100);
|
||||
|
||||
return {
|
||||
backgroundImage: `linear-gradient(to right, ${colors.active} 0%, ${colors.active} ${progressPercent}%, ${colors.primary} ${progressPercent}%, ${colors.primary} 100%)`,
|
||||
backgroundClip: 'text',
|
||||
WebkitBackgroundClip: 'text',
|
||||
WebkitTextFillColor: 'transparent',
|
||||
textShadow: `0 0 8px ${colors.active}40`,
|
||||
transition: 'all 0.1s ease'
|
||||
};
|
||||
} else if (currentTime >= wordEndTime) {
|
||||
// 已经播放过的单词 - 纯色显示
|
||||
return {
|
||||
color: colors.active,
|
||||
WebkitTextFillColor: 'initial',
|
||||
transition: 'none'
|
||||
};
|
||||
} else {
|
||||
// 还未播放的单词 - 普通状态
|
||||
return {
|
||||
color: colors.primary,
|
||||
WebkitTextFillColor: 'initial',
|
||||
transition: 'none'
|
||||
};
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
@@ -1406,6 +1512,10 @@ const getLrcStyle = (index: number) => {
|
||||
i {
|
||||
@apply text-2xl;
|
||||
color: var(--text-color-primary);
|
||||
|
||||
&.intelligence-active {
|
||||
@apply text-green-500;
|
||||
}
|
||||
}
|
||||
|
||||
&:hover {
|
||||
@@ -1574,20 +1684,30 @@ const getLrcStyle = (index: number) => {
|
||||
|
||||
// 通用歌词样式
|
||||
.lyric-line {
|
||||
@apply cursor-pointer transition-all duration-300;
|
||||
@apply cursor-pointer transition-all duration-300 font-medium;
|
||||
font-weight: 500;
|
||||
letter-spacing: var(--lyric-letter-spacing, 0);
|
||||
line-height: var(--lyric-line-height, 1.6);
|
||||
color: var(--text-color-primary);
|
||||
opacity: 0.8;
|
||||
|
||||
&.no-scroll-tip {
|
||||
@apply text-base opacity-60 cursor-default py-2;
|
||||
color: var(--text-color-primary);
|
||||
font-weight: normal;
|
||||
|
||||
span {
|
||||
padding-right: 0;
|
||||
}
|
||||
}
|
||||
|
||||
span {
|
||||
background-clip: text !important;
|
||||
-webkit-background-clip: text !important;
|
||||
}
|
||||
|
||||
&.now-text {
|
||||
@apply font-bold py-4;
|
||||
@apply font-medium py-4;
|
||||
color: var(--text-color-active);
|
||||
opacity: 1;
|
||||
}
|
||||
@@ -1599,6 +1719,26 @@ const getLrcStyle = (index: number) => {
|
||||
.translation {
|
||||
@apply font-normal opacity-70 mt-1 text-base;
|
||||
}
|
||||
|
||||
// 逐字歌词样式
|
||||
.word-by-word-lyric {
|
||||
@apply flex flex-wrap justify-center;
|
||||
|
||||
.lyric-word {
|
||||
@apply inline-block;
|
||||
font-weight: inherit;
|
||||
font-size: inherit;
|
||||
letter-spacing: inherit;
|
||||
line-height: inherit;
|
||||
cursor: inherit;
|
||||
position: relative;
|
||||
padding-right: 0 !important;
|
||||
|
||||
&:hover {
|
||||
background-color: rgba(255, 255, 255, 0.1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 全屏歌词相关样式
|
||||
@@ -1727,6 +1867,10 @@ const getLrcStyle = (index: number) => {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.word-by-word-lyric {
|
||||
@apply justify-start;
|
||||
}
|
||||
}
|
||||
|
||||
.unified-controls {
|
||||
@@ -1765,6 +1909,10 @@ const getLrcStyle = (index: number) => {
|
||||
}
|
||||
}
|
||||
|
||||
.lyric-word {
|
||||
@apply px-[2px];
|
||||
}
|
||||
|
||||
.no-lyrics {
|
||||
@apply text-center text-base opacity-60;
|
||||
color: var(--text-color-primary);
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
<!-- 歌曲信息 -->
|
||||
<div class="song-info" @click="setMusicFull">
|
||||
<div class="song-title">{{ playMusic?.name || '未播放' }}</div>
|
||||
<div class="song-title" v-html="playMusic?.name || '未播放'"></div>
|
||||
<div class="song-artist">
|
||||
<span
|
||||
v-for="(artists, artistsindex) in artistList"
|
||||
|
||||
@@ -202,7 +202,7 @@ watch(
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.mobile-play-bar {
|
||||
@apply fixed bottom-[56px] left-0 w-full flex flex-col;
|
||||
@apply fixed bottom-[76px] left-0 w-full flex flex-col;
|
||||
z-index: 10000;
|
||||
animation-duration: 0.3s !important;
|
||||
transition: all 0.3s ease;
|
||||
|
||||
@@ -58,7 +58,7 @@
|
||||
<div class="music-content">
|
||||
<div class="music-content-title flex items-center">
|
||||
<n-ellipsis class="text-ellipsis" line-clamp="1">
|
||||
{{ playMusic?.name || '' }}
|
||||
<p v-html="playMusic?.name || ''"></p>
|
||||
</n-ellipsis>
|
||||
<span v-if="playbackRate !== 1.0" class="playback-rate-badge"> {{ playbackRate }}x </span>
|
||||
</div>
|
||||
@@ -105,15 +105,23 @@
|
||||
</div>
|
||||
<n-tooltip v-if="!isMobile" trigger="hover" :z-index="9999999">
|
||||
<template #trigger>
|
||||
<i class="iconfont" :class="playModeIcon" @click="togglePlayMode"></i>
|
||||
<i
|
||||
class="iconfont"
|
||||
:class="[playModeIcon, { 'intelligence-active': playMode === 3 }]"
|
||||
@click="togglePlayMode"
|
||||
></i>
|
||||
</template>
|
||||
{{ playModeText }}
|
||||
</n-tooltip>
|
||||
<n-tooltip v-if="!isMobile" trigger="hover" :z-index="9999999">
|
||||
<template #trigger>
|
||||
<i
|
||||
class="iconfont icon-likefill"
|
||||
:class="{ 'like-active': isFavorite }"
|
||||
class="iconfont"
|
||||
:class="{
|
||||
'like-active': isFavorite,
|
||||
'ri-heart-3-fill': isFavorite,
|
||||
'ri-heart-3-line': !isFavorite
|
||||
}"
|
||||
@click="toggleFavorite"
|
||||
></i>
|
||||
</template>
|
||||
@@ -174,6 +182,7 @@ import {
|
||||
textColors
|
||||
} from '@/hooks/MusicHook';
|
||||
import { useArtist } from '@/hooks/useArtist';
|
||||
import { usePlayMode } from '@/hooks/usePlayMode';
|
||||
import { audioService } from '@/services/audioService';
|
||||
import { isBilibiliIdMatch, usePlayerStore } from '@/store/modules/player';
|
||||
import { useSettingsStore } from '@/store/modules/settings';
|
||||
@@ -282,38 +291,10 @@ const handleVolumeWheel = (e: WheelEvent) => {
|
||||
};
|
||||
|
||||
// 播放模式
|
||||
const playMode = computed(() => playerStore.playMode);
|
||||
const playModeIcon = computed(() => {
|
||||
switch (playMode.value) {
|
||||
case 0:
|
||||
return 'ri-repeat-2-line';
|
||||
case 1:
|
||||
return 'ri-repeat-one-line';
|
||||
case 2:
|
||||
return 'ri-shuffle-line';
|
||||
default:
|
||||
return 'ri-repeat-2-line';
|
||||
}
|
||||
});
|
||||
const playModeText = computed(() => {
|
||||
switch (playMode.value) {
|
||||
case 0:
|
||||
return t('player.playBar.playMode.sequence');
|
||||
case 1:
|
||||
return t('player.playBar.playMode.loop');
|
||||
case 2:
|
||||
return t('player.playBar.playMode.random');
|
||||
default:
|
||||
return t('player.playBar.playMode.sequence');
|
||||
}
|
||||
});
|
||||
const { playMode, playModeIcon, playModeText, togglePlayMode } = usePlayMode();
|
||||
|
||||
// 播放速度控制
|
||||
const { playbackRate } = storeToRefs(playerStore);
|
||||
// 切换播放模式
|
||||
const togglePlayMode = () => {
|
||||
playerStore.togglePlayMode();
|
||||
};
|
||||
|
||||
function handleNext() {
|
||||
playerStore.nextPlay();
|
||||
@@ -645,6 +626,10 @@ const openPlayListDrawer = () => {
|
||||
@apply text-red-500 hover:text-red-600 !important;
|
||||
}
|
||||
|
||||
.intelligence-active {
|
||||
@apply text-green-500 hover:text-green-600 !important;
|
||||
}
|
||||
|
||||
.disabled-icon {
|
||||
@apply opacity-50 cursor-not-allowed !important;
|
||||
&:hover {
|
||||
|
||||
@@ -79,6 +79,7 @@ import { useMessage } from 'naive-ui';
|
||||
import { ref, watch } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
|
||||
import { CacheManager } from '@/api/musicParser';
|
||||
import { playMusic } from '@/hooks/MusicHook';
|
||||
import { audioService } from '@/services/audioService';
|
||||
import { usePlayerStore } from '@/store/modules/player';
|
||||
@@ -160,12 +161,18 @@ const directReparseMusic = async (source: Platform) => {
|
||||
isReparsing.value = true;
|
||||
currentReparsingSource.value = source;
|
||||
|
||||
const songId = Number(playMusic.value.id);
|
||||
|
||||
await CacheManager.clearMusicCache(songId);
|
||||
|
||||
// 更新选中的音源值为当前点击的音源
|
||||
const songId = String(playMusic.value.id);
|
||||
selectedSourcesValue.value = [source];
|
||||
|
||||
// 保存到localStorage
|
||||
localStorage.setItem(`song_source_${songId}`, JSON.stringify(selectedSourcesValue.value));
|
||||
localStorage.setItem(
|
||||
`song_source_${String(songId)}`,
|
||||
JSON.stringify(selectedSourcesValue.value)
|
||||
);
|
||||
|
||||
const success = await playerStore.reparseCurrentSong(source);
|
||||
|
||||
|
||||
@@ -20,7 +20,10 @@
|
||||
<div class="controls-section">
|
||||
<div class="left-controls">
|
||||
<button class="control-btn small-btn" @click="togglePlayMode">
|
||||
<i class="iconfont" :class="playModeIcon"></i>
|
||||
<i
|
||||
class="iconfont"
|
||||
:class="[playModeIcon, { 'intelligence-active': playMode === 3 }]"
|
||||
></i>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
@@ -73,9 +76,9 @@
|
||||
import { computed, onMounted, ref, watch } from 'vue';
|
||||
|
||||
import { allTime, nowTime, playMusic } from '@/hooks/MusicHook';
|
||||
import { usePlayMode } from '@/hooks/usePlayMode';
|
||||
import { audioService } from '@/services/audioService';
|
||||
import { usePlayerStore } from '@/store/modules/player';
|
||||
import { useSettingsStore } from '@/store/modules/settings';
|
||||
import { secondToMinute } from '@/utils';
|
||||
|
||||
const props = withDefaults(
|
||||
@@ -88,31 +91,13 @@ const props = withDefaults(
|
||||
);
|
||||
|
||||
const playerStore = usePlayerStore();
|
||||
const settingsStore = useSettingsStore();
|
||||
const playBarRef = ref<HTMLElement | null>(null);
|
||||
|
||||
// 播放状态
|
||||
const play = computed(() => playerStore.isPlay);
|
||||
|
||||
// 播放模式
|
||||
const playMode = computed(() => playerStore.playMode);
|
||||
const playModeIcon = computed(() => {
|
||||
switch (playMode.value) {
|
||||
case 0:
|
||||
return 'ri-repeat-2-line';
|
||||
case 1:
|
||||
return 'ri-repeat-one-line';
|
||||
case 2:
|
||||
return 'ri-shuffle-line';
|
||||
default:
|
||||
return 'ri-repeat-2-line';
|
||||
}
|
||||
});
|
||||
|
||||
// 切换播放模式
|
||||
const togglePlayMode = () => {
|
||||
playerStore.togglePlayMode();
|
||||
};
|
||||
const { playMode, playModeIcon, togglePlayMode } = usePlayMode();
|
||||
|
||||
// 音量控制
|
||||
const audioVolume = ref(
|
||||
@@ -183,7 +168,7 @@ const openPlayListDrawer = () => {
|
||||
};
|
||||
|
||||
// 深色模式
|
||||
const isDarkMode = computed(() => settingsStore.theme === 'dark' || props.isDark);
|
||||
const isDarkMode = computed(() => props.isDark);
|
||||
|
||||
// 主题颜色应用函数
|
||||
const applyThemeColor = (colorValue: string) => {
|
||||
@@ -529,4 +514,8 @@ onMounted(() => {
|
||||
color: var(--fill-color);
|
||||
text-shadow: 0 0 8px var(--fill-color-transparent);
|
||||
}
|
||||
|
||||
.intelligence-active {
|
||||
@apply text-green-500;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -10,56 +10,84 @@
|
||||
>
|
||||
<n-space vertical>
|
||||
<p>{{ t('settings.playback.musicSourcesDesc') }}</p>
|
||||
|
||||
<n-checkbox-group v-model:value="selectedSources">
|
||||
<n-grid :cols="2" :x-gap="12" :y-gap="8">
|
||||
<n-grid-item v-for="source in musicSourceOptions" :key="source.value">
|
||||
<!-- 遍历常规音源 -->
|
||||
<n-grid-item v-for="source in regularMusicSources" :key="source.value">
|
||||
<n-checkbox :value="source.value">
|
||||
{{ source.label }}
|
||||
<template v-if="source.value === 'gdmusic'">
|
||||
<n-tooltip>
|
||||
<template #trigger>
|
||||
<n-icon size="16" class="ml-1 text-blue-500 cursor-help">
|
||||
<i class="ri-information-line"></i>
|
||||
</n-icon>
|
||||
</template>
|
||||
{{ t('settings.playback.gdmusicInfo') }}
|
||||
</n-tooltip>
|
||||
</template>
|
||||
{{ t('settings.playback.sourceLabels.' + source.value) }}
|
||||
<n-tooltip v-if="source.value === 'gdmusic'">
|
||||
<template #trigger>
|
||||
<n-icon size="16" class="ml-1 text-blue-500 cursor-help">
|
||||
<i class="ri-information-line"></i>
|
||||
</n-icon>
|
||||
</template>
|
||||
{{ t('settings.playback.gdmusicInfo') }}
|
||||
</n-tooltip>
|
||||
</n-checkbox>
|
||||
</n-grid-item>
|
||||
|
||||
<!-- 单独处理自定义API选项 -->
|
||||
<n-grid-item>
|
||||
<n-checkbox value="custom" :disabled="!settingsStore.setData.customApiPlugin">
|
||||
{{ t('settings.playback.sourceLabels.custom') }}
|
||||
<n-tooltip v-if="!settingsStore.setData.customApiPlugin">
|
||||
<template #trigger>
|
||||
<n-icon size="16" class="ml-1 text-gray-400 cursor-help">
|
||||
<i class="ri-question-line"></i>
|
||||
</n-icon>
|
||||
</template>
|
||||
{{ t('settings.playback.customApi.enableHint') }}
|
||||
</n-tooltip>
|
||||
</n-checkbox>
|
||||
</n-grid-item>
|
||||
</n-grid>
|
||||
</n-checkbox-group>
|
||||
<div v-if="selectedSources.length === 0" class="text-red-500 text-sm">
|
||||
{{ t('settings.playback.musicSourcesWarning') }}
|
||||
</div>
|
||||
|
||||
<!-- GD音乐台设置 -->
|
||||
<div
|
||||
v-if="selectedSources.includes('gdmusic')"
|
||||
class="mt-4 border-t pt-4 border-gray-200 dark:border-gray-700"
|
||||
>
|
||||
<h3 class="text-base font-medium mb-2">GD音乐台(music.gdstudio.xyz)设置</h3>
|
||||
<p class="text-sm text-gray-500 dark:text-gray-400 mb-2">
|
||||
GD音乐台将自动尝试多个音乐平台进行解析,无需额外配置。优先级高于其他解析方式,但是请求可能较慢。感谢(music.gdstudio.xyz)
|
||||
</p>
|
||||
<!-- 分割线 -->
|
||||
<div class="mt-4 border-t pt-4 border-gray-200 dark:border-gray-700"></div>
|
||||
|
||||
<!-- 自定义API导入区域 -->
|
||||
<div>
|
||||
<h3 class="text-base font-medium mb-2">
|
||||
{{ t('settings.playback.customApi.sectionTitle') }}
|
||||
</h3>
|
||||
<div class="flex items-center gap-4">
|
||||
<n-button @click="importPlugin" size="small">{{
|
||||
t('settings.playback.customApi.importConfig')
|
||||
}}</n-button>
|
||||
<p v-if="settingsStore.setData.customApiPluginName" class="text-sm">
|
||||
{{ t('settings.playback.customApi.currentSource') }}:
|
||||
<span class="font-semibold">{{ settingsStore.setData.customApiPluginName }}</span>
|
||||
</p>
|
||||
<p v-else class="text-sm text-gray-500">
|
||||
{{ t('settings.playback.customApi.notImported') }}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</n-space>
|
||||
</n-modal>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { defineEmits, defineProps, ref, watch } from 'vue';
|
||||
import { useMessage } from 'naive-ui';
|
||||
import { ref, watch } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
|
||||
import { useSettingsStore } from '@/store';
|
||||
import { type Platform } from '@/types/music';
|
||||
|
||||
// 扩展 Platform 类型以包含 'custom'
|
||||
type ExtendedPlatform = Platform | 'custom';
|
||||
|
||||
const props = defineProps({
|
||||
show: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
sources: {
|
||||
type: Array as () => Platform[],
|
||||
type: Array as () => ExtendedPlatform[],
|
||||
default: () => ['migu', 'kugou', 'pyncmd', 'bilibili']
|
||||
}
|
||||
});
|
||||
@@ -67,17 +95,49 @@ const props = defineProps({
|
||||
const emit = defineEmits(['update:show', 'update:sources']);
|
||||
|
||||
const { t } = useI18n();
|
||||
const settingsStore = useSettingsStore();
|
||||
const message = useMessage();
|
||||
const visible = ref(props.show);
|
||||
const selectedSources = ref<Platform[]>(props.sources);
|
||||
const selectedSources = ref<ExtendedPlatform[]>(props.sources);
|
||||
|
||||
const musicSourceOptions = ref([
|
||||
{ label: 'MG', value: 'migu' },
|
||||
{ label: 'KG', value: 'kugou' },
|
||||
{ label: 'pyncmd', value: 'pyncmd' },
|
||||
{ label: 'Bilibili', value: 'bilibili' },
|
||||
{ label: 'GD音乐台', value: 'gdmusic' }
|
||||
// 将常规音源和自定义音源分开定义
|
||||
const regularMusicSources = ref([
|
||||
{ value: 'migu' },
|
||||
{ value: 'kugou' },
|
||||
{ value: 'pyncmd' },
|
||||
{ value: 'bilibili' },
|
||||
{ value: 'gdmusic' }
|
||||
]);
|
||||
|
||||
const importPlugin = async () => {
|
||||
try {
|
||||
const result = await window.api.importCustomApiPlugin();
|
||||
if (result && result.name && result.content) {
|
||||
settingsStore.setCustomApiPlugin(result);
|
||||
message.success(t('settings.playback.customApi.importSuccess', { name: result.name }));
|
||||
// 导入成功后,如果用户还没勾选,则自动勾选上
|
||||
if (!selectedSources.value.includes('custom')) {
|
||||
selectedSources.value.push('custom');
|
||||
}
|
||||
}
|
||||
} catch (error: any) {
|
||||
message.error(t('settings.playback.customApi.importFailed', { message: error.message }));
|
||||
}
|
||||
};
|
||||
|
||||
// 监听自定义插件内容的变化。如果用户清除了插件,要确保 'custom' 选项被取消勾选
|
||||
watch(
|
||||
() => settingsStore.setData.customApiPlugin,
|
||||
(newPluginContent) => {
|
||||
if (!newPluginContent) {
|
||||
const index = selectedSources.value.indexOf('custom');
|
||||
if (index > -1) {
|
||||
selectedSources.value.splice(index, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
// 同步外部show属性变化
|
||||
watch(
|
||||
() => props.show,
|
||||
@@ -108,11 +168,9 @@ const handleConfirm = () => {
|
||||
const defaultPlatforms = ['migu', 'kugou', 'pyncmd', 'bilibili'];
|
||||
const valuesToEmit =
|
||||
selectedSources.value.length > 0 ? [...new Set(selectedSources.value)] : defaultPlatforms;
|
||||
|
||||
emit('update:sources', valuesToEmit);
|
||||
visible.value = false;
|
||||
};
|
||||
|
||||
const handleCancel = () => {
|
||||
// 取消时还原为props传入的初始值
|
||||
selectedSources.value = [...props.sources];
|
||||
|
||||
@@ -64,7 +64,7 @@
|
||||
|
||||
<n-form-item>
|
||||
<n-space>
|
||||
<n-button type="primary" :disabled="!remoteControlConfig.enabled" @click="saveConfig">
|
||||
<n-button type="primary" @click="saveConfig">
|
||||
{{ t('common.save') }}
|
||||
</n-button>
|
||||
<n-button @click="resetConfig">
|
||||
|
||||
63
src/renderer/hooks/AlbumHistoryHook.ts
Normal file
63
src/renderer/hooks/AlbumHistoryHook.ts
Normal file
@@ -0,0 +1,63 @@
|
||||
import { useLocalStorage } from '@vueuse/core';
|
||||
import { ref, watch } from 'vue';
|
||||
|
||||
// 专辑历史记录类型
|
||||
export interface AlbumHistoryItem {
|
||||
id: number;
|
||||
name: string;
|
||||
picUrl?: string;
|
||||
size?: number; // 歌曲数量
|
||||
artist?: {
|
||||
name: string;
|
||||
id: number;
|
||||
};
|
||||
count?: number; // 播放次数
|
||||
lastPlayTime?: number; // 最后播放时间
|
||||
}
|
||||
|
||||
export const useAlbumHistory = () => {
|
||||
const albumHistory = useLocalStorage<AlbumHistoryItem[]>('albumHistory', []);
|
||||
|
||||
const addAlbum = (album: AlbumHistoryItem) => {
|
||||
const index = albumHistory.value.findIndex((item) => item.id === album.id);
|
||||
const now = Date.now();
|
||||
|
||||
if (index !== -1) {
|
||||
// 如果已存在,更新播放次数和时间,并移到最前面
|
||||
albumHistory.value[index].count = (albumHistory.value[index].count || 0) + 1;
|
||||
albumHistory.value[index].lastPlayTime = now;
|
||||
albumHistory.value.unshift(albumHistory.value.splice(index, 1)[0]);
|
||||
} else {
|
||||
// 如果不存在,添加新记录
|
||||
albumHistory.value.unshift({
|
||||
...album,
|
||||
count: 1,
|
||||
lastPlayTime: now
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
const delAlbum = (album: AlbumHistoryItem) => {
|
||||
const index = albumHistory.value.findIndex((item) => item.id === album.id);
|
||||
if (index !== -1) {
|
||||
albumHistory.value.splice(index, 1);
|
||||
}
|
||||
};
|
||||
|
||||
const albumList = ref(albumHistory.value);
|
||||
|
||||
watch(
|
||||
() => albumHistory.value,
|
||||
() => {
|
||||
albumList.value = albumHistory.value;
|
||||
},
|
||||
{ deep: true }
|
||||
);
|
||||
|
||||
return {
|
||||
albumHistory,
|
||||
albumList,
|
||||
addAlbum,
|
||||
delAlbum
|
||||
};
|
||||
};
|
||||
@@ -10,6 +10,7 @@ import { getSongUrl } from '@/store/modules/player';
|
||||
import type { Artist, ILyricText, SongResult } from '@/types/music';
|
||||
import { isElectron } from '@/utils';
|
||||
import { getTextColors } from '@/utils/linearColor';
|
||||
import { parseLyrics } from '@/utils/yrcParser';
|
||||
|
||||
const windowData = window as any;
|
||||
|
||||
@@ -55,11 +56,17 @@ export const textColors = ref<any>(getTextColors());
|
||||
export let playMusic: ComputedRef<SongResult>;
|
||||
export let artistList: ComputedRef<Artist[]>;
|
||||
|
||||
export const musicDB = await useIndexedDB('musicDB', [
|
||||
{ name: 'music', keyPath: 'id' },
|
||||
{ name: 'music_lyric', keyPath: 'id' },
|
||||
{ name: 'api_cache', keyPath: 'id' }
|
||||
]);
|
||||
export const musicDB = await useIndexedDB(
|
||||
'musicDB',
|
||||
[
|
||||
{ name: 'music', keyPath: 'id' },
|
||||
{ name: 'music_lyric', keyPath: 'id' },
|
||||
{ name: 'api_cache', keyPath: 'id' },
|
||||
{ name: 'music_url_cache', keyPath: 'id' },
|
||||
{ name: 'music_failed_cache', keyPath: 'id' }
|
||||
],
|
||||
3
|
||||
);
|
||||
|
||||
// 键盘事件处理器,在初始化后设置
|
||||
const setupKeyboardListeners = () => {
|
||||
@@ -262,20 +269,117 @@ const initProgressAnimation = () => {
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* 解析歌词字符串并转换为ILyricText格式
|
||||
* @param lyricsStr 歌词字符串
|
||||
* @returns 解析后的歌词数据
|
||||
*/
|
||||
const parseLyricsString = async (
|
||||
lyricsStr: string
|
||||
): Promise<{ lrcArray: ILyricText[]; lrcTimeArray: number[]; hasWordByWord: boolean }> => {
|
||||
if (!lyricsStr || typeof lyricsStr !== 'string') {
|
||||
return { lrcArray: [], lrcTimeArray: [], hasWordByWord: false };
|
||||
}
|
||||
|
||||
try {
|
||||
const parseResult = parseLyrics(lyricsStr);
|
||||
console.log('parseResult', parseResult);
|
||||
|
||||
if (!parseResult.success) {
|
||||
console.error('歌词解析失败:', parseResult.error.message);
|
||||
return { lrcArray: [], lrcTimeArray: [], hasWordByWord: false };
|
||||
}
|
||||
|
||||
const { lyrics } = parseResult.data;
|
||||
const lrcArray: ILyricText[] = [];
|
||||
const lrcTimeArray: number[] = [];
|
||||
let hasWordByWord = false;
|
||||
|
||||
for (const line of lyrics) {
|
||||
// 检查是否有逐字歌词
|
||||
const hasWords = line.words && line.words.length > 0;
|
||||
if (hasWords) {
|
||||
hasWordByWord = true;
|
||||
}
|
||||
|
||||
lrcArray.push({
|
||||
text: line.fullText,
|
||||
trText: '', // 翻译文本稍后处理
|
||||
words: hasWords
|
||||
? line.words.map((word) => ({
|
||||
...word
|
||||
}))
|
||||
: undefined,
|
||||
hasWordByWord: hasWords,
|
||||
startTime: line.startTime,
|
||||
duration: line.duration
|
||||
});
|
||||
|
||||
lrcTimeArray.push(line.startTime);
|
||||
}
|
||||
return { lrcArray, lrcTimeArray, hasWordByWord };
|
||||
} catch (error) {
|
||||
console.error('解析歌词时发生错误:', error);
|
||||
return { lrcArray: [], lrcTimeArray: [], hasWordByWord: false };
|
||||
}
|
||||
};
|
||||
|
||||
// 设置音乐相关的监听器
|
||||
const setupMusicWatchers = () => {
|
||||
const store = getPlayerStore();
|
||||
|
||||
// 监听 playerStore.playMusic 的变化以更新歌词数据
|
||||
watch(
|
||||
() => store.playMusic,
|
||||
() => {
|
||||
nextTick(async () => {
|
||||
console.log('歌曲切换,更新歌词数据');
|
||||
// 更新歌词数据
|
||||
lrcArray.value = playMusic.value.lyric?.lrcArray || [];
|
||||
lrcTimeArray.value = playMusic.value.lyric?.lrcTimeArray || [];
|
||||
() => store.playMusic.id,
|
||||
async (newId, oldId) => {
|
||||
// 如果没有歌曲ID,清空歌词
|
||||
if (!newId) {
|
||||
lrcArray.value = [];
|
||||
lrcTimeArray.value = [];
|
||||
nowIndex.value = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
// 避免相同ID的重复执行(但允许初始化时执行)
|
||||
if (newId === oldId && lrcArray.value.length > 0) return;
|
||||
|
||||
// 歌曲切换时重置歌词索引
|
||||
if (newId !== oldId) {
|
||||
nowIndex.value = 0;
|
||||
}
|
||||
|
||||
await nextTick(async () => {
|
||||
console.log('歌曲切换,更新歌词数据');
|
||||
|
||||
// 检查是否有原始歌词字符串需要解析
|
||||
const lyricData = playMusic.value.lyric;
|
||||
if (lyricData && typeof lyricData === 'string') {
|
||||
// 如果歌词是字符串格式,使用新的解析器
|
||||
const {
|
||||
lrcArray: parsedLrcArray,
|
||||
lrcTimeArray: parsedTimeArray,
|
||||
hasWordByWord
|
||||
} = await parseLyricsString(lyricData);
|
||||
lrcArray.value = parsedLrcArray;
|
||||
lrcTimeArray.value = parsedTimeArray;
|
||||
|
||||
// 更新歌曲的歌词数据结构
|
||||
if (playMusic.value.lyric && typeof playMusic.value.lyric === 'object') {
|
||||
playMusic.value.lyric.hasWordByWord = hasWordByWord;
|
||||
}
|
||||
} else {
|
||||
// 使用现有的歌词数据结构
|
||||
const rawLrc = lyricData?.lrcArray || [];
|
||||
lrcTimeArray.value = lyricData?.lrcTimeArray || [];
|
||||
|
||||
try {
|
||||
const { translateLyrics } = await import('@/services/lyricTranslation');
|
||||
lrcArray.value = await translateLyrics(rawLrc as any);
|
||||
} catch (e) {
|
||||
console.error('翻译歌词失败,使用原始歌词:', e);
|
||||
lrcArray.value = rawLrc as any;
|
||||
}
|
||||
}
|
||||
// 当歌词数据更新时,如果歌词窗口打开,则发送数据
|
||||
if (isElectron && isLyricWindowOpen.value) {
|
||||
console.log('歌词窗口已打开,同步最新歌词数据');
|
||||
@@ -289,10 +393,7 @@ const setupMusicWatchers = () => {
|
||||
}
|
||||
});
|
||||
},
|
||||
{
|
||||
deep: true,
|
||||
immediate: true
|
||||
}
|
||||
{ immediate: true }
|
||||
);
|
||||
};
|
||||
|
||||
@@ -455,24 +556,8 @@ const setupAudioListeners = () => {
|
||||
if (sound.value) {
|
||||
replayMusic();
|
||||
}
|
||||
} else if (getPlayerStore().playMode === 2) {
|
||||
// 随机播放模式
|
||||
|
||||
if (getPlayerStore().playList.length <= 1) {
|
||||
replayMusic();
|
||||
} else {
|
||||
let randomIndex;
|
||||
do {
|
||||
randomIndex = Math.floor(Math.random() * getPlayerStore().playList.length);
|
||||
} while (
|
||||
randomIndex === getPlayerStore().playListIndex &&
|
||||
getPlayerStore().playList.length > 1
|
||||
);
|
||||
getPlayerStore().playListIndex = randomIndex;
|
||||
getPlayerStore().setPlay(getPlayerStore().playList[randomIndex]);
|
||||
}
|
||||
} else {
|
||||
// 列表循环模式
|
||||
// 顺序播放、列表循环、随机播放模式都使用统一的nextPlay方法
|
||||
getPlayerStore().nextPlay();
|
||||
}
|
||||
});
|
||||
@@ -566,20 +651,46 @@ export const adjustCorrectionTime = (delta: number) => {
|
||||
// 获取当前播放歌词
|
||||
export const isCurrentLrc = (index: number, time: number): boolean => {
|
||||
const currentTime = lrcTimeArray.value[index];
|
||||
|
||||
// 如果是最后一句歌词,只需要判断时间是否大于等于当前句的开始时间
|
||||
if (index === lrcTimeArray.value.length - 1) {
|
||||
const correctedTime = time + correctionTime.value;
|
||||
return correctedTime >= currentTime;
|
||||
}
|
||||
|
||||
// 非最后一句歌词,需要判断时间在当前句和下一句之间
|
||||
const nextTime = lrcTimeArray.value[index + 1];
|
||||
const correctedTime = time + correctionTime.value;
|
||||
return correctedTime > currentTime && correctedTime < nextTime;
|
||||
return correctedTime >= currentTime && correctedTime < nextTime;
|
||||
};
|
||||
|
||||
// 获取当前播放歌词INDEX
|
||||
export const getLrcIndex = (time: number): number => {
|
||||
const correctedTime = time + correctionTime.value;
|
||||
for (let i = 0; i < lrcTimeArray.value.length; i++) {
|
||||
if (isCurrentLrc(i, correctedTime - correctionTime.value)) {
|
||||
|
||||
// 如果歌词数组为空,返回当前索引
|
||||
if (lrcTimeArray.value.length === 0) {
|
||||
return nowIndex.value;
|
||||
}
|
||||
|
||||
// 处理最后一句歌词的情况
|
||||
const lastIndex = lrcTimeArray.value.length - 1;
|
||||
if (correctedTime >= lrcTimeArray.value[lastIndex]) {
|
||||
nowIndex.value = lastIndex;
|
||||
return lastIndex;
|
||||
}
|
||||
|
||||
// 查找当前时间对应的歌词索引
|
||||
for (let i = 0; i < lrcTimeArray.value.length - 1; i++) {
|
||||
const currentTime = lrcTimeArray.value[i];
|
||||
const nextTime = lrcTimeArray.value[i + 1];
|
||||
|
||||
if (correctedTime >= currentTime && correctedTime < nextTime) {
|
||||
nowIndex.value = i;
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
return nowIndex.value;
|
||||
};
|
||||
|
||||
@@ -836,6 +947,9 @@ onUnmounted(() => {
|
||||
stopLyricSync();
|
||||
});
|
||||
|
||||
// 导出歌词解析函数供外部使用
|
||||
export { parseLyricsString };
|
||||
|
||||
// 添加播放控制命令监听
|
||||
if (isElectron) {
|
||||
windowData.electron.ipcRenderer.on('lyric-control-back', (_, command: string) => {
|
||||
|
||||
@@ -1,284 +0,0 @@
|
||||
import { Howl } from 'howler';
|
||||
import { cloneDeep } from 'lodash';
|
||||
import { ref } from 'vue';
|
||||
|
||||
import { getMusicLrc, getMusicUrl, getParsingMusicUrl } from '@/api/music';
|
||||
import { useMusicHistory } from '@/hooks/MusicHistoryHook';
|
||||
import { audioService } from '@/services/audioService';
|
||||
import { useSettingsStore } from '@/store';
|
||||
import type { ILyric, ILyricText, SongResult } from '@/types/music';
|
||||
import { getImgUrl } from '@/utils';
|
||||
import { getImageLinearBackground } from '@/utils/linearColor';
|
||||
|
||||
const musicHistory = useMusicHistory();
|
||||
|
||||
// 获取歌曲url
|
||||
export const getSongUrl = async (id: any, songData: any, isDownloaded: boolean = false) => {
|
||||
const settingsStore = useSettingsStore();
|
||||
const { unlimitedDownload } = settingsStore.setData;
|
||||
|
||||
const { data } = await getMusicUrl(id, !unlimitedDownload);
|
||||
let url = '';
|
||||
let songDetail = null;
|
||||
|
||||
try {
|
||||
if (data.data[0].freeTrialInfo || !data.data[0].url) {
|
||||
const res = await getParsingMusicUrl(id, cloneDeep(songData));
|
||||
url = res.data.data.url;
|
||||
songDetail = res.data.data;
|
||||
} else {
|
||||
songDetail = data.data[0] as any;
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('error', error);
|
||||
}
|
||||
if (isDownloaded) {
|
||||
return songDetail;
|
||||
}
|
||||
url = url || data.data[0].url;
|
||||
return url;
|
||||
};
|
||||
|
||||
const getSongDetail = async (playMusic: SongResult) => {
|
||||
playMusic.playLoading = true;
|
||||
const playMusicUrl =
|
||||
playMusic.playMusicUrl || (await getSongUrl(playMusic.id, cloneDeep(playMusic)));
|
||||
const { backgroundColor, primaryColor } =
|
||||
playMusic.backgroundColor && playMusic.primaryColor
|
||||
? playMusic
|
||||
: await getImageLinearBackground(getImgUrl(playMusic?.picUrl, '30y30'));
|
||||
|
||||
playMusic.playLoading = false;
|
||||
return { ...playMusic, playMusicUrl, backgroundColor, primaryColor };
|
||||
};
|
||||
|
||||
// 加载 当前歌曲 歌曲列表数据 下一首mp3预加载 歌词数据
|
||||
export const useMusicListHook = () => {
|
||||
const handlePlayMusic = async (state: any, playMusic: SongResult, isPlay: boolean = true) => {
|
||||
const updatedPlayMusic = await getSongDetail(playMusic);
|
||||
state.playMusic = updatedPlayMusic;
|
||||
state.playMusicUrl = updatedPlayMusic.playMusicUrl;
|
||||
|
||||
// 记录当前设置的播放状态
|
||||
state.play = isPlay;
|
||||
|
||||
// 每次设置新歌曲时,立即更新 localStorage
|
||||
localStorage.setItem('currentPlayMusic', JSON.stringify(state.playMusic));
|
||||
localStorage.setItem('currentPlayMusicUrl', state.playMusicUrl);
|
||||
localStorage.setItem('isPlaying', state.play.toString());
|
||||
|
||||
// 设置网页标题
|
||||
document.title = `${updatedPlayMusic.name} - ${updatedPlayMusic?.song?.artists?.reduce((prev, curr) => `${prev}${curr.name}/`, '')}`;
|
||||
loadLrcAsync(state, updatedPlayMusic.id);
|
||||
musicHistory.addMusic(state.playMusic);
|
||||
const playListIndex = state.playList.findIndex((item: SongResult) => item.id === playMusic.id);
|
||||
state.playListIndex = playListIndex;
|
||||
// 请求后续五首歌曲的详情
|
||||
fetchSongs(state, playListIndex + 1, playListIndex + 6);
|
||||
};
|
||||
|
||||
const preloadingSounds = ref<Howl[]>([]);
|
||||
|
||||
// 用于预加载下一首歌曲的 MP3 数据
|
||||
const preloadNextSong = (nextSongUrl: string) => {
|
||||
try {
|
||||
// 限制同时预加载的数量
|
||||
if (preloadingSounds.value.length >= 2) {
|
||||
const oldestSound = preloadingSounds.value.shift();
|
||||
if (oldestSound) {
|
||||
oldestSound.unload();
|
||||
}
|
||||
}
|
||||
|
||||
const sound = new Howl({
|
||||
src: [nextSongUrl],
|
||||
html5: true,
|
||||
preload: true,
|
||||
autoplay: false
|
||||
});
|
||||
|
||||
preloadingSounds.value.push(sound);
|
||||
|
||||
// 添加加载错误处理
|
||||
sound.on('loaderror', () => {
|
||||
console.error('预加载音频失败:', nextSongUrl);
|
||||
const index = preloadingSounds.value.indexOf(sound);
|
||||
if (index > -1) {
|
||||
preloadingSounds.value.splice(index, 1);
|
||||
}
|
||||
sound.unload();
|
||||
});
|
||||
|
||||
return sound;
|
||||
} catch (error) {
|
||||
console.error('预加载音频出错:', error);
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
||||
const fetchSongs = async (state: any, startIndex: number, endIndex: number) => {
|
||||
try {
|
||||
const songs = state.playList.slice(
|
||||
Math.max(0, startIndex),
|
||||
Math.min(endIndex, state.playList.length)
|
||||
);
|
||||
|
||||
const detailedSongs = await Promise.all(
|
||||
songs.map(async (song: SongResult) => {
|
||||
try {
|
||||
// 如果歌曲详情已经存在,就不重复请求
|
||||
if (!song.playMusicUrl) {
|
||||
return await getSongDetail(song);
|
||||
}
|
||||
return song;
|
||||
} catch (error) {
|
||||
console.error('获取歌曲详情失败:', error);
|
||||
return song;
|
||||
}
|
||||
})
|
||||
);
|
||||
|
||||
// 加载下一首的歌词
|
||||
const nextSong = detailedSongs[0];
|
||||
if (nextSong && !(nextSong.lyric && nextSong.lyric.lrcTimeArray.length > 0)) {
|
||||
try {
|
||||
nextSong.lyric = await loadLrc(nextSong.id);
|
||||
} catch (error) {
|
||||
console.error('加载歌词失败:', error);
|
||||
}
|
||||
}
|
||||
|
||||
// 更新播放列表中的歌曲详情
|
||||
detailedSongs.forEach((song, index) => {
|
||||
if (song && startIndex + index < state.playList.length) {
|
||||
state.playList[startIndex + index] = song;
|
||||
}
|
||||
});
|
||||
|
||||
// 只预加载下一首歌曲
|
||||
if (nextSong && nextSong.playMusicUrl) {
|
||||
preloadNextSong(nextSong.playMusicUrl);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('获取歌曲列表失败:', error);
|
||||
}
|
||||
};
|
||||
|
||||
const nextPlay = async (state: any) => {
|
||||
if (state.playList.length === 0) {
|
||||
state.play = true;
|
||||
return;
|
||||
}
|
||||
|
||||
let playListIndex: number;
|
||||
|
||||
if (state.playMode === 2) {
|
||||
// 随机播放模式
|
||||
do {
|
||||
playListIndex = Math.floor(Math.random() * state.playList.length);
|
||||
} while (playListIndex === state.playListIndex && state.playList.length > 1);
|
||||
} else {
|
||||
// 列表循环模式
|
||||
playListIndex = (state.playListIndex + 1) % state.playList.length;
|
||||
}
|
||||
|
||||
state.playListIndex = playListIndex;
|
||||
await handlePlayMusic(state, state.playList[playListIndex]);
|
||||
};
|
||||
|
||||
const prevPlay = async (state: any) => {
|
||||
if (state.playList.length === 0) {
|
||||
state.play = true;
|
||||
return;
|
||||
}
|
||||
const playListIndex = (state.playListIndex - 1 + state.playList.length) % state.playList.length;
|
||||
await handlePlayMusic(state, state.playList[playListIndex]);
|
||||
await fetchSongs(state, playListIndex - 5, playListIndex);
|
||||
};
|
||||
|
||||
const parseTime = (timeString: string): number => {
|
||||
const [minutes, seconds] = timeString.split(':');
|
||||
return Number(minutes) * 60 + Number(seconds);
|
||||
};
|
||||
|
||||
const parseLyricLine = (lyricLine: string): { time: number; text: string } => {
|
||||
const TIME_REGEX = /(\d{2}:\d{2}(\.\d*)?)/g;
|
||||
const LRC_REGEX = /(\[(\d{2}):(\d{2})(\.(\d*))?\])/g;
|
||||
const timeText = lyricLine.match(TIME_REGEX)?.[0] || '';
|
||||
const time = parseTime(timeText);
|
||||
const text = lyricLine.replace(LRC_REGEX, '').trim();
|
||||
return { time, text };
|
||||
};
|
||||
|
||||
const parseLyrics = (lyricsString: string): { lyrics: ILyricText[]; times: number[] } => {
|
||||
const lines = lyricsString.split('\n');
|
||||
const lyrics: ILyricText[] = [];
|
||||
const times: number[] = [];
|
||||
lines.forEach((line) => {
|
||||
const { time, text } = parseLyricLine(line);
|
||||
times.push(time);
|
||||
lyrics.push({ text, trText: '' });
|
||||
});
|
||||
return { lyrics, times };
|
||||
};
|
||||
|
||||
const loadLrc = async (playMusicId: number): Promise<ILyric> => {
|
||||
try {
|
||||
const { data } = await getMusicLrc(playMusicId);
|
||||
const { lyrics, times } = parseLyrics(data.lrc.lyric);
|
||||
const tlyric: Record<string, string> = {};
|
||||
|
||||
if (data.tlyric && data.tlyric.lyric) {
|
||||
const { lyrics: tLyrics, times: tTimes } = parseLyrics(data.tlyric.lyric);
|
||||
tLyrics.forEach((lyric, index) => {
|
||||
tlyric[tTimes[index].toString()] = lyric.text;
|
||||
});
|
||||
}
|
||||
|
||||
lyrics.forEach((item, index) => {
|
||||
item.trText = item.text ? tlyric[times[index].toString()] || '' : '';
|
||||
});
|
||||
return {
|
||||
lrcTimeArray: times,
|
||||
lrcArray: lyrics
|
||||
};
|
||||
} catch (err) {
|
||||
console.error('Error loading lyrics:', err);
|
||||
return {
|
||||
lrcTimeArray: [],
|
||||
lrcArray: []
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
// 异步加载歌词的方法
|
||||
const loadLrcAsync = async (state: any, playMusicId: any) => {
|
||||
if (state.playMusic.lyric && state.playMusic.lyric.lrcTimeArray.length > 0) {
|
||||
return;
|
||||
}
|
||||
const lyrics = await loadLrc(playMusicId);
|
||||
state.playMusic.lyric = lyrics;
|
||||
};
|
||||
|
||||
const play = () => {
|
||||
audioService.getCurrentSound()?.play();
|
||||
};
|
||||
|
||||
const pause = () => {
|
||||
audioService.getCurrentSound()?.pause();
|
||||
};
|
||||
|
||||
// 在组件卸载时清理预加载的音频
|
||||
onUnmounted(() => {
|
||||
preloadingSounds.value.forEach((sound) => sound.unload());
|
||||
preloadingSounds.value = [];
|
||||
});
|
||||
|
||||
return {
|
||||
handlePlayMusic,
|
||||
nextPlay,
|
||||
prevPlay,
|
||||
play,
|
||||
pause
|
||||
};
|
||||
};
|
||||
65
src/renderer/hooks/PlaylistHistoryHook.ts
Normal file
65
src/renderer/hooks/PlaylistHistoryHook.ts
Normal file
@@ -0,0 +1,65 @@
|
||||
import { useLocalStorage } from '@vueuse/core';
|
||||
import { ref, watch } from 'vue';
|
||||
|
||||
// 歌单历史记录类型
|
||||
export interface PlaylistHistoryItem {
|
||||
id: number;
|
||||
name: string;
|
||||
coverImgUrl?: string;
|
||||
picUrl?: string; // 兼容字段
|
||||
trackCount?: number;
|
||||
playCount?: number;
|
||||
creator?: {
|
||||
nickname: string;
|
||||
userId: number;
|
||||
};
|
||||
count?: number; // 播放次数
|
||||
lastPlayTime?: number; // 最后播放时间
|
||||
}
|
||||
|
||||
export const usePlaylistHistory = () => {
|
||||
const playlistHistory = useLocalStorage<PlaylistHistoryItem[]>('playlistHistory', []);
|
||||
|
||||
const addPlaylist = (playlist: PlaylistHistoryItem) => {
|
||||
const index = playlistHistory.value.findIndex((item) => item.id === playlist.id);
|
||||
const now = Date.now();
|
||||
|
||||
if (index !== -1) {
|
||||
// 如果已存在,更新播放次数和时间,并移到最前面
|
||||
playlistHistory.value[index].count = (playlistHistory.value[index].count || 0) + 1;
|
||||
playlistHistory.value[index].lastPlayTime = now;
|
||||
playlistHistory.value.unshift(playlistHistory.value.splice(index, 1)[0]);
|
||||
} else {
|
||||
// 如果不存在,添加新记录
|
||||
playlistHistory.value.unshift({
|
||||
...playlist,
|
||||
count: 1,
|
||||
lastPlayTime: now
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
const delPlaylist = (playlist: PlaylistHistoryItem) => {
|
||||
const index = playlistHistory.value.findIndex((item) => item.id === playlist.id);
|
||||
if (index !== -1) {
|
||||
playlistHistory.value.splice(index, 1);
|
||||
}
|
||||
};
|
||||
|
||||
const playlistList = ref(playlistHistory.value);
|
||||
|
||||
watch(
|
||||
() => playlistHistory.value,
|
||||
() => {
|
||||
playlistList.value = playlistHistory.value;
|
||||
},
|
||||
{ deep: true }
|
||||
);
|
||||
|
||||
return {
|
||||
playlistHistory,
|
||||
playlistList,
|
||||
addPlaylist,
|
||||
delPlaylist
|
||||
};
|
||||
};
|
||||
60
src/renderer/hooks/usePlayMode.ts
Normal file
60
src/renderer/hooks/usePlayMode.ts
Normal file
@@ -0,0 +1,60 @@
|
||||
import { computed } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
|
||||
import { usePlayerStore } from '@/store/modules/player';
|
||||
|
||||
/**
|
||||
* 播放模式相关的 Hook
|
||||
* 提供播放模式的图标、文本和切换功能
|
||||
*/
|
||||
export function usePlayMode() {
|
||||
const { t } = useI18n();
|
||||
const playerStore = usePlayerStore();
|
||||
|
||||
// 当前播放模式
|
||||
const playMode = computed(() => playerStore.playMode);
|
||||
|
||||
// 播放模式图标
|
||||
const playModeIcon = computed(() => {
|
||||
switch (playMode.value) {
|
||||
case 0:
|
||||
return 'ri-repeat-2-line';
|
||||
case 1:
|
||||
return 'ri-repeat-one-line';
|
||||
case 2:
|
||||
return 'ri-shuffle-line';
|
||||
case 3:
|
||||
return 'ri-heart-pulse-line';
|
||||
default:
|
||||
return 'ri-repeat-2-line';
|
||||
}
|
||||
});
|
||||
|
||||
// 播放模式文本
|
||||
const playModeText = computed(() => {
|
||||
switch (playMode.value) {
|
||||
case 0:
|
||||
return t('player.playBar.playMode.sequence');
|
||||
case 1:
|
||||
return t('player.playBar.playMode.loop');
|
||||
case 2:
|
||||
return t('player.playBar.playMode.random');
|
||||
case 3:
|
||||
return t('player.playBar.intelligenceMode.title');
|
||||
default:
|
||||
return t('player.playBar.playMode.sequence');
|
||||
}
|
||||
});
|
||||
|
||||
// 切换播放模式
|
||||
const togglePlayMode = () => {
|
||||
playerStore.togglePlayMode();
|
||||
};
|
||||
|
||||
return {
|
||||
playMode,
|
||||
playModeIcon,
|
||||
playModeText,
|
||||
togglePlayMode
|
||||
};
|
||||
}
|
||||
403
src/renderer/hooks/usePlayerHooks.ts
Normal file
403
src/renderer/hooks/usePlayerHooks.ts
Normal file
@@ -0,0 +1,403 @@
|
||||
import { cloneDeep } from 'lodash';
|
||||
import { createDiscreteApi } from 'naive-ui';
|
||||
import { ref } from 'vue';
|
||||
|
||||
import i18n from '@/../i18n/renderer';
|
||||
import { getBilibiliAudioUrl } from '@/api/bilibili';
|
||||
import { getMusicLrc, getMusicUrl, getParsingMusicUrl } from '@/api/music';
|
||||
import type { ILyric, ILyricText, IWordData, SongResult } from '@/types/music';
|
||||
import { getImgUrl } from '@/utils';
|
||||
import { getImageLinearBackground } from '@/utils/linearColor';
|
||||
import { parseLyrics as parseYrcLyrics } from '@/utils/yrcParser';
|
||||
|
||||
const { message } = createDiscreteApi(['message']);
|
||||
|
||||
// 预加载的音频实例
|
||||
export const preloadingSounds = ref<Howl[]>([]);
|
||||
|
||||
/**
|
||||
* 获取歌曲播放URL(独立函数)
|
||||
*/
|
||||
export const getSongUrl = async (
|
||||
id: string | number,
|
||||
songData: SongResult,
|
||||
isDownloaded: boolean = false
|
||||
) => {
|
||||
const numericId = typeof id === 'string' ? parseInt(id, 10) : id;
|
||||
|
||||
// 动态导入 settingsStore
|
||||
const { useSettingsStore } = await import('@/store/modules/settings');
|
||||
const settingsStore = useSettingsStore();
|
||||
|
||||
try {
|
||||
if (songData.playMusicUrl) {
|
||||
return songData.playMusicUrl;
|
||||
}
|
||||
|
||||
if (songData.source === 'bilibili' && songData.bilibiliData) {
|
||||
console.log('加载B站音频URL');
|
||||
if (!songData.playMusicUrl && songData.bilibiliData.bvid && songData.bilibiliData.cid) {
|
||||
try {
|
||||
songData.playMusicUrl = await getBilibiliAudioUrl(
|
||||
songData.bilibiliData.bvid,
|
||||
songData.bilibiliData.cid
|
||||
);
|
||||
return songData.playMusicUrl;
|
||||
} catch (error) {
|
||||
console.error('重启后获取B站音频URL失败:', error);
|
||||
return '';
|
||||
}
|
||||
}
|
||||
return songData.playMusicUrl || '';
|
||||
}
|
||||
|
||||
// ==================== 自定义API最优先 ====================
|
||||
const globalSources = settingsStore.setData.enabledMusicSources || [];
|
||||
const useCustomApiGlobally = globalSources.includes('custom');
|
||||
|
||||
const songId = String(id);
|
||||
const savedSourceStr = localStorage.getItem(`song_source_${songId}`);
|
||||
let useCustomApiForSong = false;
|
||||
if (savedSourceStr) {
|
||||
try {
|
||||
const songSources = JSON.parse(savedSourceStr);
|
||||
useCustomApiForSong = songSources.includes('custom');
|
||||
} catch (e) {
|
||||
console.error('解析歌曲音源设置失败:', e);
|
||||
}
|
||||
}
|
||||
|
||||
// 如果全局或歌曲专属设置中启用了自定义API,则最优先尝试
|
||||
if ((useCustomApiGlobally || useCustomApiForSong) && settingsStore.setData.customApiPlugin) {
|
||||
console.log(`优先级 1: 尝试使用自定义API解析歌曲 ${id}...`);
|
||||
try {
|
||||
const { parseFromCustomApi } = await import('@/api/parseFromCustomApi');
|
||||
const customResult = await parseFromCustomApi(
|
||||
numericId,
|
||||
cloneDeep(songData),
|
||||
settingsStore.setData.musicQuality || 'higher'
|
||||
);
|
||||
|
||||
if (
|
||||
customResult &&
|
||||
customResult.data &&
|
||||
customResult.data.data &&
|
||||
customResult.data.data.url
|
||||
) {
|
||||
console.log('自定义API解析成功!');
|
||||
if (isDownloaded) return customResult.data.data as any;
|
||||
return customResult.data.data.url;
|
||||
} else {
|
||||
console.log('自定义API解析失败,将使用默认降级流程...');
|
||||
message.warning(i18n.global.t('player.reparse.customApiFailed'));
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('调用自定义API时发生错误:', error);
|
||||
message.error(i18n.global.t('player.reparse.customApiError'));
|
||||
}
|
||||
}
|
||||
|
||||
// 如果有自定义音源设置,直接使用getParsingMusicUrl获取URL
|
||||
if (savedSourceStr && songData.source !== 'bilibili') {
|
||||
try {
|
||||
console.log(`使用自定义音源解析歌曲 ID: ${songId}`);
|
||||
const res = await getParsingMusicUrl(numericId, cloneDeep(songData));
|
||||
console.log('res', res);
|
||||
if (res && res.data && res.data.data && res.data.data.url) {
|
||||
return res.data.data.url;
|
||||
}
|
||||
console.warn('自定义音源解析失败,使用默认音源');
|
||||
} catch (error) {
|
||||
console.error('error', error);
|
||||
console.error('自定义音源解析出错:', error);
|
||||
}
|
||||
}
|
||||
|
||||
// 正常获取URL流程
|
||||
const { data } = await getMusicUrl(numericId, isDownloaded);
|
||||
if (data && data.data && data.data[0]) {
|
||||
const songDetail = data.data[0];
|
||||
const hasNoUrl = !songDetail.url;
|
||||
const isTrial = !!songDetail.freeTrialInfo;
|
||||
|
||||
if (hasNoUrl || isTrial) {
|
||||
console.log(`官方URL无效 (无URL: ${hasNoUrl}, 试听: ${isTrial}),进入内置备用解析...`);
|
||||
const res = await getParsingMusicUrl(numericId, cloneDeep(songData));
|
||||
if (isDownloaded) return res?.data?.data as any;
|
||||
return res?.data?.data?.url || null;
|
||||
}
|
||||
|
||||
console.log('官方API解析成功!');
|
||||
if (isDownloaded) return songDetail as any;
|
||||
return songDetail.url;
|
||||
}
|
||||
|
||||
console.log('官方API返回数据结构异常,进入内置备用解析...');
|
||||
const res = await getParsingMusicUrl(numericId, cloneDeep(songData));
|
||||
if (isDownloaded) return res?.data?.data as any;
|
||||
return res?.data?.data?.url || null;
|
||||
} catch (error) {
|
||||
console.error('官方API请求失败,进入内置备用解析流程:', error);
|
||||
const res = await getParsingMusicUrl(numericId, cloneDeep(songData));
|
||||
if (isDownloaded) return res?.data?.data as any;
|
||||
return res?.data?.data?.url || null;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* useSongUrl hook(兼容旧代码)
|
||||
*/
|
||||
export const useSongUrl = () => {
|
||||
return { getSongUrl };
|
||||
};
|
||||
|
||||
/**
|
||||
* 使用新的yrcParser解析歌词(独立函数)
|
||||
*/
|
||||
const parseLyrics = (lyricsString: string): { lyrics: ILyricText[]; times: number[] } => {
|
||||
if (!lyricsString || typeof lyricsString !== 'string') {
|
||||
return { lyrics: [], times: [] };
|
||||
}
|
||||
|
||||
try {
|
||||
const parseResult = parseYrcLyrics(lyricsString);
|
||||
|
||||
if (!parseResult.success) {
|
||||
console.error('歌词解析失败:', parseResult.error.message);
|
||||
return { lyrics: [], times: [] };
|
||||
}
|
||||
|
||||
const { lyrics: parsedLyrics } = parseResult.data;
|
||||
const lyrics: ILyricText[] = [];
|
||||
const times: number[] = [];
|
||||
|
||||
for (const line of parsedLyrics) {
|
||||
// 检查是否有逐字歌词
|
||||
const hasWords = line.words && line.words.length > 0;
|
||||
|
||||
lyrics.push({
|
||||
text: line.fullText,
|
||||
trText: '', // 翻译文本稍后处理
|
||||
words: hasWords ? (line.words as IWordData[]) : undefined,
|
||||
hasWordByWord: hasWords,
|
||||
startTime: line.startTime,
|
||||
duration: line.duration
|
||||
});
|
||||
|
||||
// 时间数组使用秒为单位(与原有逻辑保持一致)
|
||||
times.push(line.startTime / 1000);
|
||||
}
|
||||
|
||||
return { lyrics, times };
|
||||
} catch (error) {
|
||||
console.error('解析歌词时发生错误:', error);
|
||||
return { lyrics: [], times: [] };
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* 加载歌词(独立函数)
|
||||
*/
|
||||
export const loadLrc = async (id: string | number): Promise<ILyric> => {
|
||||
if (typeof id === 'string' && id.includes('--')) {
|
||||
console.log('B站音频,无需加载歌词');
|
||||
return {
|
||||
lrcTimeArray: [],
|
||||
lrcArray: [],
|
||||
hasWordByWord: false
|
||||
};
|
||||
}
|
||||
|
||||
try {
|
||||
const numericId = typeof id === 'string' ? parseInt(id, 10) : id;
|
||||
const { data } = await getMusicLrc(numericId);
|
||||
const { lyrics, times } = parseLyrics(data?.yrc?.lyric || data?.lrc?.lyric);
|
||||
|
||||
// 检查是否有逐字歌词
|
||||
let hasWordByWord = false;
|
||||
for (const lyric of lyrics) {
|
||||
if (lyric.hasWordByWord) {
|
||||
hasWordByWord = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (data.tlyric && data.tlyric.lyric) {
|
||||
const { lyrics: tLyrics } = parseLyrics(data.tlyric.lyric);
|
||||
|
||||
// 按索引顺序一一对应翻译歌词
|
||||
if (tLyrics.length === lyrics.length) {
|
||||
// 数量相同,直接按索引对应
|
||||
lyrics.forEach((item, index) => {
|
||||
item.trText = item.text && tLyrics[index] ? tLyrics[index].text : '';
|
||||
});
|
||||
} else {
|
||||
// 数量不同,构建时间戳映射并尝试匹配
|
||||
const tLyricMap = new Map<number, string>();
|
||||
tLyrics.forEach((lyric) => {
|
||||
if (lyric.text && lyric.startTime !== undefined) {
|
||||
const timeInSeconds = lyric.startTime / 1000;
|
||||
tLyricMap.set(timeInSeconds, lyric.text);
|
||||
}
|
||||
});
|
||||
|
||||
// 为每句歌词查找最接近的翻译
|
||||
lyrics.forEach((item, index) => {
|
||||
if (!item.text) {
|
||||
item.trText = '';
|
||||
return;
|
||||
}
|
||||
|
||||
const currentTime = times[index];
|
||||
let closestTime = -1;
|
||||
let minDiff = 2.0; // 最大允许差异2秒
|
||||
|
||||
// 查找最接近的时间戳
|
||||
for (const [tTime] of tLyricMap.entries()) {
|
||||
const diff = Math.abs(tTime - currentTime);
|
||||
if (diff < minDiff) {
|
||||
minDiff = diff;
|
||||
closestTime = tTime;
|
||||
}
|
||||
}
|
||||
|
||||
item.trText = closestTime !== -1 ? tLyricMap.get(closestTime) || '' : '';
|
||||
});
|
||||
}
|
||||
} else {
|
||||
// 没有翻译歌词,清空 trText
|
||||
lyrics.forEach((item) => {
|
||||
item.trText = '';
|
||||
});
|
||||
}
|
||||
|
||||
return {
|
||||
lrcTimeArray: times,
|
||||
lrcArray: lyrics,
|
||||
hasWordByWord
|
||||
};
|
||||
} catch (err) {
|
||||
console.error('Error loading lyrics:', err);
|
||||
return {
|
||||
lrcTimeArray: [],
|
||||
lrcArray: [],
|
||||
hasWordByWord: false
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* useLyrics hook(兼容旧代码)
|
||||
*/
|
||||
export const useLyrics = () => {
|
||||
return { loadLrc, parseLyrics };
|
||||
};
|
||||
|
||||
/**
|
||||
* 获取歌曲详情
|
||||
*/
|
||||
export const useSongDetail = () => {
|
||||
const { getSongUrl } = useSongUrl();
|
||||
|
||||
const getSongDetail = async (playMusic: SongResult) => {
|
||||
if (playMusic.source === 'bilibili') {
|
||||
try {
|
||||
if (!playMusic.playMusicUrl && playMusic.bilibiliData) {
|
||||
playMusic.playMusicUrl = await getBilibiliAudioUrl(
|
||||
playMusic.bilibiliData.bvid,
|
||||
playMusic.bilibiliData.cid
|
||||
);
|
||||
}
|
||||
|
||||
playMusic.playLoading = false;
|
||||
return { ...playMusic } as SongResult;
|
||||
} catch (error) {
|
||||
console.error('获取B站音频详情失败:', error);
|
||||
playMusic.playLoading = false;
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
if (playMusic.expiredAt && playMusic.expiredAt < Date.now()) {
|
||||
console.info(`歌曲已过期,重新获取: ${playMusic.name}`);
|
||||
playMusic.playMusicUrl = undefined;
|
||||
}
|
||||
|
||||
try {
|
||||
const playMusicUrl = playMusic.playMusicUrl || (await getSongUrl(playMusic.id, playMusic));
|
||||
playMusic.createdAt = Date.now();
|
||||
// 半小时后过期
|
||||
playMusic.expiredAt = playMusic.createdAt + 1800000;
|
||||
const { backgroundColor, primaryColor } =
|
||||
playMusic.backgroundColor && playMusic.primaryColor
|
||||
? playMusic
|
||||
: await getImageLinearBackground(getImgUrl(playMusic?.picUrl, '30y30'));
|
||||
|
||||
playMusic.playLoading = false;
|
||||
return { ...playMusic, playMusicUrl, backgroundColor, primaryColor } as SongResult;
|
||||
} catch (error) {
|
||||
console.error('获取音频URL失败:', error);
|
||||
playMusic.playLoading = false;
|
||||
throw error;
|
||||
}
|
||||
};
|
||||
|
||||
return { getSongDetail };
|
||||
};
|
||||
|
||||
/**
|
||||
* 预加载下一首歌曲音频
|
||||
*/
|
||||
export const preloadNextSong = (nextSongUrl: string): Howl | null => {
|
||||
try {
|
||||
// 清理多余的预加载实例,确保最多只有2个预加载音频
|
||||
while (preloadingSounds.value.length >= 2) {
|
||||
const oldestSound = preloadingSounds.value.shift();
|
||||
if (oldestSound) {
|
||||
try {
|
||||
oldestSound.stop();
|
||||
oldestSound.unload();
|
||||
} catch (e) {
|
||||
console.error('清理预加载音频实例失败:', e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 检查这个URL是否已经在预加载列表中
|
||||
const existingPreload = preloadingSounds.value.find(
|
||||
(sound) => (sound as any)._src === nextSongUrl
|
||||
);
|
||||
if (existingPreload) {
|
||||
console.log('该音频已在预加载列表中,跳过:', nextSongUrl);
|
||||
return existingPreload;
|
||||
}
|
||||
|
||||
const sound = new Howl({
|
||||
src: [nextSongUrl],
|
||||
html5: true,
|
||||
preload: true,
|
||||
autoplay: false
|
||||
});
|
||||
|
||||
preloadingSounds.value.push(sound);
|
||||
|
||||
sound.on('loaderror', () => {
|
||||
console.error('预加载音频失败:', nextSongUrl);
|
||||
const index = preloadingSounds.value.indexOf(sound);
|
||||
if (index > -1) {
|
||||
preloadingSounds.value.splice(index, 1);
|
||||
}
|
||||
try {
|
||||
sound.stop();
|
||||
sound.unload();
|
||||
} catch (e) {
|
||||
console.error('卸载预加载音频失败:', e);
|
||||
}
|
||||
});
|
||||
|
||||
return sound;
|
||||
} catch (error) {
|
||||
console.error('预加载音频出错:', error);
|
||||
return null;
|
||||
}
|
||||
};
|
||||
@@ -1,20 +1,21 @@
|
||||
import { useDialog, useMessage } from 'naive-ui';
|
||||
import { useMessage } from 'naive-ui';
|
||||
import { computed, ref } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
|
||||
import { usePlayerStore } from '@/store';
|
||||
import { usePlayerStore, useRecommendStore } from '@/store';
|
||||
import type { SongResult } from '@/types/music';
|
||||
import { getImgUrl } from '@/utils';
|
||||
import { getImageBackground } from '@/utils/linearColor';
|
||||
|
||||
import { dislikeRecommendedSong } from '../api/music';
|
||||
import { useArtist } from './useArtist';
|
||||
import { useDownload } from './useDownload';
|
||||
|
||||
export function useSongItem(props: { item: SongResult; canRemove?: boolean }) {
|
||||
const { t } = useI18n();
|
||||
const playerStore = usePlayerStore();
|
||||
const recommendStore = useRecommendStore();
|
||||
const message = useMessage();
|
||||
const dialog = useDialog();
|
||||
const { downloadMusic } = useDownload();
|
||||
const { navigateToArtist } = useArtist();
|
||||
|
||||
@@ -86,23 +87,57 @@ export function useSongItem(props: { item: SongResult; canRemove?: boolean }) {
|
||||
}
|
||||
};
|
||||
|
||||
// 判断当前歌曲是否为每日推荐歌曲
|
||||
const isDailyRecommendSong = computed(() => {
|
||||
return recommendStore.dailyRecommendSongs.some((song) => song.id === props.item.id);
|
||||
});
|
||||
|
||||
// 切换不喜欢状态
|
||||
const toggleDislike = async (e: Event) => {
|
||||
e && e.stopPropagation();
|
||||
|
||||
if (isDislike.value) {
|
||||
playerStore.removeFromDislikeList(props.item.id);
|
||||
return;
|
||||
}
|
||||
|
||||
dialog.warning({
|
||||
title: t('songItem.dialog.dislike.title'),
|
||||
content: t('songItem.dialog.dislike.content'),
|
||||
positiveText: t('songItem.dialog.dislike.positiveText'),
|
||||
negativeText: t('songItem.dialog.dislike.negativeText'),
|
||||
onPositiveClick: () => {
|
||||
playerStore.addToDislikeList(props.item.id);
|
||||
playerStore.addToDislikeList(props.item.id);
|
||||
|
||||
// 只有当前歌曲是每日推荐歌曲时才调用接口
|
||||
if (!isDailyRecommendSong.value) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
console.log('发送不感兴趣请求,歌曲ID:', props.item.id);
|
||||
const numericId = typeof props.item.id === 'string' ? parseInt(props.item.id) : props.item.id;
|
||||
const response = await dislikeRecommendedSong(numericId);
|
||||
if (response.data.data) {
|
||||
console.log(response);
|
||||
const newSongData = response.data.data;
|
||||
const newSong: SongResult = {
|
||||
...newSongData,
|
||||
name: newSongData.name,
|
||||
id: newSongData.id,
|
||||
picUrl: newSongData.al?.picUrl || newSongData.album?.picUrl,
|
||||
ar: newSongData.ar || newSongData.artists,
|
||||
al: newSongData.al || newSongData.album,
|
||||
song: {
|
||||
...newSongData.song,
|
||||
id: newSongData.id,
|
||||
name: newSongData.name,
|
||||
artists: newSongData.ar || newSongData.artists,
|
||||
album: newSongData.al || newSongData.album
|
||||
},
|
||||
source: 'netease',
|
||||
count: 0
|
||||
};
|
||||
recommendStore.replaceSongInDailyRecommend(props.item.id, newSong);
|
||||
} else {
|
||||
console.warn('标记不感兴趣API成功,但未返回新歌曲。', response.data);
|
||||
}
|
||||
});
|
||||
} catch (error) {
|
||||
console.error('发送不感兴趣请求时出错:', error);
|
||||
}
|
||||
};
|
||||
|
||||
// 添加到下一首播放
|
||||
|
||||
@@ -9,23 +9,23 @@
|
||||
/>
|
||||
|
||||
<!-- SEO 元数据 -->
|
||||
<title>网抑云音乐 | AlgerKong | AlgerMusicPlayer</title>
|
||||
<title>AlgerMusicPlayer | algerkong</title>
|
||||
<meta
|
||||
name="description"
|
||||
content="AlgerMusicPlayer 网抑云音乐 基于 网易云音乐API 的一款免费的在线音乐播放器,支持在线播放、歌词显示、音乐下载等功能。提供海量音乐资源,让您随时随地享受音乐。"
|
||||
content="AlgerMusicPlayer 音乐播放器,支持在线播放、歌词显示、音乐下载等功能。提供海量音乐资源,让您随时随地享受音乐。"
|
||||
/>
|
||||
<meta
|
||||
name="keywords"
|
||||
content="AlgerMusic, AlgerMusicPlayer, 网抑云, 音乐播放器, 在线音乐, 免费音乐, 歌词显示, 音乐下载, AlgerKong, 网易云音乐"
|
||||
content="AlgerMusic, AlgerMusicPlayer, 音乐播放器, 在线音乐, 歌词显示, 音乐下载, AlgerKong, algerkong"
|
||||
/>
|
||||
|
||||
<!-- 作者信息 -->
|
||||
<meta name="author" content="AlgerKong" />
|
||||
<meta name="author" content="algerkong" />
|
||||
<meta name="author-url" content="https://github.com/algerkong" />
|
||||
|
||||
<meta name="apple-mobile-web-app-capable" content="yes" />
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
|
||||
<meta name="apple-mobile-web-app-title" content="网抑云音乐" />
|
||||
|
||||
<!-- 资源预加载 -->
|
||||
<link rel="preload" href="./assets/icon/iconfont.css" as="style" />
|
||||
<link rel="preload" href="./assets/css/base.css" as="style" />
|
||||
@@ -34,6 +34,25 @@
|
||||
<link rel="stylesheet" href="./assets/icon/iconfont.css" />
|
||||
<link rel="stylesheet" href="./assets/css/base.css" />
|
||||
|
||||
<!-- 百度统计 -->
|
||||
<script>
|
||||
var _hmt = _hmt || [];
|
||||
(function () {
|
||||
var hm = document.createElement('script');
|
||||
hm.src = 'https://hm.baidu.com/hm.js?75a7ee3d3875dfdd2fe9d134883ddcbd';
|
||||
var s = document.getElementsByTagName('script')[0];
|
||||
s.parentNode.insertBefore(hm, s);
|
||||
})();
|
||||
</script>
|
||||
<script>
|
||||
var _hmt = _hmt || [];
|
||||
(function () {
|
||||
var hm = document.createElement('script');
|
||||
hm.src = 'https://hm.baidu.com/hm.js?27b3850e627d266b20b38cce19af18f7';
|
||||
var s = document.getElementsByTagName('script')[0];
|
||||
s.parentNode.insertBefore(hm, s);
|
||||
})();
|
||||
</script>
|
||||
<!-- 动画配置 -->
|
||||
<style>
|
||||
:root {
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<title-bar />
|
||||
<div class="layout-main-page">
|
||||
<!-- 侧边菜单栏 -->
|
||||
<app-menu v-if="!isMobile" class="menu" :menus="menus" />
|
||||
<app-menu v-if="!settingsStore.isMobile" class="menu" :menus="menuStore.menus" />
|
||||
<div class="main">
|
||||
<!-- 搜索栏 -->
|
||||
<search-bar />
|
||||
@@ -17,7 +17,7 @@
|
||||
<router-view
|
||||
v-slot="{ Component }"
|
||||
class="main-page"
|
||||
:class="route.meta.noScroll && !isMobile ? 'pr-3' : ''"
|
||||
:class="route.meta.noScroll && !settingsStore.isMobile ? 'pr-3' : ''"
|
||||
>
|
||||
<keep-alive :include="keepAliveInclude">
|
||||
<component :is="Component" />
|
||||
@@ -25,27 +25,27 @@
|
||||
</router-view>
|
||||
</div>
|
||||
<play-bottom />
|
||||
<app-menu v-if="shouldShowMobileMenu" class="menu" :menus="menus" />
|
||||
<app-menu v-if="shouldShowMobileMenu" class="menu" :menus="menuStore.menus" />
|
||||
</div>
|
||||
</div>
|
||||
<!-- 底部音乐播放 -->
|
||||
<template v-if="!settingsStore.isMiniMode">
|
||||
<play-bar
|
||||
v-if="!isMobile"
|
||||
v-if="!settingsStore.isMobile"
|
||||
v-show="isPlay"
|
||||
:style="playerStore.musicFull ? 'bottom: 0;' : ''"
|
||||
/>
|
||||
<mobile-play-bar
|
||||
v-else
|
||||
v-show="isPlay"
|
||||
:style="isMobile && playerStore.musicFull ? 'bottom: 0;' : ''"
|
||||
:style="settingsStore.isMobile && playerStore.musicFull ? 'bottom: 0;' : ''"
|
||||
/>
|
||||
</template>
|
||||
</div>
|
||||
<install-app-modal v-if="!isElectron"></install-app-modal>
|
||||
<update-modal v-if="isElectron" />
|
||||
<playlist-drawer v-model="showPlaylistDrawer" :song-id="currentSongId" />
|
||||
<sleep-timer-top v-if="!isMobile" />
|
||||
<sleep-timer-top v-if="!settingsStore.isMobile" />
|
||||
<!-- 下载管理抽屉 -->
|
||||
<download-drawer
|
||||
v-if="
|
||||
@@ -74,7 +74,7 @@ import otherRouter from '@/router/other';
|
||||
import { useMenuStore } from '@/store/modules/menu';
|
||||
import { usePlayerStore } from '@/store/modules/player';
|
||||
import { useSettingsStore } from '@/store/modules/settings';
|
||||
import { isElectron, isMobile } from '@/utils';
|
||||
import { isElectron } from '@/utils';
|
||||
|
||||
const keepAliveInclude = computed(() => {
|
||||
const allRoutes = [...homeRouter, ...otherRouter];
|
||||
@@ -106,15 +106,14 @@ const settingsStore = useSettingsStore();
|
||||
const menuStore = useMenuStore();
|
||||
|
||||
const isPlay = computed(() => playerStore.playMusic && playerStore.playMusic.id);
|
||||
const { menus } = menuStore;
|
||||
const route = useRoute();
|
||||
|
||||
// 判断当前路由是否应该在移动端显示AppMenu
|
||||
const shouldShowMobileMenu = computed(() => {
|
||||
// 过滤出在menus中定义的路径
|
||||
const menuPaths = menus.map((item: any) => item.path);
|
||||
const menuPaths = menuStore.menus.map((item: any) => item.path);
|
||||
// 检查当前路由路径是否在menus中
|
||||
return menuPaths.includes(route.path) && isMobile.value && !playerStore.musicFull;
|
||||
return menuPaths.includes(route.path) && settingsStore.isMobile && !playerStore.musicFull;
|
||||
});
|
||||
|
||||
provide('shouldShowMobileMenu', shouldShowMobileMenu);
|
||||
|
||||
@@ -1,15 +1,19 @@
|
||||
<template>
|
||||
<div>
|
||||
<!-- menu -->
|
||||
<div class="app-menu" :class="{ 'app-menu-expanded': isText }">
|
||||
<div class="app-menu" :class="{ 'app-menu-expanded': settingsStore.setData.isMenuExpanded }">
|
||||
<div class="app-menu-header">
|
||||
<div class="app-menu-logo" @click="isText = !isText">
|
||||
<div class="app-menu-logo" @click="toggleMenu">
|
||||
<img :src="icon" class="w-9 h-9" alt="logo" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="app-menu-list">
|
||||
<div v-for="(item, index) in menus" :key="item.path" class="app-menu-item">
|
||||
<n-tooltip :delay="200" :disabled="isText || isMobile" placement="bottom">
|
||||
<n-tooltip
|
||||
:delay="200"
|
||||
:disabled="settingsStore.setData.isMenuExpanded || isMobile"
|
||||
placement="bottom"
|
||||
>
|
||||
<template #trigger>
|
||||
<router-link class="app-menu-item-link" :to="item.path">
|
||||
<i
|
||||
@@ -18,14 +22,14 @@
|
||||
:class="item.meta.icon"
|
||||
></i>
|
||||
<span
|
||||
v-if="isText"
|
||||
v-if="settingsStore.setData.isMenuExpanded"
|
||||
class="app-menu-item-text ml-3"
|
||||
:class="isChecked(index) ? 'text-green-500' : ''"
|
||||
>{{ t(item.meta.title) }}</span
|
||||
>
|
||||
</router-link>
|
||||
</template>
|
||||
<div v-if="!isText">{{ t(item.meta.title) }}</div>
|
||||
<div v-if="!settingsStore.setData.isMenuExpanded">{{ t(item.meta.title) }}</div>
|
||||
</n-tooltip>
|
||||
</div>
|
||||
</div>
|
||||
@@ -39,6 +43,7 @@ import { useI18n } from 'vue-i18n';
|
||||
import { useRoute } from 'vue-router';
|
||||
|
||||
import icon from '@/assets/icon.png';
|
||||
import { useSettingsStore } from '@/store';
|
||||
import { isMobile } from '@/utils';
|
||||
|
||||
const props = defineProps({
|
||||
@@ -62,6 +67,7 @@ const props = defineProps({
|
||||
|
||||
const route = useRoute();
|
||||
const path = ref(route.path);
|
||||
const settingsStore = useSettingsStore();
|
||||
watch(
|
||||
() => route.path,
|
||||
async (newParams) => {
|
||||
@@ -83,7 +89,11 @@ const iconStyle = (index: number) => {
|
||||
return style;
|
||||
};
|
||||
|
||||
const isText = ref(false);
|
||||
const toggleMenu = () => {
|
||||
settingsStore.setSetData({
|
||||
isMenuExpanded: !settingsStore.setData.isMenuExpanded
|
||||
});
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
@@ -95,10 +105,11 @@ const isText = ref(false);
|
||||
max-height: calc(100vh - 120px); /* 为header预留空间,防止菜单项被遮挡 */
|
||||
overflow-y: auto;
|
||||
overflow-x: hidden;
|
||||
/* 自定义滚动条样式 */
|
||||
/* 自定义滚动条样式 - 默认隐藏,悬停时显示 */
|
||||
scrollbar-width: thin;
|
||||
scrollbar-color: rgba(156, 163, 175, 0.5) transparent;
|
||||
scrollbar-color: transparent transparent;
|
||||
padding-bottom: 20px;
|
||||
transition: scrollbar-color 0.3s ease;
|
||||
|
||||
&::-webkit-scrollbar {
|
||||
width: 4px;
|
||||
@@ -109,11 +120,21 @@ const isText = ref(false);
|
||||
}
|
||||
|
||||
&::-webkit-scrollbar-thumb {
|
||||
background-color: rgba(156, 163, 175, 0.5);
|
||||
background-color: transparent;
|
||||
border-radius: 2px;
|
||||
transition: background-color 0.3s ease;
|
||||
}
|
||||
|
||||
&:hover {
|
||||
background-color: rgba(156, 163, 175, 0.7);
|
||||
/* 悬停时显示滚动条 */
|
||||
&:hover {
|
||||
scrollbar-color: rgba(156, 163, 175, 0.5) transparent;
|
||||
|
||||
&::-webkit-scrollbar-thumb {
|
||||
background-color: rgba(156, 163, 175, 0.5);
|
||||
|
||||
&:hover {
|
||||
background-color: rgba(156, 163, 175, 0.7);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,29 +3,64 @@
|
||||
<div v-if="showBackButton" class="back-button" @click="goBack">
|
||||
<i class="ri-arrow-left-line"></i>
|
||||
</div>
|
||||
<div class="search-box-input flex-1">
|
||||
<n-input
|
||||
v-model:value="searchValue"
|
||||
size="medium"
|
||||
round
|
||||
:placeholder="hotSearchKeyword"
|
||||
class="border dark:border-gray-600 border-gray-200"
|
||||
@keydown.enter="search"
|
||||
<div class="search-box-input flex-1 relative">
|
||||
<n-popover
|
||||
trigger="manual"
|
||||
placement="bottom-start"
|
||||
:show="showSuggestions"
|
||||
:show-arrow="false"
|
||||
style="width: 100%; margin-top: 4px"
|
||||
content-style="padding: 0; border-radius: 12px; box-shadow: 0 4px 12px rgba(0,0,0,0.1);"
|
||||
raw
|
||||
>
|
||||
<template #prefix>
|
||||
<i class="iconfont icon-search"></i>
|
||||
<template #trigger>
|
||||
<n-input
|
||||
v-model:value="searchValue"
|
||||
size="medium"
|
||||
round
|
||||
:placeholder="hotSearchKeyword"
|
||||
class="border dark:border-gray-600 border-gray-200"
|
||||
@input="handleInput"
|
||||
@keydown="handleKeydown"
|
||||
@focus="handleFocus"
|
||||
@blur="handleBlur"
|
||||
>
|
||||
<template #prefix>
|
||||
<i class="iconfont icon-search"></i>
|
||||
</template>
|
||||
<template #suffix>
|
||||
<n-dropdown trigger="hover" :options="searchTypeOptions" @select="selectSearchType">
|
||||
<div class="w-20 px-3 flex justify-between items-center">
|
||||
<div>
|
||||
{{
|
||||
searchTypeOptions.find((item) => item.key === searchStore.searchType)?.label
|
||||
}}
|
||||
</div>
|
||||
<i class="iconfont icon-xiasanjiaoxing"></i>
|
||||
</div>
|
||||
</n-dropdown>
|
||||
</template>
|
||||
</n-input>
|
||||
</template>
|
||||
<template #suffix>
|
||||
<n-dropdown trigger="hover" :options="searchTypeOptions" @select="selectSearchType">
|
||||
<div class="w-20 px-3 flex justify-between items-center">
|
||||
<div>
|
||||
{{ searchTypeOptions.find((item) => item.key === searchStore.searchType)?.label }}
|
||||
</div>
|
||||
<i class="iconfont icon-xiasanjiaoxing"></i>
|
||||
<div class="search-suggestions-panel">
|
||||
<n-scrollbar style="max-height: 300px">
|
||||
<div v-if="suggestionsLoading" class="suggestion-item loading">
|
||||
<n-spin size="small" />
|
||||
</div>
|
||||
</n-dropdown>
|
||||
</template>
|
||||
</n-input>
|
||||
<div
|
||||
v-for="(suggestion, index) in suggestions"
|
||||
:key="index"
|
||||
class="suggestion-item"
|
||||
:class="{ highlighted: index === highlightedIndex }"
|
||||
@mousedown.prevent="selectSuggestion(suggestion)"
|
||||
@mouseenter="highlightedIndex = index"
|
||||
>
|
||||
<i class="ri-search-line suggestion-icon"></i>
|
||||
<span>{{ suggestion }}</span>
|
||||
</div>
|
||||
</n-scrollbar>
|
||||
</div>
|
||||
</n-popover>
|
||||
</div>
|
||||
<n-popover trigger="hover" placement="bottom" :show-arrow="false" raw>
|
||||
<template #trigger>
|
||||
@@ -128,16 +163,18 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { useDebounceFn } from '@vueuse/core';
|
||||
import { computed, onMounted, ref, watch, watchEffect } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useRouter } from 'vue-router';
|
||||
|
||||
import { getSearchKeyword } from '@/api/home';
|
||||
import { getUserDetail } from '@/api/login';
|
||||
import { getSearchSuggestions } from '@/api/search';
|
||||
import alipay from '@/assets/alipay.png';
|
||||
import wechat from '@/assets/wechat.png';
|
||||
import Coffee from '@/components/Coffee.vue';
|
||||
import { SEARCH_TYPES, USER_SET_OPTIONS } from '@/const/bar-const';
|
||||
import { SEARCH_TYPE, SEARCH_TYPES, USER_SET_OPTIONS } from '@/const/bar-const';
|
||||
import { useZoom } from '@/hooks/useZoom';
|
||||
import { useSearchStore } from '@/store/modules/search';
|
||||
import { useSettingsStore } from '@/store/modules/settings';
|
||||
@@ -180,7 +217,6 @@ const loadPage = async () => {
|
||||
const token = localStorage.getItem('token');
|
||||
if (!token) return;
|
||||
const { data } = await getUserDetail();
|
||||
console.log('data', data);
|
||||
userStore.user =
|
||||
data.profile || userStore.user || JSON.parse(localStorage.getItem('user') || '{}');
|
||||
localStorage.setItem('user', JSON.stringify(userStore.user));
|
||||
@@ -250,6 +286,9 @@ const search = () => {
|
||||
type: searchStore.searchType
|
||||
}
|
||||
});
|
||||
|
||||
console.log(`[UI] 执行搜索,关键词: "${searchValue.value}"`); // <--- 日志 K
|
||||
showSuggestions.value = false; // 搜索后强制隐藏
|
||||
};
|
||||
|
||||
const selectSearchType = (key: number) => {
|
||||
@@ -271,12 +310,13 @@ const selectSearchType = (key: number) => {
|
||||
|
||||
const rawSearchTypes = ref(SEARCH_TYPES);
|
||||
const searchTypeOptions = computed(() => {
|
||||
// 引用 locale 以创建响应式依赖
|
||||
locale.value;
|
||||
return rawSearchTypes.value.map((type) => ({
|
||||
label: t(type.label),
|
||||
key: type.key
|
||||
}));
|
||||
return rawSearchTypes.value
|
||||
.filter((type) => isElectron || type.key !== SEARCH_TYPE.BILIBILI)
|
||||
.map((type) => ({
|
||||
label: t(type.label),
|
||||
key: type.key
|
||||
}));
|
||||
});
|
||||
|
||||
const selectItem = async (key: string) => {
|
||||
@@ -330,6 +370,84 @@ const toGithubRelease = () => {
|
||||
window.open('https://github.com/algerkong/AlgerMusicPlayer/releases', '_blank');
|
||||
}
|
||||
};
|
||||
|
||||
// ==================== 搜索建议相关的状态和方法 ====================
|
||||
const suggestions = ref<string[]>([]);
|
||||
const showSuggestions = ref(false);
|
||||
const suggestionsLoading = ref(false);
|
||||
const highlightedIndex = ref(-1); // -1 表示没有高亮项
|
||||
// 使用防抖函数来避免频繁请求API
|
||||
const debouncedGetSuggestions = useDebounceFn(async (keyword: string) => {
|
||||
if (!keyword.trim()) {
|
||||
suggestions.value = [];
|
||||
showSuggestions.value = false;
|
||||
return;
|
||||
}
|
||||
suggestionsLoading.value = true;
|
||||
suggestions.value = await getSearchSuggestions(keyword);
|
||||
suggestionsLoading.value = false;
|
||||
// 只有当有建议时才显示面板
|
||||
showSuggestions.value = suggestions.value.length > 0;
|
||||
highlightedIndex.value = -1;
|
||||
}, 300); // 300ms延迟
|
||||
|
||||
const handleInput = (value: string) => {
|
||||
debouncedGetSuggestions(value);
|
||||
};
|
||||
const handleFocus = () => {
|
||||
if (searchValue.value && suggestions.value.length > 0) {
|
||||
showSuggestions.value = true;
|
||||
}
|
||||
};
|
||||
|
||||
const handleBlur = () => {
|
||||
setTimeout(() => {
|
||||
showSuggestions.value = false;
|
||||
}, 150);
|
||||
};
|
||||
|
||||
const selectSuggestion = (suggestion: string) => {
|
||||
searchValue.value = suggestion;
|
||||
showSuggestions.value = false;
|
||||
search();
|
||||
};
|
||||
const handleKeydown = (event: KeyboardEvent) => {
|
||||
// 如果建议列表不显示,则不处理上下键
|
||||
if (!showSuggestions.value || suggestions.value.length === 0) {
|
||||
// 如果是回车键,则正常执行搜索
|
||||
if (event.key === 'Enter') {
|
||||
search();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
switch (event.key) {
|
||||
case 'ArrowDown':
|
||||
event.preventDefault(); // 阻止光标移动到末尾
|
||||
highlightedIndex.value = (highlightedIndex.value + 1) % suggestions.value.length;
|
||||
break;
|
||||
case 'ArrowUp':
|
||||
event.preventDefault(); // 阻止光标移动到开头
|
||||
highlightedIndex.value =
|
||||
(highlightedIndex.value - 1 + suggestions.value.length) % suggestions.value.length;
|
||||
break;
|
||||
case 'Enter':
|
||||
event.preventDefault(); // 阻止表单默认提交行为
|
||||
if (highlightedIndex.value !== -1) {
|
||||
// 如果有高亮项,就选择它
|
||||
selectSuggestion(suggestions.value[highlightedIndex.value]);
|
||||
} else {
|
||||
// 否则,执行默认搜索
|
||||
search();
|
||||
}
|
||||
break;
|
||||
case 'Escape':
|
||||
showSuggestions.value = false; // 按 Esc 隐藏建议
|
||||
break;
|
||||
}
|
||||
};
|
||||
|
||||
// ================================================================
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
@@ -437,4 +555,22 @@ const toGithubRelease = () => {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.search-suggestions-panel {
|
||||
@apply bg-light dark:bg-dark-100 rounded-lg overflow-hidden;
|
||||
.suggestion-item {
|
||||
@apply flex items-center px-4 py-2 cursor-pointer;
|
||||
@apply text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800;
|
||||
&.highlighted {
|
||||
@apply bg-gray-100 dark:bg-gray-800;
|
||||
}
|
||||
&.loading {
|
||||
@apply justify-center;
|
||||
}
|
||||
|
||||
.suggestion-icon {
|
||||
@apply mr-2 text-gray-400;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -86,6 +86,28 @@ const otherRouter = [
|
||||
back: true
|
||||
},
|
||||
component: () => import('@/views/playlist/ImportPlaylist.vue')
|
||||
},
|
||||
{
|
||||
path: '/heatmap',
|
||||
name: 'heatmap',
|
||||
meta: {
|
||||
title: '播放热力图',
|
||||
keepAlive: true,
|
||||
showInMenu: false,
|
||||
back: true
|
||||
},
|
||||
component: () => import('@/views/heatmap/index.vue')
|
||||
},
|
||||
{
|
||||
path: '/history-recommend',
|
||||
name: 'historyRecommend',
|
||||
meta: {
|
||||
title: '历史日推',
|
||||
keepAlive: true,
|
||||
showInMenu: false,
|
||||
back: true
|
||||
},
|
||||
component: () => import('@/views/music/HistoryRecommend.vue')
|
||||
}
|
||||
];
|
||||
export default otherRouter;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user