update
This commit is contained in:
parent
dfab62b437
commit
e778b455ed
@ -76,6 +76,7 @@ async function update() {
|
||||
* 统计数据库中数据
|
||||
*/
|
||||
let watchParam = {
|
||||
statisticTime: Date.now(),
|
||||
songCount: 0,
|
||||
albumCount: 0,
|
||||
artistCount: 0,
|
||||
@ -141,8 +142,11 @@ async function watch() {
|
||||
|
||||
let songAlbumCount = result[0].song_album_count;
|
||||
let songArtistCount = result[0].song_artist_count;
|
||||
|
||||
let statisticTimeDelta = Date.now() - watchParam.statisticTime;
|
||||
|
||||
let statisticsString = [
|
||||
`[与上次运行统计时相比]`,
|
||||
`[与上次运行统计时相比] deltaTime: ${statisticTimeDelta}ms (${(statisticTimeDelta / 1000).toFixed(2)}s)`,
|
||||
`song: ${songCount - watchParam.songCount}, album: ${albumCount - watchParam.albumCount}, artist: ${artistCount - watchParam.artistCount}, lyric: ${lyricCount - watchParam.lyricCount}, comment: ${commentCount - watchParam.commentCount}(song)/${commentTotalCount - watchParam.commentTotalCount}(comment)`,
|
||||
`[已爬取]`,
|
||||
`song: ${songCount}, album: ${albumCount}, artist: ${artistCount}, lyric: ${lyricCount}, comment: ${commentCount}(song)/${commentTotalCount}(comment)`,
|
||||
@ -152,11 +156,12 @@ async function watch() {
|
||||
`song: ${songCount + songWaiting}, album: ${albumCount + albumWaiting}, artist: ${artistCount + artistWaiting}, lyric: ${songCount}, comment: ${songCount}`,
|
||||
`[关联关系统计]`,
|
||||
`song-album: ${songAlbumCount}, song-artist: ${songArtistCount}`,
|
||||
`time spent: ${timeSpent}ms(${(timeSpent / 1000).toFixed(2)}s)`,
|
||||
`time spent: ${timeSpent}ms (${(timeSpent / 1000).toFixed(2)}s)`,
|
||||
``
|
||||
].join('\n');
|
||||
console.log(statisticsString);
|
||||
watchParam = {
|
||||
statisticTime: Date.now(),
|
||||
songCount: songCount,
|
||||
albumCount: albumCount,
|
||||
artistCount: artistCount,
|
||||
|
12
watch.js
12
watch.js
@ -7,6 +7,12 @@ if (keepWatching) {
|
||||
}
|
||||
|
||||
const neteaseMusic = require('./netease_music/index');
|
||||
neteaseMusic.watch();
|
||||
if (keepWatching)
|
||||
setInterval(neteaseMusic.watch, 15 * 1000);
|
||||
const sleepUtils = require('./utils/sleepUtils');
|
||||
|
||||
async function main() {
|
||||
do {
|
||||
await neteaseMusic.watch();
|
||||
await sleepUtils.sleep(2000);
|
||||
} while (keepWatching)
|
||||
}
|
||||
main();
|
Loading…
Reference in New Issue
Block a user