chore: update public repo

This commit is contained in:
desu-bot 2025-05-09 06:46:50 +00:00
parent 96426d01c1
commit 68a2d17239
No known key found for this signature in database
5 changed files with 50 additions and 7 deletions

View file

@ -0,0 +1,42 @@
import { $, ProcessOutput } from 'zx'
import { fetchSongsIter } from '../../../utils/navidrome.ts'
import { asyncPool } from '@fuman/utils'
import { join } from 'path/posix'
// async function checkIfBroken(path: string) {
// const r = await $`ffprobe -v error -show_entries stream=codec_type,codec_name,index:stream_tags=title,language -of json ${path}`.json()
// }
// for await (const song of fetchSongsIter()) {
// }
const broken: string[] = []
await asyncPool(fetchSongsIter({
onChunkProcessed: (page, items) => {
console.log(`Processed page ${page} with ${items} items`)
},
}), async (song) => {
const fullPath = join(song.libraryPath, song.path)
const path = fullPath.replace('/music/s3/', '/mnt/tank/enc/media/music/')
try {
const r = await $`ffmpeg -v error -i ${path} -f null -`.quiet()
if (r.exitCode !== 0 || r.stderr.trim() !== '') throw r
} catch (e) {
if (!(e instanceof ProcessOutput)) throw e
console.log('%s - %s (%s) seems broken:', song.artist, song.title, path)
console.log(e.stderr)
broken.push(path)
}
}, { limit: 8 })
if (broken.length > 0) {
console.log('Found %d broken files:', broken.length)
for (const path of broken) {
console.log(' %s', path)
}
process.exit(1)
}

View file

@ -1,11 +1,11 @@
import type { NavidromeSong } from '../../utils/navidrome.ts'
import type { NavidromeSong } from '../../../utils/navidrome.ts'
import { createRequire } from 'node:module'
import { join } from 'node:path'
import kuromoji from 'kuromoji'
import { isKana, toRomaji } from 'wanakana'
import { fetchSongs, fetchSongsIter } from '../../utils/navidrome.ts'
import { fetchSongsIter } from '../../../utils/navidrome.ts'
const WHITELIST_KEYS = new Set([
// actual different tracks with the same title

View file

@ -1,10 +1,10 @@
import { readFile, rm } from 'node:fs/promises'
import { join } from 'node:path'
import { $ } from 'zx'
import { downloadStream } from '../../utils/fetch.ts'
import { getEnv } from '../../utils/misc.ts'
import { fetchSongs } from '../../utils/navidrome.ts'
import { WebdavClient } from '../../utils/webdav.ts'
import { downloadStream } from '../../../utils/fetch.ts'
import { getEnv } from '../../../utils/misc.ts'
import { fetchSongs } from '../../../utils/navidrome.ts'
import { WebdavClient } from '../../../utils/webdav.ts'
const webdav = new WebdavClient({
baseUrl: getEnv('NAVIDROME_WEBDAV_ENDPOINT'),

View file

@ -1,4 +1,4 @@
import { fetchSongs, fetchSongsIter } from '../../utils/navidrome.ts'
import { fetchSongs, fetchSongsIter } from '../../../utils/navidrome.ts'
let count = 0
let totalSize = 0

View file

@ -30,6 +30,7 @@ export const NavidromeSong = z.object({
albumArtist: z.string(),
artist: z.string(),
path: z.string(),
libraryPath: z.string(),
duration: z.number(),
size: z.number(),
})