push
github
213 of 466 branches covered (45.71%)
Branch coverage included in aggregate %.
1696 of 2002 new or added lines in 120 files covered. (84.72%)
8 existing lines in 8 files now uncovered.8807 of 16432 relevant lines covered (53.6%)
0.8 hits per line
|
import fp from 'fastify-plugin' |
1✔ |
|
import { getYTDLPMetadata } from '@breadcrum/resources/episodes/yt-dlp-api-client.js' |
1✔ |
|
|
1✔ |
|
/**
|
1✔ |
|
* This plugin adds yt-dlp fetching helpers |
1✔ |
|
*/ |
1✔ |
|
export default fp(async function (fastify, _opts) { |
|
|
fastify.decorate( |
2✔ |
|
'getYTDLPMetadataWrapper',
|
2✔ |
|
async function getYTDLPMetadataWrapper ({ |
2✔ |
NEW
|
url, |
× |
NEW
|
medium, |
× |
NEW
|
attempt = 0,
|
× |
NEW
|
}) { |
× |
NEW
|
const endTimer = fastify.prom.ytdlpSeconds.startTimer() |
× |
NEW
|
try {
|
× |
NEW
|
return await getYTDLPMetadata({
|
× |
NEW
|
url, |
× |
NEW
|
medium, |
× |
NEW
|
attempt, |
× |
NEW
|
ytDLPEndpoint: fastify.config.YT_DLP_API_URL,
|
× |
NEW
|
cache: fastify.ytdlpCache,
|
× |
NEW
|
}) |
× |
NEW
|
} finally {
|
× |
NEW
|
endTimer() |
× |
NEW
|
} |
× |
|
}) |
2✔ |
|
}, { |
1✔ |
|
name: 'yt-dlp', |
1✔ |
|
dependencies: ['env', 'prom', 'cache'], |
1✔ |
|
}) |
1✔ |