-
Notifications
You must be signed in to change notification settings - Fork 47
/
index.js
24 lines (23 loc) · 906 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
var glob = require("glob")
var fs = require("fs")
glob("./audio/**/*.{mp3,wav,flac}", {}, function (er, files) {
let result = []
let download = ''
files.forEach(item => {
let fileInfo = fs.statSync(item)
if(fileInfo.size/(1024*1024) < 20) { // 小于20M
let arr = item.split('/')
result.push({
name: arr[3].replace(/\.(mp3|flac|wav)$/g, ''),
artist: "专辑-"+arr[2],
url: 'https://testingcf.jsdelivr.net/gh/nj-lizhi/song@main' + item.slice(1),
cover: 'https://testingcf.jsdelivr.net/gh/nj-lizhi/song@main/audio/' + arr[2] + '/cover.png',
})
download += `https://testingcf.jsdelivr.net/gh/nj-lizhi/song@main${item.slice(1)}\n`
} else {
console.log('文件大于20M:', item)
}
})
fs.writeFileSync('./audio/list.js', "var list = " + JSON.stringify(result))
fs.writeFileSync('./audio/download.txt', download)
})