@neteasecloudmusicapienhanced/api 4.29.21 → 4.30.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.MD +9 -0
- package/interface.d.ts +2 -0
- package/module/musician_vip_tasks.js +11 -0
- package/module/user_playlist_collect.js +14 -0
- package/module/user_playlist_create.js +14 -0
- package/package.json +12 -8
- package/public/api.html +115 -49
- package/public/audio_match_demo/afp.js +2 -3
- package/public/audio_match_demo/index.html +213 -44
- package/public/avatar_update.html +296 -43
- package/public/cloud.html +148 -40
- package/public/docs/home.md +45 -0
- package/public/docs/index.html +3 -3
- package/public/eapi_decrypt.html +174 -36
- package/public/index.html +18 -18
- package/public/listen_together_host.html +294 -65
- package/public/login.html +190 -18
- package/public/playlist_cover_update.html +278 -31
- package/public/playlist_import.html +381 -226
- package/public/qrlogin-nocookie.html +170 -43
- package/public/qrlogin.html +170 -42
- package/public/unblock_test.html +95 -35
- package/public/voice_upload.html +256 -57
- package/server.js +1 -1
- package/util/client-sign.js +1 -1
- package/util/request.js +6 -6
|
@@ -2,261 +2,416 @@
|
|
|
2
2
|
<html lang="zh-CN">
|
|
3
3
|
<head>
|
|
4
4
|
<meta charset="UTF-8">
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
5
6
|
<title>歌单导入工具</title>
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
7
|
+
<style>
|
|
8
|
+
* {
|
|
9
|
+
margin: 0;
|
|
10
|
+
padding: 0;
|
|
11
|
+
box-sizing: border-box;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
body {
|
|
15
|
+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
|
|
16
|
+
min-height: 100vh;
|
|
17
|
+
background: #f5f5f5;
|
|
18
|
+
padding: 20px;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.container {
|
|
22
|
+
max-width: 900px;
|
|
23
|
+
margin: 0 auto;
|
|
24
|
+
background: white;
|
|
25
|
+
border-radius: 12px;
|
|
26
|
+
padding: 32px;
|
|
27
|
+
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
h1 {
|
|
31
|
+
font-size: 24px;
|
|
32
|
+
font-weight: 600;
|
|
33
|
+
color: #333;
|
|
34
|
+
margin-bottom: 8px;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.subtitle {
|
|
38
|
+
font-size: 14px;
|
|
39
|
+
color: #666;
|
|
40
|
+
margin-bottom: 24px;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.tabs {
|
|
44
|
+
display: flex;
|
|
45
|
+
gap: 4px;
|
|
46
|
+
margin-bottom: 24px;
|
|
47
|
+
border-bottom: 1px solid #eee;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.tab-btn {
|
|
51
|
+
padding: 12px 24px;
|
|
52
|
+
background: transparent;
|
|
53
|
+
border: none;
|
|
54
|
+
border-bottom: 2px solid transparent;
|
|
55
|
+
font-size: 14px;
|
|
56
|
+
font-weight: 500;
|
|
57
|
+
color: #666;
|
|
58
|
+
cursor: pointer;
|
|
59
|
+
transition: all 0.2s ease;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.tab-btn:hover {
|
|
63
|
+
color: #333;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.tab-btn.active {
|
|
67
|
+
color: #333;
|
|
68
|
+
border-bottom-color: #333;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.tab-content {
|
|
72
|
+
display: none;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.tab-content.active {
|
|
76
|
+
display: block;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.form-group {
|
|
80
|
+
margin-bottom: 20px;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
label {
|
|
84
|
+
display: block;
|
|
85
|
+
font-size: 14px;
|
|
86
|
+
font-weight: 500;
|
|
87
|
+
color: #555;
|
|
88
|
+
margin-bottom: 8px;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
input[type="text"], textarea {
|
|
92
|
+
width: 100%;
|
|
93
|
+
padding: 10px 14px;
|
|
94
|
+
border: 1px solid #ddd;
|
|
95
|
+
border-radius: 6px;
|
|
96
|
+
font-size: 14px;
|
|
97
|
+
outline: none;
|
|
98
|
+
font-family: inherit;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
input[type="text"]:focus, textarea:focus {
|
|
102
|
+
border-color: #333;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
textarea {
|
|
106
|
+
min-height: 120px;
|
|
107
|
+
resize: vertical;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
table {
|
|
111
|
+
width: 100%;
|
|
112
|
+
border-collapse: collapse;
|
|
113
|
+
margin-bottom: 16px;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
table th, table td {
|
|
117
|
+
padding: 12px;
|
|
118
|
+
text-align: left;
|
|
119
|
+
border-bottom: 1px solid #eee;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
table th {
|
|
123
|
+
font-size: 14px;
|
|
124
|
+
font-weight: 600;
|
|
125
|
+
color: #555;
|
|
126
|
+
background: #f9f9f9;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
table td input {
|
|
130
|
+
width: 100%;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
.btn {
|
|
134
|
+
padding: 10px 20px;
|
|
135
|
+
background: #333;
|
|
136
|
+
color: white;
|
|
137
|
+
font-size: 14px;
|
|
138
|
+
font-weight: 500;
|
|
139
|
+
border: none;
|
|
140
|
+
border-radius: 6px;
|
|
141
|
+
cursor: pointer;
|
|
142
|
+
transition: background 0.2s ease;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
.btn:hover {
|
|
146
|
+
background: #555;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
.btn-secondary {
|
|
150
|
+
background: #666;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
.btn-secondary:hover {
|
|
154
|
+
background: #888;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
.input-group {
|
|
158
|
+
display: flex;
|
|
159
|
+
gap: 8px;
|
|
160
|
+
margin-bottom: 12px;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
.input-group input {
|
|
164
|
+
flex: 1;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
.checkbox-group {
|
|
168
|
+
display: flex;
|
|
169
|
+
align-items: center;
|
|
170
|
+
gap: 8px;
|
|
171
|
+
margin-bottom: 24px;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
.checkbox-group input[type="checkbox"] {
|
|
175
|
+
cursor: pointer;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
.checkbox-group label {
|
|
179
|
+
margin: 0;
|
|
180
|
+
cursor: pointer;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
input:disabled {
|
|
184
|
+
background: #f5f5f5;
|
|
185
|
+
cursor: not-allowed;
|
|
186
|
+
}
|
|
187
|
+
</style>
|
|
12
188
|
</head>
|
|
13
189
|
<body>
|
|
14
|
-
<div class="container
|
|
15
|
-
<h1
|
|
16
|
-
<p
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
<
|
|
190
|
+
<div class="container">
|
|
191
|
+
<h1>歌单导入工具</h1>
|
|
192
|
+
<p class="subtitle">请选择一种导入方式并填写相关信息</p>
|
|
193
|
+
|
|
194
|
+
<ul class="tabs" id="importTabs" role="tablist">
|
|
195
|
+
<li role="presentation">
|
|
196
|
+
<button class="tab-btn active" id="metadata-tab" data-bs-toggle="tab" data-bs-target="#metadata" type="button" role="tab" aria-controls="metadata" aria-selected="true">元数据导入</button>
|
|
197
|
+
</li>
|
|
198
|
+
<li role="presentation">
|
|
199
|
+
<button class="tab-btn" id="text-tab" data-bs-toggle="tab" data-bs-target="#text" type="button" role="tab" aria-controls="text" aria-selected="false">文字导入</button>
|
|
200
|
+
</li>
|
|
201
|
+
<li role="presentation">
|
|
202
|
+
<button class="tab-btn" id="link-tab" data-bs-toggle="tab" data-bs-target="#link" type="button" role="tab" aria-controls="link" aria-selected="false">链接导入</button>
|
|
203
|
+
</li>
|
|
204
|
+
</ul>
|
|
205
|
+
|
|
206
|
+
<div class="tab-content active" id="importTabContent">
|
|
207
|
+
<!-- 元数据导入 -->
|
|
208
|
+
<div class="tab-content active" id="metadata" role="tabpanel" aria-labelledby="metadata-tab">
|
|
209
|
+
<table>
|
|
210
|
+
<thead>
|
|
211
|
+
<tr>
|
|
212
|
+
<th style="width: 33%">歌曲名称</th>
|
|
213
|
+
<th style="width: 33%">艺术家</th>
|
|
214
|
+
<th style="width: 33%">专辑</th>
|
|
215
|
+
</tr>
|
|
216
|
+
</thead>
|
|
217
|
+
<tbody id="metadataTableBody">
|
|
218
|
+
<tr>
|
|
219
|
+
<td><input type="text" name="name[]" placeholder="歌曲名称"></td>
|
|
220
|
+
<td><input type="text" name="artist[]" placeholder="艺术家"></td>
|
|
221
|
+
<td><input type="text" name="album[]" placeholder="专辑"></td>
|
|
222
|
+
</tr>
|
|
223
|
+
</tbody>
|
|
224
|
+
</table>
|
|
225
|
+
<button type="button" class="btn btn-secondary" id="addMetadataRow">增加歌曲</button>
|
|
226
|
+
</div>
|
|
227
|
+
<!-- 文字导入 -->
|
|
228
|
+
<div class="tab-content" id="text" role="tabpanel" aria-labelledby="text-tab">
|
|
229
|
+
<div class="form-group">
|
|
230
|
+
<label for="textInput">文字内容</label>
|
|
231
|
+
<textarea id="textInput" name="text" rows="5" placeholder="请输入歌曲信息,每行一首歌曲"></textarea>
|
|
55
232
|
</div>
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
<
|
|
59
|
-
<label for="textInput" class="form-label">文字:</label>
|
|
60
|
-
<textarea class="form-control" id="textInput" name="text" rows="5"></textarea>
|
|
61
|
-
</div>
|
|
62
|
-
<div class="mb-3">
|
|
63
|
-
<label for="playlistNameInput" class="form-label">歌单名:</label>
|
|
64
|
-
<input type="text" class="form-control" id="playlistNameInput" name="playlistName" placeholder="请输入歌单名">
|
|
65
|
-
</div>
|
|
233
|
+
<div class="form-group">
|
|
234
|
+
<label for="playlistNameInput">歌单名称</label>
|
|
235
|
+
<input type="text" id="playlistNameInput" name="playlistName" placeholder="请输入歌单名">
|
|
66
236
|
</div>
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
</div>
|
|
77
|
-
<button type="button" class="btn btn-secondary mb-3" id="addLinkButton">增加链接</button>
|
|
78
|
-
<div class="mb-3">
|
|
79
|
-
<label for="playlistNameLinkInput" class="form-label">歌单名:</label>
|
|
80
|
-
<input type="text" class="form-control" id="playlistNameLinkInput" name="playlistName" placeholder="请输入歌单名">
|
|
237
|
+
</div>
|
|
238
|
+
<!-- 链接导入 -->
|
|
239
|
+
<div class="tab-content" id="link" role="tabpanel" aria-labelledby="link-tab">
|
|
240
|
+
<div class="form-group">
|
|
241
|
+
<label>链接列表</label>
|
|
242
|
+
<div id="linkInputsContainer">
|
|
243
|
+
<div class="input-group">
|
|
244
|
+
<input type="text" id="linkInput0" name="linkInput0" placeholder="请输入链接">
|
|
245
|
+
<button type="button" class="btn btn-secondary removeLinkButton" data-index="0">×</button>
|
|
81
246
|
</div>
|
|
82
247
|
</div>
|
|
248
|
+
<button type="button" class="btn btn-secondary" id="addLinkButton" style="margin-top: 8px;">增加链接</button>
|
|
249
|
+
</div>
|
|
250
|
+
<div class="form-group" style="margin-top: 20px;">
|
|
251
|
+
<label for="playlistNameLinkInput">歌单名称</label>
|
|
252
|
+
<input type="text" id="playlistNameLinkInput" name="playlistName" placeholder="请输入歌单名">
|
|
83
253
|
</div>
|
|
84
254
|
</div>
|
|
255
|
+
</div>
|
|
85
256
|
|
|
86
|
-
|
|
87
|
-
<
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
</div>
|
|
257
|
+
<div class="checkbox-group">
|
|
258
|
+
<input type="checkbox" value="" id="importStarCheckbox">
|
|
259
|
+
<label for="importStarCheckbox">
|
|
260
|
+
导入"我喜欢的音乐"
|
|
261
|
+
</label>
|
|
262
|
+
</div>
|
|
93
263
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
</form>
|
|
97
|
-
<!-- 表单结束 -->
|
|
98
|
-
|
|
99
|
-
<script>
|
|
100
|
-
// 动态增加链接输入框
|
|
101
|
-
document.getElementById('addLinkButton').addEventListener('click', function() {
|
|
102
|
-
var container = document.getElementById('linkInputsContainer');
|
|
103
|
-
var newIndex = container.childElementCount - 1; // 减去非输入框元素的数量
|
|
104
|
-
var newInput = document.createElement('input');
|
|
105
|
-
newInput.type = 'text';
|
|
106
|
-
newInput.className = 'form-control';
|
|
107
|
-
newInput.id = `linkInput${newIndex}`;
|
|
108
|
-
newInput.name = `linkInput${newIndex}`;
|
|
109
|
-
newInput.placeholder = '请输入链接';
|
|
110
|
-
|
|
111
|
-
var removeButton = document.createElement('button');
|
|
112
|
-
removeButton.type = 'button';
|
|
113
|
-
removeButton.className = 'btn btn-secondary removeLinkButton';
|
|
114
|
-
removeButton.textContent = '×';
|
|
115
|
-
removeButton.dataset.index = newIndex.toString();
|
|
116
|
-
removeButton.addEventListener('click', function() {
|
|
117
|
-
var group = this.closest('.input-group');
|
|
118
|
-
container.removeChild(group);
|
|
119
|
-
});
|
|
264
|
+
<button type="submit" class="btn" id="submitBtn">导入歌曲</button>
|
|
265
|
+
</div>
|
|
120
266
|
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
267
|
+
<script src="https://fastly.jsdelivr.net/npm/axios/dist/axios.min.js"></script>
|
|
268
|
+
<script>
|
|
269
|
+
// 选项卡切换
|
|
270
|
+
const tabBtns = document.querySelectorAll('.tab-btn');
|
|
271
|
+
const tabContents = document.querySelectorAll('.tab-content[id]');
|
|
125
272
|
|
|
126
|
-
|
|
273
|
+
tabBtns.forEach(btn => {
|
|
274
|
+
btn.addEventListener('click', () => {
|
|
275
|
+
tabBtns.forEach(b => b.classList.remove('active'));
|
|
276
|
+
tabContents.forEach(c => c.classList.remove('active'));
|
|
277
|
+
|
|
278
|
+
btn.classList.add('active');
|
|
279
|
+
const targetId = btn.getAttribute('data-bs-target');
|
|
280
|
+
document.getElementById(targetId).classList.add('active');
|
|
127
281
|
});
|
|
282
|
+
});
|
|
283
|
+
|
|
284
|
+
// 动态增加链接输入框
|
|
285
|
+
document.getElementById('addLinkButton').addEventListener('click', function() {
|
|
286
|
+
var container = document.getElementById('linkInputsContainer');
|
|
287
|
+
var newIndex = container.children.length;
|
|
288
|
+
var newInput = document.createElement('input');
|
|
289
|
+
newInput.type = 'text';
|
|
290
|
+
newInput.className = '';
|
|
291
|
+
newInput.id = `linkInput${newIndex}`;
|
|
292
|
+
newInput.name = `linkInput${newIndex}`;
|
|
293
|
+
newInput.placeholder = '请输入链接';
|
|
294
|
+
newInput.style.cssText = 'flex: 1; padding: 10px 14px; border: 1px solid #ddd; border-radius: 6px; font-size: 14px; outline: none;';
|
|
128
295
|
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
nameInput.name = 'name[]';
|
|
138
|
-
nameInput.placeholder = '歌曲名称';
|
|
139
|
-
|
|
140
|
-
var artistInput = document.createElement('input');
|
|
141
|
-
artistInput.type = 'text';
|
|
142
|
-
artistInput.className = 'form-control';
|
|
143
|
-
artistInput.name = 'artist[]';
|
|
144
|
-
artistInput.placeholder = '艺术家';
|
|
145
|
-
|
|
146
|
-
var albumInput = document.createElement('input');
|
|
147
|
-
albumInput.type = 'text';
|
|
148
|
-
albumInput.className = 'form-control';
|
|
149
|
-
albumInput.name = 'album[]';
|
|
150
|
-
albumInput.placeholder = '专辑';
|
|
151
|
-
|
|
152
|
-
newRow.innerHTML = `
|
|
153
|
-
<td>${nameInput.outerHTML}</td>
|
|
154
|
-
<td>${artistInput.outerHTML}</td>
|
|
155
|
-
<td>${albumInput.outerHTML}</td>
|
|
156
|
-
`;
|
|
157
|
-
|
|
158
|
-
container.appendChild(newRow);
|
|
296
|
+
var removeButton = document.createElement('button');
|
|
297
|
+
removeButton.type = 'button';
|
|
298
|
+
removeButton.className = 'btn btn-secondary';
|
|
299
|
+
removeButton.textContent = '×';
|
|
300
|
+
removeButton.dataset.index = newIndex.toString();
|
|
301
|
+
removeButton.addEventListener('click', function() {
|
|
302
|
+
var group = this.closest('.input-group');
|
|
303
|
+
container.removeChild(group);
|
|
159
304
|
});
|
|
160
305
|
|
|
161
|
-
document.
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
// 获取表单值
|
|
166
|
-
let text = document.getElementById('textInput').value;
|
|
167
|
-
let links = [];
|
|
168
|
-
let local = [];
|
|
169
|
-
let playlistName = '';
|
|
170
|
-
|
|
171
|
-
// 获取所有链接输入框的值
|
|
172
|
-
let linkInputs = document.querySelectorAll('#linkInputsContainer .input-group .form-control');
|
|
173
|
-
linkInputs.forEach(function(input) {
|
|
174
|
-
if (input.value.trim() !== '') {
|
|
175
|
-
links.push(input.value);
|
|
176
|
-
}
|
|
177
|
-
});
|
|
306
|
+
var inputGroup = document.createElement('div');
|
|
307
|
+
inputGroup.className = 'input-group';
|
|
308
|
+
inputGroup.appendChild(newInput);
|
|
309
|
+
inputGroup.appendChild(removeButton);
|
|
178
310
|
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
metadataRows.forEach(function(row) {
|
|
182
|
-
let name = row.querySelector('input[name="name[]"]').value;
|
|
183
|
-
let artist = row.querySelector('input[name="artist[]"]').value;
|
|
184
|
-
let album = row.querySelector('input[name="album[]"]').value;
|
|
185
|
-
if (name && artist && album) {
|
|
186
|
-
local.push({ name, artist, album });
|
|
187
|
-
}
|
|
188
|
-
});
|
|
311
|
+
container.appendChild(inputGroup);
|
|
312
|
+
});
|
|
189
313
|
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
return;
|
|
195
|
-
}
|
|
314
|
+
// 动态增加元数据行
|
|
315
|
+
document.getElementById('addMetadataRow').addEventListener('click', function() {
|
|
316
|
+
var container = document.getElementById('metadataTableBody');
|
|
317
|
+
var newRow = document.createElement('tr');
|
|
196
318
|
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
document.getElementById('playlistNameLinkInput').value ||
|
|
203
|
-
'导入音乐 ' + new Date().toLocaleString();
|
|
204
|
-
}
|
|
319
|
+
newRow.innerHTML = `
|
|
320
|
+
<td><input type="text" name="name[]" placeholder="歌曲名称" style="width: 100%; padding: 10px 14px; border: 1px solid #ddd; border-radius: 6px; font-size: 14px; outline: none;"></td>
|
|
321
|
+
<td><input type="text" name="artist[]" placeholder="艺术家" style="width: 100%; padding: 10px 14px; border: 1px solid #ddd; border-radius: 6px; font-size: 14px; outline: none;"></td>
|
|
322
|
+
<td><input type="text" name="album[]" placeholder="专辑" style="width: 100%; padding: 10px 14px; border: 1px solid #ddd; border-radius: 6px; font-size: 14px; outline: none;"></td>
|
|
323
|
+
`;
|
|
205
324
|
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
if (text) {
|
|
209
|
-
data.text = text;
|
|
210
|
-
data.playlistName = playlistName;
|
|
211
|
-
} else if (links.length > 0) {
|
|
212
|
-
data.link = JSON.stringify(links);
|
|
213
|
-
data.playlistName = playlistName;
|
|
214
|
-
} else if (local.length > 0) {
|
|
215
|
-
data.local = JSON.stringify(local);
|
|
216
|
-
}
|
|
325
|
+
container.appendChild(newRow);
|
|
326
|
+
});
|
|
217
327
|
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
328
|
+
document.getElementById('submitBtn').addEventListener('click', async function() {
|
|
329
|
+
// 获取表单值
|
|
330
|
+
let text = document.getElementById('textInput').value;
|
|
331
|
+
let links = [];
|
|
332
|
+
let local = [];
|
|
333
|
+
let playlistName = '';
|
|
334
|
+
|
|
335
|
+
// 获取所有链接输入框的值
|
|
336
|
+
let linkInputs = document.querySelectorAll('#linkInputsContainer .input-group input[type="text"]');
|
|
337
|
+
linkInputs.forEach(function(input) {
|
|
338
|
+
if (input.value.trim() !== '') {
|
|
339
|
+
links.push(input.value);
|
|
221
340
|
}
|
|
341
|
+
});
|
|
222
342
|
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
if (taskId) {
|
|
232
|
-
alert(`任务创建成功! 正在导入, 请稍等; 任务id:${taskId}`)
|
|
233
|
-
// const res2 = await axios({
|
|
234
|
-
// url: `/playlist/import/task/status?timestamp=${Date.now()}`,
|
|
235
|
-
// method: 'post',
|
|
236
|
-
// data: {
|
|
237
|
-
// id: taskId
|
|
238
|
-
// },
|
|
239
|
-
// });
|
|
240
|
-
// alert(JSON.stringify(res2.data, null, 2));
|
|
241
|
-
}
|
|
242
|
-
} catch (error) {
|
|
243
|
-
console.error('Error:', error);
|
|
244
|
-
alert('导入失败,请检查您的输入或稍后再试。');
|
|
343
|
+
// 获取元数据
|
|
344
|
+
let metadataRows = document.querySelectorAll('#metadataTableBody tr');
|
|
345
|
+
metadataRows.forEach(function(row) {
|
|
346
|
+
let name = row.querySelector('input[name="name[]"]').value;
|
|
347
|
+
let artist = row.querySelector('input[name="artist[]"]').value;
|
|
348
|
+
let album = row.querySelector('input[name="album[]"]').value;
|
|
349
|
+
if (name && artist && album) {
|
|
350
|
+
local.push({ name, artist, album });
|
|
245
351
|
}
|
|
246
352
|
});
|
|
247
353
|
|
|
248
|
-
//
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
354
|
+
// 检查是否有且只有一个输入字段被填写
|
|
355
|
+
let filledCount = (text ? 1 : 0) + (links.length > 0 ? 1 : 0) + (local.length > 0 ? 1 : 0);
|
|
356
|
+
if (filledCount !== 1) {
|
|
357
|
+
alert("请确保仅填写了一个输入字段!");
|
|
358
|
+
return;
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
// 获取歌单名
|
|
362
|
+
if (document.getElementById('importStarCheckbox').checked) {
|
|
363
|
+
playlistName = '我喜欢的音乐';
|
|
364
|
+
} else {
|
|
365
|
+
playlistName = document.getElementById('playlistNameInput').value ||
|
|
366
|
+
document.getElementById('playlistNameLinkInput').value ||
|
|
367
|
+
'导入音乐 ' + new Date().toLocaleString();
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
// 创建请求参数
|
|
371
|
+
let data = {};
|
|
372
|
+
if (text) {
|
|
373
|
+
data.text = text;
|
|
374
|
+
data.playlistName = playlistName;
|
|
375
|
+
} else if (links.length > 0) {
|
|
376
|
+
data.link = JSON.stringify(links);
|
|
377
|
+
data.playlistName = playlistName;
|
|
378
|
+
} else if (local.length > 0) {
|
|
379
|
+
data.local = JSON.stringify(local);
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
// 添加额外参数
|
|
383
|
+
if (document.getElementById('importStarCheckbox').checked) {
|
|
384
|
+
data.importStarPlaylist = true;
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
try {
|
|
388
|
+
const res = await axios({
|
|
389
|
+
url: `/playlist/import/name/task/create?timestamp=${Date.now()}`,
|
|
390
|
+
method: 'post',
|
|
391
|
+
data: data,
|
|
254
392
|
});
|
|
393
|
+
|
|
394
|
+
let taskId = res.data?.data?.taskId
|
|
395
|
+
if (taskId) {
|
|
396
|
+
alert(`任务创建成功!正在导入,请稍等;任务id:${taskId}`)
|
|
397
|
+
}
|
|
398
|
+
} catch (error) {
|
|
399
|
+
console.error('Error:', error);
|
|
400
|
+
alert('导入失败,请检查您的输入或稍后再试。');
|
|
401
|
+
}
|
|
402
|
+
});
|
|
403
|
+
|
|
404
|
+
// 监听复选框状态变化
|
|
405
|
+
document.getElementById('importStarCheckbox').addEventListener('change', function() {
|
|
406
|
+
let isChecked = this.checked;
|
|
407
|
+
let playlistNameInputs = document.querySelectorAll('[name="playlistName"]');
|
|
408
|
+
playlistNameInputs.forEach(function(input) {
|
|
409
|
+
input.disabled = isChecked;
|
|
255
410
|
});
|
|
411
|
+
});
|
|
256
412
|
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
</div>
|
|
413
|
+
// 初始化时设置歌单名输入框的状态
|
|
414
|
+
document.getElementById('importStarCheckbox').dispatchEvent(new Event('change'));
|
|
415
|
+
</script>
|
|
261
416
|
</body>
|
|
262
417
|
</html>
|