update
This commit is contained in:
@@ -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)`,
|
||||||
@@ -157,6 +161,7 @@ async function watch() {
|
|||||||
].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,
|
||||||
|
12
watch.js
12
watch.js
@@ -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();
|
Reference in New Issue
Block a user