Audit : code mort retiré (fonctions jamais utilisées, imports, 83 traductions inutilisées)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YVo1qxKoBQCaMd7Ue8PGbe
This commit is contained in:
28 files changed
+9
-1625
No files matched your search
@@ -620,43 +620,6 @@ export async function getTmdbCredits(externalId: string, key: string): Promise<C
|
||||
}
|
||||
}
|
||||
|
||||
// ─────────────────────────── Notes du public ───────────────────────────
|
||||
|
||||
/** Note moyenne TMDB d'un film / d'une série (undefined si trop peu de votes). */
|
||||
export async function getTmdbPublicRating(externalId: string, key: string): Promise<number | undefined> {
|
||||
if (!isSafeExternalId(externalId) || !externalId.startsWith('tmdb:')) return undefined
|
||||
const [, kind, id] = externalId.split(':') as ['tmdb', 'movie' | 'tv', string]
|
||||
const d = await tmdbFetch<TmdbDetails>(`/${kind}/${id}`, key)
|
||||
return tmdbPublicRating(d.vote_average, d.vote_count)
|
||||
}
|
||||
|
||||
/** Notes moyennes AniList (sur 10) pour plusieurs animes d'un coup. */
|
||||
export async function getAniListPublicRatings(ids: number[]): Promise<Map<number, number>> {
|
||||
const out = new Map<number, number>()
|
||||
const clean = ids.filter((n) => Number.isInteger(n) && n > 0).slice(0, 500)
|
||||
for (let i = 0; i < clean.length; i += 50) {
|
||||
const res = await fetch(ANILIST, {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json', Accept: 'application/json' },
|
||||
referrerPolicy: 'no-referrer',
|
||||
credentials: 'omit',
|
||||
body: JSON.stringify({
|
||||
query: 'query ($ids: [Int]) { Page(perPage: 50) { media(id_in: $ids, type: ANIME) { id averageScore } } }',
|
||||
variables: { ids: clean.slice(i, i + 50) },
|
||||
}),
|
||||
})
|
||||
if (!res.ok) throw new Error(t('err.anilistStatus', { status: res.status }))
|
||||
const json = (await res.json()) as { data?: { Page?: { media?: { id: number; averageScore?: number | null }[] } } }
|
||||
const media = json.data?.Page?.media
|
||||
for (const m of Array.isArray(media) ? media : []) {
|
||||
if (Number.isInteger(m?.id) && typeof m.averageScore === 'number' && m.averageScore > 0 && m.averageScore <= 100) {
|
||||
out.set(m.id, Math.round(m.averageScore) / 10)
|
||||
}
|
||||
}
|
||||
}
|
||||
return out
|
||||
}
|
||||
|
||||
// ─────────────────────────── Dates de sortie (calendrier) ───────────────────────────
|
||||
|
||||
export interface ReleaseInfo {
|
||||
|
||||
Reference in new issue
Block a user