1
0
Code Issues Pull Requests Projects Releases Wiki Activity GitHub Gitee
This commit is contained in:
2022-10-03 01:01:25 +08:00
parent dfab62b437
commit e778b455ed
2 changed files with 16 additions and 5 deletions

View File

@@ -76,6 +76,7 @@ async function update() {
* 统计数据库中数据 * 统计数据库中数据
*/ */
let watchParam = { let watchParam = {
statisticTime: Date.now(),
songCount: 0, songCount: 0,
albumCount: 0, albumCount: 0,
artistCount: 0, artistCount: 0,
@@ -141,8 +142,11 @@ async function watch() {
let songAlbumCount = result[0].song_album_count; let songAlbumCount = result[0].song_album_count;
let songArtistCount = result[0].song_artist_count; let songArtistCount = result[0].song_artist_count;
let statisticTimeDelta = Date.now() - watchParam.statisticTime;
let statisticsString = [ 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 - 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)`, `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: ${songCount + songWaiting}, album: ${albumCount + albumWaiting}, artist: ${artistCount + artistWaiting}, lyric: ${songCount}, comment: ${songCount}`,
`[关联关系统计]`, `[关联关系统计]`,
`song-album: ${songAlbumCount}, song-artist: ${songArtistCount}`, `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'); ].join('\n');
console.log(statisticsString); console.log(statisticsString);
watchParam = { watchParam = {
statisticTime: Date.now(),
songCount: songCount, songCount: songCount,
albumCount: albumCount, albumCount: albumCount,
artistCount: artistCount, artistCount: artistCount,

View File

@@ -7,6 +7,12 @@ if (keepWatching) {
} }
const neteaseMusic = require('./netease_music/index'); const neteaseMusic = require('./netease_music/index');
neteaseMusic.watch(); const sleepUtils = require('./utils/sleepUtils');
if (keepWatching)
setInterval(neteaseMusic.watch, 15 * 1000); async function main() {
do {
await neteaseMusic.watch();
await sleepUtils.sleep(2000);
} while (keepWatching)
}
main();