teidesu-scripts/scripts/infra/navidrome/stats.ts
2025-05-09 06:46:50 +00:00

18 lines
538 B
TypeScript

import { fetchSongs, fetchSongsIter } from '../../../utils/navidrome.ts'
let count = 0
let totalSize = 0
let totalDuration = 0
console.log('⌛ fetching songs...')
for await (const song of fetchSongsIter()) {
count += 1
totalSize += song.size
totalDuration += song.duration
}
console.log('---')
console.log('total songs: %d', count)
console.log('total size: %d GiB', (totalSize / 1024 / 1024 / 1024).toFixed(3))
console.log('total duration: %d min (%d h)', (totalDuration / 60).toFixed(3), (totalDuration / 60 / 60).toFixed(3))