Kenmei manga entry.
Matching AniList manga entry.
Processing options.
Prepared entry ready for AniList update.
export function prepareEntryForSync(
manga: KenmeiManga,
anilistMatch: AniListManga,
options: Partial<ProcessOptions> = {},
): {
mediaId: number;
status: string;
progress: number;
score?: number;
progressVolumes?: number;
} {
const processOptions = { ...DEFAULT_PROCESS_OPTIONS, ...options };
// Map the status
const status = mapKenmeiToAniListStatus(
manga.status,
processOptions.statusMapping,
);
// Determine progress (chapters vs volumes)
const progress = manga.chapters_read;
let progressVolumes: number | undefined = manga.volumes_read;
// If we prefer volumes and have volume data, set progress to volumes
if (processOptions.preferVolumes && manga.volumes_read !== undefined) {
progressVolumes = manga.volumes_read;
}
// Normalize score if needed (Kenmei uses 1-10, AniList uses 1-100 or 1-10 depending on settings)
let score: number | undefined = manga.score;
if (processOptions.normalizeScores && score > 0) {
// We'll assume AniList is using the 100-point scale
score = Math.round(score * 10);
}
return {
mediaId: anilistMatch.id,
status,
progress,
progressVolumes,
score: score > 0 ? score : undefined,
};
}
Prepare Kenmei manga entry for AniList synchronization.