Skip to content

Commit edd393c

Browse files
committed
feat: 新增歌单导入功能
添加歌单导入功能,支持通过链接、文本和元数据三种方式导入歌单 - 实现链接导入、文本导入和元数据导入三种方式 - 添加导入状态检查和显示功能
1 parent 8988cdb commit edd393c

File tree

9 files changed

+803
-4
lines changed

9 files changed

+803
-4
lines changed

src/i18n/lang/en-US/common.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ export default {
2727
refresh: 'Refresh',
2828
retry: 'Retry',
2929
reset: 'Reset',
30+
back: 'Back',
3031
copySuccess: 'Copied to clipboard',
3132
copyFailed: 'Copy failed',
3233
validation: {

src/i18n/lang/en-US/comp.ts

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,5 +120,65 @@ export default {
120120
addToPlaylistSuccess: 'Add to Playlist Success',
121121
operationFailed: 'Operation Failed',
122122
songsAlreadyInPlaylist: 'Songs already in playlist'
123+
},
124+
playlist: {
125+
import: {
126+
button: 'Import Playlist',
127+
title: 'Import Playlist',
128+
description: 'Import playlists via metadata, text, or links',
129+
linkTab: 'Import by Link',
130+
textTab: 'Import by Text',
131+
localTab: 'Import by Metadata',
132+
linkPlaceholder: 'Enter playlist links, one per line',
133+
textPlaceholder: 'Enter song information in format: Song Name Artist Name',
134+
localPlaceholder: 'Enter song metadata in JSON format',
135+
linkTips: 'Supported link sources:',
136+
linkTip1: 'Copy links after sharing playlists to WeChat/Weibo/QQ',
137+
linkTip2: 'Directly copy playlist/profile links',
138+
linkTip3: 'Directly copy article links',
139+
textTips: 'Enter song information, one song per line',
140+
textFormat: 'Format: Song Name Artist Name',
141+
localTips: 'Add song metadata',
142+
localFormat: 'Format example:',
143+
songNamePlaceholder: 'Song Name',
144+
artistNamePlaceholder: 'Artist Name',
145+
albumNamePlaceholder: 'Album Name',
146+
addSongButton: 'Add Song',
147+
addLinkButton: 'Add Link',
148+
importToStarPlaylist: 'Import to My Favorite Music',
149+
playlistNamePlaceholder: 'Enter playlist name',
150+
importButton: 'Start Import',
151+
emptyLinkWarning: 'Please enter playlist links',
152+
emptyTextWarning: 'Please enter song information',
153+
emptyLocalWarning: 'Please enter song metadata',
154+
invalidJsonFormat: 'Invalid JSON format',
155+
importSuccess: 'Import task created successfully',
156+
importFailed: 'Import failed',
157+
importStatus: 'Import Status',
158+
refresh: 'Refresh',
159+
taskId: 'Task ID',
160+
status: 'Status',
161+
successCount: 'Success Count',
162+
failReason: 'Failure Reason',
163+
unknownError: 'Unknown error',
164+
statusPending: 'Pending',
165+
statusProcessing: 'Processing',
166+
statusSuccess: 'Success',
167+
statusFailed: 'Failed',
168+
statusUnknown: 'Unknown',
169+
taskList: 'Task List',
170+
taskListTitle: 'Import Task List',
171+
action: 'Action',
172+
select: 'Select',
173+
fetchTaskListFailed: 'Failed to fetch task list',
174+
noTasks: 'No import tasks',
175+
clearTasks: 'Clear Tasks',
176+
clearTasksConfirmTitle: 'Confirm Clear',
177+
clearTasksConfirmContent: 'Are you sure you want to clear all import task records? This action cannot be undone.',
178+
confirm: 'Confirm',
179+
cancel: 'Cancel',
180+
clearTasksSuccess: 'Task list cleared',
181+
clearTasksFailed: 'Failed to clear task list'
182+
}
123183
}
124184
};

src/i18n/lang/zh-CN/common.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ export default {
2727
refresh: '刷新',
2828
retry: '重试',
2929
reset: '重置',
30+
back: '返回',
3031
copySuccess: '已复制到剪贴板',
3132
copyFailed: '复制失败',
3233
validation: {

src/i18n/lang/zh-CN/comp.ts

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,5 +118,65 @@ export default {
118118
addToPlaylist: '添加到播放列表',
119119
addToPlaylistSuccess: '添加到播放列表成功',
120120
songsAlreadyInPlaylist: '歌曲已存在于播放列表中'
121+
},
122+
playlist: {
123+
import: {
124+
button: '歌单导入',
125+
title: '歌单导入',
126+
description: '支持通过元数据/文字/链接三种方式导入歌单',
127+
linkTab: '链接导入',
128+
textTab: '文字导入',
129+
localTab: '元数据导入',
130+
linkPlaceholder: '请输入歌单链接,每行一个',
131+
textPlaceholder: '请输入歌曲信息,格式为:歌曲名 歌手名',
132+
localPlaceholder: '请输入JSON格式的歌曲元数据',
133+
linkTips: '支持的链接来源:',
134+
linkTip1: '将歌单分享到微信/微博/QQ后复制链接',
135+
linkTip2: '直接复制歌单/个人主页链接',
136+
linkTip3: '直接复制文章链接',
137+
textTips: '请输入歌曲信息,每行一首歌',
138+
textFormat: '格式:歌曲名 歌手名',
139+
localTips: '请添加歌曲元数据',
140+
localFormat: '格式示例:',
141+
songNamePlaceholder: '歌曲名称',
142+
artistNamePlaceholder: '艺术家名称',
143+
albumNamePlaceholder: '专辑名称',
144+
addSongButton: '添加歌曲',
145+
addLinkButton: '添加链接',
146+
importToStarPlaylist: '导入到我喜欢的音乐',
147+
playlistNamePlaceholder: '请输入歌单名称',
148+
importButton: '开始导入',
149+
emptyLinkWarning: '请输入歌单链接',
150+
emptyTextWarning: '请输入歌曲信息',
151+
emptyLocalWarning: '请输入歌曲元数据',
152+
invalidJsonFormat: 'JSON格式不正确',
153+
importSuccess: '导入任务创建成功',
154+
importFailed: '导入失败',
155+
importStatus: '导入状态',
156+
refresh: '刷新',
157+
taskId: '任务ID',
158+
status: '状态',
159+
successCount: '成功数量',
160+
failReason: '失败原因',
161+
unknownError: '未知错误',
162+
statusPending: '等待处理',
163+
statusProcessing: '处理中',
164+
statusSuccess: '导入成功',
165+
statusFailed: '导入失败',
166+
statusUnknown: '未知状态',
167+
taskList: '任务列表',
168+
taskListTitle: '导入任务列表',
169+
action: '操作',
170+
select: '选择',
171+
fetchTaskListFailed: '获取任务列表失败',
172+
noTasks: '暂无导入任务',
173+
clearTasks: '清除任务',
174+
clearTasksConfirmTitle: '确认清除',
175+
clearTasksConfirmContent: '确定要清除所有导入任务记录吗?此操作不可恢复。',
176+
confirm: '确认',
177+
cancel: '取消',
178+
clearTasksSuccess: '任务列表已清除',
179+
clearTasksFailed: '清除任务列表失败'
180+
}
121181
}
122182
};

src/renderer/api/playlist.ts

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import request from '@/utils/request';
2+
3+
/**
4+
* 歌单导入 - 元数据/文字/链接导入
5+
* @param params 导入参数
6+
*/
7+
export function importPlaylist(params: {
8+
local?: string;
9+
text?: string;
10+
link?: string;
11+
importStarPlaylist?: boolean;
12+
playlistName?: string;
13+
}) {
14+
return request.post('/playlist/import/name/task/create', params);
15+
}
16+
17+
/**
18+
* 歌单导入 - 任务状态
19+
* @param id 任务ID
20+
*/
21+
export function getImportTaskStatus(id: string | number) {
22+
return request({
23+
url: '/playlist/import/task/status',
24+
method: 'get',
25+
params: { id }
26+
});
27+
}

src/renderer/components.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ declare module 'vue' {
1313
NBadge: typeof import('naive-ui')['NBadge']
1414
NButton: typeof import('naive-ui')['NButton']
1515
NButtonGroup: typeof import('naive-ui')['NButtonGroup']
16+
NCard: typeof import('naive-ui')['NCard']
1617
NCarousel: typeof import('naive-ui')['NCarousel']
1718
NCarouselItem: typeof import('naive-ui')['NCarouselItem']
1819
NCheckbox: typeof import('naive-ui')['NCheckbox']

src/renderer/router/other.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,16 @@ const otherRouter = [
7676
back: true
7777
},
7878
component: () => import('@/views/music/MusicListPage.vue')
79-
}
79+
},
80+
{
81+
path: '/playlist/import',
82+
name: 'playlistImport',
83+
meta: {
84+
title: '歌单导入',
85+
keepAlive: true,
86+
back: true
87+
},
88+
component: () => import('@/views/playlist/ImportPlaylist.vue')
89+
},
8090
];
8191
export default otherRouter;

0 commit comments

Comments
 (0)