1
0
Code Issues Pull Requests Projects Releases Wiki Activity GitHub Gitee

node watch添加playlist相关统计

This commit is contained in:
程序员小墨 2022-10-19 23:57:53 +08:00
parent 102cf25060
commit 896e66de53
2 changed files with 13 additions and 1 deletions

View File

@ -1,5 +1,6 @@
INSERT INTO analysis (`key`, `value`) VALUES ('songCount', (SELECT count(*) as count FROM song) ) ON DUPLICATE KEY UPDATE `value` = VALUES(`value`);
INSERT INTO analysis (`key`, `value`) VALUES ('songWaiting', (SELECT count(DISTINCT song_id) AS count
INSERT INTO analysis (`key`, `value`) VALUES ('playlistCount', (SELECT count(*) AS count FROM playlist) ) ON DUPLICATE KEY UPDATE `value` = VALUES(`value`);
FROM ( SELECT song_id FROM song_artist_relation UNION SELECT song_id FROM song_album_relation ) t_tmp
WHERE song_id NOT IN ( SELECT song_id FROM song )) ) ON DUPLICATE KEY UPDATE `value` = VALUES(`value`);
INSERT INTO analysis (`key`, `value`) VALUES ('albumCount', (SELECT count(*) as count FROM album) ) ON DUPLICATE KEY UPDATE `value` = VALUES(`value`);
@ -10,6 +11,7 @@ INSERT INTO analysis (`key`, `value`) VALUES ('lyricCount', (SELECT count(*) AS
INSERT INTO analysis (`key`, `value`) VALUES ('commentCount', (SELECT count( DISTINCT song_id ) AS count FROM comment) ) ON DUPLICATE KEY UPDATE `value` = VALUES(`value`);
INSERT INTO analysis (`key`, `value`) VALUES ('commentTotalCount', (SELECT count(*) AS count FROM comment) ) ON DUPLICATE KEY UPDATE `value` = VALUES(`value`);
INSERT INTO analysis (`key`, `value`) VALUES ('userCount', (SELECT count(*) AS count FROM user) ) ON DUPLICATE KEY UPDATE `value` = VALUES(`value`);
INSERT INTO analysis (`key`, `value`) VALUES ('songPlaylistCount', (SELECT count(*) AS count FROM song_playlist_relation) ) ON DUPLICATE KEY UPDATE `value` = VALUES(`value`);
INSERT INTO analysis (`key`, `value`) VALUES ('songAlbumCount', (SELECT count(*) AS count FROM song_album_relation) ) ON DUPLICATE KEY UPDATE `value` = VALUES(`value`);
INSERT INTO analysis (`key`, `value`) VALUES ('songArtistCount', (SELECT count(*) AS count FROM song_artist_relation) ) ON DUPLICATE KEY UPDATE `value` = VALUES(`value`);

View File

@ -106,6 +106,9 @@ async function watch() {
sql: `SELECT count(DISTINCT song_id) AS count
FROM ( SELECT song_id FROM song_artist_relation UNION SELECT song_id FROM song_album_relation ) t_tmp
WHERE song_id NOT IN ( SELECT song_id FROM song )`,
}, {
name: "playlistCount",
sql: `SELECT count(*) AS count FROM playlist`,
}, {
name: "albumCount",
sql: `SELECT count(*) AS count FROM album`,
@ -130,6 +133,9 @@ async function watch() {
}, {
name: "userCount",
sql: `SELECT count(*) AS count FROM user`,
}, {
name: "songPlaylistCount",
sql: `SELECT count(*) AS count FROM song_playlist_relation`,
}, {
name: "songAlbumCount",
sql: `SELECT count(*) AS count FROM song_album_relation`,
@ -170,6 +176,7 @@ async function watch() {
`[与上次运行统计时相比]`,
[
`song: ${newWatchParam['songCount'] - oldWatchParam['songCount']}`,
`playlist: ${newWatchParam['playlistCount'] - oldWatchParam['playlistCount']}`,
`album: ${newWatchParam['albumCount'] - oldWatchParam['albumCount']}`,
`artist: ${newWatchParam['artistCount'] - oldWatchParam['artistCount']}`,
`lyric: ${newWatchParam['lyricCount'] - oldWatchParam['lyricCount']}`,
@ -179,6 +186,7 @@ async function watch() {
`[已爬取]`,
[
`song: ${newWatchParam['songCount']}`,
`playlist: ${newWatchParam['playlistCount']}`,
`album: ${newWatchParam['albumCount']}`,
`artist: ${newWatchParam['artistCount']}`,
`lyric: ${newWatchParam['lyricCount']}`,
@ -188,6 +196,7 @@ async function watch() {
`[待爬取]`,
[
`song: ${newWatchParam['songWaiting']}`,
`playlist: 未知`,
`album: ${newWatchParam['albumWaiting']}`,
`artist: ${newWatchParam['artistWaiting']}`,
`lyric: ${newWatchParam['songCount'] - newWatchParam['lyricCount']}`,
@ -197,6 +206,7 @@ async function watch() {
`[总计] (已爬取 + 待爬取)`,
[
`song: ${newWatchParam['songCount'] + newWatchParam['songWaiting']}`,
`playlist: ${newWatchParam['playlistCount']}`,
`album: ${newWatchParam['albumCount'] + newWatchParam['albumWaiting']}`,
`artist: ${newWatchParam['artistCount'] + newWatchParam['artistWaiting']}`,
`lyric: ${newWatchParam['songCount']}`,
@ -204,7 +214,7 @@ async function watch() {
`user: ${newWatchParam['userCount']}`,
].join(', '),
`[关联关系统计]`,
`song-album: ${newWatchParam['songAlbumCount']}, song-artist: ${newWatchParam['songArtistCount']}`,
`song-playlist: ${newWatchParam['songPlaylistCount']}, song-album: ${newWatchParam['songAlbumCount']}, song-artist: ${newWatchParam['songArtistCount']}`,
``
].join('\n');
console.log(statisticsString);