Import « Coller une liste » : depuis l'app Notes ou n'importe quel texte
deploy / deploy (push) Successful in 52s
deploy / deploy (push) Successful in 52s
- Une ligne par titre : note (4,5/5, 8/10, ★★★★), année, statut (vu, en cours, à voir), progression S3E12 et avis reconnus - Sections « Films », « Séries à voir »… appliquées aux lignes suivantes - Recherche TMDB + AniList, écran de vérification : décocher une ligne ou choisir un autre titre - Textes dans les 18 langues Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YVo1qxKoBQCaMd7Ue8PGbe
This commit is contained in:
23 files changed
+884
-17
No files matched your search
@@ -0,0 +1,195 @@
|
|||||||
|
import { Check, Loader2, Search } from 'lucide-react'
|
||||||
|
import { useState } from 'react'
|
||||||
|
import { t, type TKey } from '../i18n'
|
||||||
|
import { searchAll, type SearchResult } from '../lib/catalogApi'
|
||||||
|
import { matchFor, type Match } from '../lib/import/resolve'
|
||||||
|
import type { TextEntry } from '../lib/import/textList'
|
||||||
|
import { cx } from '../lib/utils'
|
||||||
|
import Poster from './Poster'
|
||||||
|
import { RatingBadge } from './Rating'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Vérification d'une liste collée : chaque ligne avec le titre trouvé.
|
||||||
|
* On peut décocher une ligne, ou choisir un autre titre (recherche intégrée).
|
||||||
|
*/
|
||||||
|
export default function ImportTextReview({
|
||||||
|
entries,
|
||||||
|
matches,
|
||||||
|
unsure,
|
||||||
|
excluded,
|
||||||
|
tmdbKey,
|
||||||
|
onToggle,
|
||||||
|
onChange,
|
||||||
|
onContinue,
|
||||||
|
}: {
|
||||||
|
entries: TextEntry[]
|
||||||
|
matches: Map<string, Match>
|
||||||
|
unsure: Set<string>
|
||||||
|
excluded: Set<string>
|
||||||
|
tmdbKey?: string
|
||||||
|
onToggle: (key: string) => void
|
||||||
|
onChange: (key: string, match: Match) => void
|
||||||
|
onContinue: () => void
|
||||||
|
}) {
|
||||||
|
const [editing, setEditing] = useState<string>()
|
||||||
|
const kept = entries.filter((e) => !excluded.has(e.key) && matches.has(e.key)).length
|
||||||
|
const toCheck = entries.filter((e) => !excluded.has(e.key) && (unsure.has(e.key) || !matches.has(e.key))).length
|
||||||
|
// Les lignes à vérifier d'abord
|
||||||
|
const ordered = [...entries].sort((a, b) => rank(a) - rank(b))
|
||||||
|
function rank(e: TextEntry) {
|
||||||
|
return !matches.has(e.key) ? 0 : unsure.has(e.key) ? 1 : 2
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<p className="text-sm text-ink-2">{t('import.text.reviewHint')}</p>
|
||||||
|
{toCheck > 0 && <p className="mt-2 text-sm font-medium text-ink">{t('import.text.toCheck', { n: toCheck })}</p>}
|
||||||
|
<ul className="mt-4 divide-y divide-line border-y border-line">
|
||||||
|
{ordered.map((e) => {
|
||||||
|
const m = matches.get(e.key)
|
||||||
|
const off = excluded.has(e.key)
|
||||||
|
const doubt = !m || unsure.has(e.key)
|
||||||
|
return (
|
||||||
|
<li key={e.key} className="py-3">
|
||||||
|
<div className={cx('flex items-start gap-3', off && 'opacity-45')}>
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
role="checkbox"
|
||||||
|
aria-checked={!off && !!m}
|
||||||
|
disabled={!m}
|
||||||
|
onClick={() => onToggle(e.key)}
|
||||||
|
aria-label={e.line}
|
||||||
|
className={cx(
|
||||||
|
'mt-1 grid size-6 shrink-0 place-items-center rounded-[2px] border',
|
||||||
|
!off && m ? 'border-accent bg-accent-fill text-on-accent' : 'border-line-strong bg-surface',
|
||||||
|
)}
|
||||||
|
>
|
||||||
|
{!off && m && <Check size={15} strokeWidth={3} />}
|
||||||
|
</button>
|
||||||
|
<div className="w-11 shrink-0">
|
||||||
|
<Poster src={m?.result.thumb ?? m?.result.posterUrl} title={m?.result.title ?? e.title} className="rounded-[2px]" />
|
||||||
|
</div>
|
||||||
|
<div className="min-w-0 flex-1">
|
||||||
|
<p className="truncate text-xs text-ink-3">{e.line}</p>
|
||||||
|
{m ? (
|
||||||
|
<p className="mt-0.5 font-semibold leading-snug">
|
||||||
|
{m.result.title}
|
||||||
|
<span className="font-normal text-ink-3">
|
||||||
|
{' · '}
|
||||||
|
{t(`type.${m.meta.type ?? m.result.typeGuess}` as TKey)}
|
||||||
|
{m.result.year ? ` · ${m.result.year}` : ''}
|
||||||
|
</span>
|
||||||
|
</p>
|
||||||
|
) : (
|
||||||
|
<p className="mt-0.5 font-semibold text-ink-2">{t('import.text.none')}</p>
|
||||||
|
)}
|
||||||
|
<div className="mt-1 flex flex-wrap items-center gap-x-3 gap-y-1 text-xs text-ink-2">
|
||||||
|
<span>{t(`status.${e.status}` as TKey)}</span>
|
||||||
|
<RatingBadge value={e.rating} />
|
||||||
|
{e.notes && <span className="min-w-0 max-w-full truncate italic">« {e.notes} »</span>}
|
||||||
|
</div>
|
||||||
|
<div className="mt-1.5 flex items-center gap-3">
|
||||||
|
{doubt && m && !off && <span className="text-xs font-semibold text-danger">{t('import.text.check')}</span>}
|
||||||
|
<button type="button" onClick={() => setEditing(editing === e.key ? undefined : e.key)} className="text-xs font-semibold text-accent underline underline-offset-2">
|
||||||
|
{m ? t('import.text.change') : t('import.text.search')}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{editing === e.key && (
|
||||||
|
<Picker
|
||||||
|
initial={e.fullTitle ?? e.title}
|
||||||
|
tmdbKey={tmdbKey}
|
||||||
|
onPick={(match) => {
|
||||||
|
onChange(e.key, match)
|
||||||
|
setEditing(undefined)
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
</li>
|
||||||
|
)
|
||||||
|
})}
|
||||||
|
</ul>
|
||||||
|
<button onClick={onContinue} disabled={kept === 0} className="btn btn-primary mt-6 w-full">
|
||||||
|
{t('import.continue')} ({kept})
|
||||||
|
</button>
|
||||||
|
</>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Recherche d'un autre titre pour une ligne. */
|
||||||
|
function Picker({ initial, tmdbKey, onPick }: { initial: string; tmdbKey?: string; onPick: (m: Match) => void }) {
|
||||||
|
const [q, setQ] = useState(initial)
|
||||||
|
const [results, setResults] = useState<SearchResult[]>()
|
||||||
|
const [busy, setBusy] = useState(false)
|
||||||
|
const [error, setError] = useState<string>()
|
||||||
|
|
||||||
|
const run = async () => {
|
||||||
|
const query = q.trim()
|
||||||
|
if (!query || busy) return
|
||||||
|
setBusy(true)
|
||||||
|
setError(undefined)
|
||||||
|
try {
|
||||||
|
setResults((await searchAll(query, tmdbKey?.trim() || undefined)).slice(0, 8))
|
||||||
|
} catch (err) {
|
||||||
|
setError((err as Error)?.message || t('search.offline'))
|
||||||
|
} finally {
|
||||||
|
setBusy(false)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const pick = async (r: SearchResult) => {
|
||||||
|
setBusy(true)
|
||||||
|
try {
|
||||||
|
onPick(await matchFor(r, tmdbKey?.trim() || undefined))
|
||||||
|
} finally {
|
||||||
|
setBusy(false)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="mt-3 rounded-[2px] border border-line bg-surface-2 p-3">
|
||||||
|
<form
|
||||||
|
className="flex gap-2"
|
||||||
|
onSubmit={(ev) => {
|
||||||
|
ev.preventDefault()
|
||||||
|
void run()
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<input
|
||||||
|
className="field min-w-0 flex-1"
|
||||||
|
value={q}
|
||||||
|
onChange={(ev) => setQ(ev.target.value.slice(0, 200))}
|
||||||
|
aria-label={t('import.text.search')}
|
||||||
|
enterKeyHint="search"
|
||||||
|
autoFocus
|
||||||
|
/>
|
||||||
|
<button type="submit" className="btn btn-primary px-4" disabled={busy || !q.trim()} aria-label={t('import.text.search')}>
|
||||||
|
{busy ? <Loader2 size={18} className="animate-spin" /> : <Search size={18} />}
|
||||||
|
</button>
|
||||||
|
</form>
|
||||||
|
{error && <p className="mt-2 text-sm text-danger">{error}</p>}
|
||||||
|
{results && !results.length && <p className="mt-2 text-sm text-ink-2">{t('import.text.none')}</p>}
|
||||||
|
{results && results.length > 0 && (
|
||||||
|
<ul className="mt-2 divide-y divide-line">
|
||||||
|
{results.map((r) => (
|
||||||
|
<li key={r.externalId}>
|
||||||
|
<button type="button" disabled={busy} onClick={() => void pick(r)} className="flex w-full items-center gap-3 py-2 text-start">
|
||||||
|
<div className="w-9 shrink-0">
|
||||||
|
<Poster src={r.thumb ?? r.posterUrl} title={r.title} className="rounded-[2px]" />
|
||||||
|
</div>
|
||||||
|
<span className="min-w-0 flex-1">
|
||||||
|
<span className="block truncate text-sm font-semibold">{r.title}</span>
|
||||||
|
<span className="block text-xs text-ink-3">
|
||||||
|
{t(`type.${r.typeGuess}` as TKey)}
|
||||||
|
{r.year ? ` · ${r.year}` : ''}
|
||||||
|
</span>
|
||||||
|
</span>
|
||||||
|
</button>
|
||||||
|
</li>
|
||||||
|
))}
|
||||||
|
</ul>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
+115
-15
@@ -2,10 +2,12 @@ import { ArrowLeft, Check, ChevronDown, FileUp, Loader2, X } from 'lucide-react'
|
|||||||
import { useEffect, useMemo, useRef, useState, type DragEvent } from 'react'
|
import { useEffect, useMemo, useRef, useState, type DragEvent } from 'react'
|
||||||
import { t, type TKey } from '../i18n'
|
import { t, type TKey } from '../i18n'
|
||||||
import { useBackToClose } from '../lib/backNav'
|
import { useBackToClose } from '../lib/backNav'
|
||||||
|
import ImportTextReview from './ImportTextReview'
|
||||||
import { useEscape } from '../lib/escape'
|
import { useEscape } from '../lib/escape'
|
||||||
import { ImportFileError, readImportFile, type TextFile } from '../lib/import/files'
|
import { ImportFileError, readImportFile, type TextFile } from '../lib/import/files'
|
||||||
import { buildImportPlan, countByKind, type ImportPlan } from '../lib/import/merge'
|
import { buildImportPlan, countByKind, type ImportPlan } from '../lib/import/merge'
|
||||||
import { CancelledError, fetchAniListUser, isAniListUserName, resolveEntries, type CancelToken, type Match, type Progress } from '../lib/import/resolve'
|
import { CancelledError, fetchAniListUser, isAniListUserName, resolveEntries, resolveTextEntries, withProgress, type CancelToken, type Match, type Progress } from '../lib/import/resolve'
|
||||||
|
import { parseTextList, TEXT_MAX_CHARS, type TextEntry } from '../lib/import/textList'
|
||||||
import { letterboxdRole, parseLetterboxd, parseMal, parseTvTime, type ImportEntry, type ImportSource } from '../lib/import/sources'
|
import { letterboxdRole, parseLetterboxd, parseMal, parseTvTime, type ImportEntry, type ImportSource } from '../lib/import/sources'
|
||||||
import { useScrollLock } from '../lib/scrollLock'
|
import { useScrollLock } from '../lib/scrollLock'
|
||||||
import { LIMITS } from '../lib/security'
|
import { LIMITS } from '../lib/security'
|
||||||
@@ -18,16 +20,18 @@ import { useMedia } from '../store'
|
|||||||
* Tout se passe sur l'appareil ; la synchro existante enverra ensuite les fiches au compte.
|
* Tout se passe sur l'appareil ; la synchro existante enverra ensuite les fiches au compte.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
type Step = 'source' | 'input' | 'working' | 'preview' | 'done'
|
type Step = 'source' | 'input' | 'working' | 'review' | 'preview' | 'done'
|
||||||
|
|
||||||
const SOURCES: { id: ImportSource; name: string; mark: string; accept?: string; multiple?: boolean }[] = [
|
const SOURCES: { id: ImportSource; name: string; mark: string; accept?: string; multiple?: boolean }[] = [
|
||||||
|
{ id: 'text', name: '', mark: 'Aa' },
|
||||||
{ id: 'letterboxd', name: 'Letterboxd', mark: 'Lb', accept: '.zip,.csv,application/zip,text/csv', multiple: true },
|
{ id: 'letterboxd', name: 'Letterboxd', mark: 'Lb', accept: '.zip,.csv,application/zip,text/csv', multiple: true },
|
||||||
{ id: 'tvtime', name: 'TV Time', mark: 'TV', accept: '.zip,.csv,application/zip,text/csv', multiple: true },
|
{ id: 'tvtime', name: 'TV Time', mark: 'TV', accept: '.zip,.csv,application/zip,text/csv', multiple: true },
|
||||||
{ id: 'mal', name: 'MyAnimeList', mark: 'MAL', accept: '.xml,.gz,application/xml,text/xml,application/gzip' },
|
{ id: 'mal', name: 'MyAnimeList', mark: 'MAL', accept: '.xml,.gz,application/xml,text/xml,application/gzip' },
|
||||||
{ id: 'anilist', name: 'AniList', mark: 'AL' },
|
{ id: 'anilist', name: 'AniList', mark: 'AL' },
|
||||||
]
|
]
|
||||||
|
|
||||||
const NEEDS_TMDB: ImportSource[] = ['letterboxd', 'tvtime']
|
const NEEDS_TMDB: ImportSource[] = ['text', 'letterboxd', 'tvtime']
|
||||||
|
const sourceName = (s: { id: ImportSource; name: string }) => (s.id === 'text' ? t('import.text.name') : s.name)
|
||||||
|
|
||||||
/** Message lisible pour une erreur de lecture / de réseau. */
|
/** Message lisible pour une erreur de lecture / de réseau. */
|
||||||
function errorText(e: unknown): string {
|
function errorText(e: unknown): string {
|
||||||
@@ -69,6 +73,11 @@ export default function ImportWizard({ onClose }: { onClose: () => void }) {
|
|||||||
const [showMissing, setShowMissing] = useState(false)
|
const [showMissing, setShowMissing] = useState(false)
|
||||||
const [result, setResult] = useState<{ added: number; updated: number; unchanged: number; notFound: number }>()
|
const [result, setResult] = useState<{ added: number; updated: number; unchanged: number; notFound: number }>()
|
||||||
const [dragging, setDragging] = useState(false)
|
const [dragging, setDragging] = useState(false)
|
||||||
|
// Liste collée
|
||||||
|
const [pasted, setPasted] = useState('')
|
||||||
|
const [defaultStatus, setDefaultStatus] = useState<'termine' | 'a_voir'>('termine')
|
||||||
|
const [unsure, setUnsure] = useState<Set<string>>(new Set())
|
||||||
|
const [excluded, setExcluded] = useState<Set<string>>(new Set())
|
||||||
const [now, setNow] = useState(Date.now())
|
const [now, setNow] = useState(Date.now())
|
||||||
const token = useRef<CancelToken>({ cancelled: false })
|
const token = useRef<CancelToken>({ cancelled: false })
|
||||||
const fileRef = useRef<HTMLInputElement>(null)
|
const fileRef = useRef<HTMLInputElement>(null)
|
||||||
@@ -93,10 +102,15 @@ export default function ImportWizard({ onClose }: { onClose: () => void }) {
|
|||||||
const info = SOURCES.find((s) => s.id === source)
|
const info = SOURCES.find((s) => s.id === source)
|
||||||
const hasTmdb = !!settings.tmdbKey?.trim()
|
const hasTmdb = !!settings.tmdbKey?.trim()
|
||||||
|
|
||||||
const plan: ImportPlan | undefined = useMemo(
|
const plan: ImportPlan | undefined = useMemo(() => {
|
||||||
() => (step === 'preview' ? buildImportPlan(entries, matches, items, { includeUnmatched }) : undefined),
|
if (step !== 'preview') return undefined
|
||||||
[step, entries, matches, items, includeUnmatched],
|
// Liste collée : seulement les lignes gardées, avec la progression « S3E12 » convertie en épisodes
|
||||||
)
|
const list =
|
||||||
|
source === 'text'
|
||||||
|
? (entries as TextEntry[]).filter((e) => !excluded.has(e.key) && matches.has(e.key)).map((e) => withProgress(e, matches.get(e.key)))
|
||||||
|
: entries
|
||||||
|
return buildImportPlan(list, matches, items, { includeUnmatched: source === 'text' ? false : includeUnmatched })
|
||||||
|
}, [step, source, entries, matches, items, includeUnmatched, excluded])
|
||||||
|
|
||||||
const run = async (load: () => Promise<ImportEntry[]>) => {
|
const run = async (load: () => Promise<ImportEntry[]>) => {
|
||||||
const tk = { cancelled: false }
|
const tk = { cancelled: false }
|
||||||
@@ -127,10 +141,36 @@ export default function ImportWizard({ onClose }: { onClose: () => void }) {
|
|||||||
const onFiles = (list: FileList | null | undefined) => {
|
const onFiles = (list: FileList | null | undefined) => {
|
||||||
const files = Array.from(list ?? [])
|
const files = Array.from(list ?? [])
|
||||||
if (fileRef.current) fileRef.current.value = ''
|
if (fileRef.current) fileRef.current.value = ''
|
||||||
if (!files.length || !source || source === 'anilist') return
|
if (!files.length || !source || source === 'anilist' || source === 'text') return
|
||||||
void run(() => readEntries(source, files))
|
void run(() => readEntries(source, files))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const onText = () => {
|
||||||
|
const list = parseTextList(pasted, { defaultStatus })
|
||||||
|
if (!list.length) return setError(t('import.err.empty'))
|
||||||
|
const tk = { cancelled: false }
|
||||||
|
token.current = tk
|
||||||
|
setError(undefined)
|
||||||
|
setEntries(list)
|
||||||
|
setStep('working')
|
||||||
|
setPhase('resolving')
|
||||||
|
setProgress({ done: 0, total: list.length })
|
||||||
|
resolveTextEntries(list, { tmdbKey: settings.tmdbKey, token: tk, onProgress: (p) => !tk.cancelled && setProgress(p) })
|
||||||
|
.then(({ found, unsure }) => {
|
||||||
|
if (tk.cancelled) return
|
||||||
|
setEntries([...list])
|
||||||
|
setMatches(found)
|
||||||
|
setUnsure(unsure)
|
||||||
|
setExcluded(new Set())
|
||||||
|
setStep('review')
|
||||||
|
})
|
||||||
|
.catch((e) => {
|
||||||
|
if (e instanceof CancelledError || tk.cancelled) return
|
||||||
|
setError(errorText(e))
|
||||||
|
setStep('input')
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
const onAniList = () => {
|
const onAniList = () => {
|
||||||
const name = userName.trim()
|
const name = userName.trim()
|
||||||
if (!isAniListUserName(name)) return setError(t('import.err.user'))
|
if (!isAniListUserName(name)) return setError(t('import.err.user'))
|
||||||
@@ -148,7 +188,7 @@ export default function ImportWizard({ onClose }: { onClose: () => void }) {
|
|||||||
setPhase('saving')
|
setPhase('saving')
|
||||||
try {
|
try {
|
||||||
await importItems([...plan.added, ...plan.updated], 'merge')
|
await importItems([...plan.added, ...plan.updated], 'merge')
|
||||||
setResult({ added: plan.added.length, updated: plan.updated.length, unchanged: plan.unchanged, notFound: includeUnmatched ? 0 : plan.notFound.length })
|
setResult({ added: plan.added.length, updated: plan.updated.length, unchanged: plan.unchanged, notFound: includeUnmatched || source === 'text' ? 0 : plan.notFound.length })
|
||||||
setStep('done')
|
setStep('done')
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
setError(errorText(e))
|
setError(errorText(e))
|
||||||
@@ -164,7 +204,7 @@ export default function ImportWizard({ onClose }: { onClose: () => void }) {
|
|||||||
|
|
||||||
const back = () => {
|
const back = () => {
|
||||||
setError(undefined)
|
setError(undefined)
|
||||||
setStep(step === 'preview' ? 'input' : 'source')
|
setStep(step === 'preview' ? (source === 'text' ? 'review' : 'input') : step === 'review' ? 'input' : 'source')
|
||||||
}
|
}
|
||||||
|
|
||||||
const pct = progress.total ? Math.round((progress.done / progress.total) * 100) : 0
|
const pct = progress.total ? Math.round((progress.done / progress.total) * 100) : 0
|
||||||
@@ -175,14 +215,14 @@ export default function ImportWizard({ onClose }: { onClose: () => void }) {
|
|||||||
<div className="sheet sheet-in z-[60]" role="dialog" aria-modal="true" aria-label={t('import.title')}>
|
<div className="sheet sheet-in z-[60]" role="dialog" aria-modal="true" aria-label={t('import.title')}>
|
||||||
<header className="safe-top border-b border-line">
|
<header className="safe-top border-b border-line">
|
||||||
<div className="mx-auto flex max-w-2xl items-center gap-2 px-3 py-2.5 lg:max-w-none lg:px-10">
|
<div className="mx-auto flex max-w-2xl items-center gap-2 px-3 py-2.5 lg:max-w-none lg:px-10">
|
||||||
{step === 'input' || step === 'preview' ? (
|
{step === 'input' || step === 'review' || step === 'preview' ? (
|
||||||
<button onClick={back} className="grid size-10 shrink-0 place-items-center rounded-full text-ink-2 rtl:-scale-x-100" aria-label={t('import.back')}>
|
<button onClick={back} className="grid size-10 shrink-0 place-items-center rounded-full text-ink-2 rtl:-scale-x-100" aria-label={t('import.back')}>
|
||||||
<ArrowLeft size={21} />
|
<ArrowLeft size={21} />
|
||||||
</button>
|
</button>
|
||||||
) : (
|
) : (
|
||||||
<span className="size-10 shrink-0" />
|
<span className="size-10 shrink-0" />
|
||||||
)}
|
)}
|
||||||
<h2 className="min-w-0 flex-1 truncate text-center text-base font-semibold">{info && step !== 'source' ? info.name : t('import.title')}</h2>
|
<h2 className="min-w-0 flex-1 truncate text-center text-base font-semibold">{info && step !== 'source' ? sourceName(info) : t('import.title')}</h2>
|
||||||
<button onClick={close} className="grid size-10 shrink-0 place-items-center rounded-full text-ink-2" aria-label={t('common.close')}>
|
<button onClick={close} className="grid size-10 shrink-0 place-items-center rounded-full text-ink-2" aria-label={t('common.close')}>
|
||||||
<X size={22} />
|
<X size={22} />
|
||||||
</button>
|
</button>
|
||||||
@@ -207,7 +247,7 @@ export default function ImportWizard({ onClose }: { onClose: () => void }) {
|
|||||||
>
|
>
|
||||||
<span className="grid size-12 shrink-0 place-items-center rounded-xl border border-line-strong bg-surface-2 text-sm font-bold tracking-tight text-ink">{s.mark}</span>
|
<span className="grid size-12 shrink-0 place-items-center rounded-xl border border-line-strong bg-surface-2 text-sm font-bold tracking-tight text-ink">{s.mark}</span>
|
||||||
<span className="min-w-0 flex-1">
|
<span className="min-w-0 flex-1">
|
||||||
<span className="block font-semibold">{s.name}</span>
|
<span className="block font-semibold">{sourceName(s)}</span>
|
||||||
<span className="mt-0.5 block text-xs text-ink-3">{t(`import.src.${s.id}` as TKey)}</span>
|
<span className="mt-0.5 block text-xs text-ink-3">{t(`import.src.${s.id}` as TKey)}</span>
|
||||||
</span>
|
</span>
|
||||||
<span className="text-ink-3 rtl:-scale-x-100">→</span>
|
<span className="text-ink-3 rtl:-scale-x-100">→</span>
|
||||||
@@ -236,7 +276,36 @@ export default function ImportWizard({ onClose }: { onClose: () => void }) {
|
|||||||
<p className="mt-5 rounded-2xl border border-dashed border-line-strong p-3.5 text-xs leading-relaxed text-ink-2">{t('import.noTmdb')}</p>
|
<p className="mt-5 rounded-2xl border border-dashed border-line-strong p-3.5 text-xs leading-relaxed text-ink-2">{t('import.noTmdb')}</p>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{info.id === 'anilist' ? (
|
{info.id === 'text' ? (
|
||||||
|
<div className="mt-6">
|
||||||
|
<textarea
|
||||||
|
className="field min-h-56 w-full resize-y py-3 leading-relaxed"
|
||||||
|
value={pasted}
|
||||||
|
onChange={(e) => setPasted(e.target.value.slice(0, TEXT_MAX_CHARS))}
|
||||||
|
placeholder={t('import.text.placeholder')}
|
||||||
|
aria-label={t('import.text.name')}
|
||||||
|
spellCheck={false}
|
||||||
|
/>
|
||||||
|
<p className="mt-4 text-sm font-medium">{t('import.text.default')}</p>
|
||||||
|
<div className="mt-2 grid grid-cols-2 gap-2" role="radiogroup" aria-label={t('import.text.default')}>
|
||||||
|
{(['termine', 'a_voir'] as const).map((st) => (
|
||||||
|
<button
|
||||||
|
key={st}
|
||||||
|
type="button"
|
||||||
|
role="radio"
|
||||||
|
aria-checked={defaultStatus === st}
|
||||||
|
onClick={() => setDefaultStatus(st)}
|
||||||
|
className={cx('btn', defaultStatus === st ? 'btn-primary' : 'btn-ghost')}
|
||||||
|
>
|
||||||
|
{st === 'termine' ? t('import.text.seen') : t('status.a_voir')}
|
||||||
|
</button>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
<button type="button" onClick={onText} disabled={!pasted.trim()} className="btn btn-primary mt-5 w-full">
|
||||||
|
{t('import.text.analyze')}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
) : info.id === 'anilist' ? (
|
||||||
<form
|
<form
|
||||||
className="mt-6 flex gap-2"
|
className="mt-6 flex gap-2"
|
||||||
onSubmit={(e) => {
|
onSubmit={(e) => {
|
||||||
@@ -312,6 +381,37 @@ export default function ImportWizard({ onClose }: { onClose: () => void }) {
|
|||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
|
{step === 'review' && source === 'text' && (
|
||||||
|
<ImportTextReview
|
||||||
|
entries={entries as TextEntry[]}
|
||||||
|
matches={matches}
|
||||||
|
unsure={unsure}
|
||||||
|
excluded={excluded}
|
||||||
|
tmdbKey={settings.tmdbKey}
|
||||||
|
onToggle={(key) =>
|
||||||
|
setExcluded((prev) => {
|
||||||
|
const next = new Set(prev)
|
||||||
|
if (!next.delete(key)) next.add(key)
|
||||||
|
return next
|
||||||
|
})
|
||||||
|
}
|
||||||
|
onChange={(key, match) => {
|
||||||
|
setMatches((prev) => new Map(prev).set(key, match))
|
||||||
|
setUnsure((prev) => {
|
||||||
|
const next = new Set(prev)
|
||||||
|
next.delete(key)
|
||||||
|
return next
|
||||||
|
})
|
||||||
|
setExcluded((prev) => {
|
||||||
|
const next = new Set(prev)
|
||||||
|
next.delete(key)
|
||||||
|
return next
|
||||||
|
})
|
||||||
|
}}
|
||||||
|
onContinue={() => setStep('preview')}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
|
||||||
{step === 'preview' && plan && kinds && (
|
{step === 'preview' && plan && kinds && (
|
||||||
<>
|
<>
|
||||||
<p className="text-sm text-ink-2">{t('import.found', { n: entries.length })}</p>
|
<p className="text-sm text-ink-2">{t('import.found', { n: entries.length })}</p>
|
||||||
@@ -336,7 +436,7 @@ export default function ImportWizard({ onClose }: { onClose: () => void }) {
|
|||||||
<Line label={t('import.notFound')} value={plan.notFound.length} accent={plan.notFound.length > 0} />
|
<Line label={t('import.notFound')} value={plan.notFound.length} accent={plan.notFound.length > 0} />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{plan.notFound.length > 0 && (
|
{source !== 'text' && plan.notFound.length > 0 && (
|
||||||
<div className="mt-3">
|
<div className="mt-3">
|
||||||
<button onClick={() => setShowMissing((v) => !v)} className="flex items-center gap-1.5 text-sm font-medium text-ink-2" aria-expanded={showMissing}>
|
<button onClick={() => setShowMissing((v) => !v)} className="flex items-center gap-1.5 text-sm font-medium text-ink-2" aria-expanded={showMissing}>
|
||||||
<ChevronDown size={16} className={cx('transition-transform', showMissing && 'rotate-180')} />
|
<ChevronDown size={16} className={cx('transition-transform', showMissing && 'rotate-180')} />
|
||||||
|
|||||||
@@ -937,6 +937,19 @@ const dict: Translations = {
|
|||||||
'import.src.tvtime': "المسلسلات المتابَعة والحلقات المشاهَدة",
|
'import.src.tvtime': "المسلسلات المتابَعة والحلقات المشاهَدة",
|
||||||
'import.src.mal': "قائمة الأنمي (تصدير XML)",
|
'import.src.mal': "قائمة الأنمي (تصدير XML)",
|
||||||
'import.src.anilist': "قائمة أنمي عامة، باسم المستخدم",
|
'import.src.anilist': "قائمة أنمي عامة، باسم المستخدم",
|
||||||
|
'import.text.name': "لصق قائمة",
|
||||||
|
'import.src.text': "من تطبيق الملاحظات أو أي نص",
|
||||||
|
'import.steps.text': "افتح قائمتك في تطبيق الملاحظات وانسخ النص كله.\nالصقه هنا، عنوان واحد في كل سطر. بعد العنوان يمكنك إضافة تقييم (4.5/5، 8/10، ★★★★) وحالة (watched، watching، to watch) ومراجعتك.\nبعد ذلك تتحقق من كل عنوان قبل إضافته.",
|
||||||
|
'import.text.placeholder': "Inception (2010) 4.5/5 loved it\nBreaking Bad ★★★★★\nOne Piece - watching S3E12\nDune to watch",
|
||||||
|
'import.text.default': "العناوين بلا حالة هي:",
|
||||||
|
'import.text.seen': "شوهدت",
|
||||||
|
'import.text.analyze': "البحث عن العناوين",
|
||||||
|
'import.text.reviewHint': "تحقق من العناوين التي وُجدت. ألغِ تحديد ما لا تريده أو اختر العنوان الصحيح.",
|
||||||
|
'import.text.toCheck': "للتحقق: {n}",
|
||||||
|
'import.text.none': "لم يُعثر على عنوان",
|
||||||
|
'import.text.check': "للتحقق",
|
||||||
|
'import.text.change': "تغيير",
|
||||||
|
'import.text.search': "بحث",
|
||||||
'import.how': "الحصول على ملف التصدير",
|
'import.how': "الحصول على ملف التصدير",
|
||||||
'import.steps.letterboxd': "على letterboxd.com افتح Settings ← Import & Export ← Export your data.\nستحصل على ملف ZIP: أفلته هنا كما هو (أو ملفات CSV التي فيه).",
|
'import.steps.letterboxd': "على letterboxd.com افتح Settings ← Import & Export ← Export your data.\nستحصل على ملف ZIP: أفلته هنا كما هو (أو ملفات CSV التي فيه).",
|
||||||
'import.steps.tvtime': "في TV Time اطلب نسخة من بياناتك (الإعدادات ← الخصوصية، أو الدعم «Request my data»).\nأفلت هنا ملف ZIP الذي وصلك بالبريد، أو ملفات CSV التي فيه.",
|
'import.steps.tvtime': "في TV Time اطلب نسخة من بياناتك (الإعدادات ← الخصوصية، أو الدعم «Request my data»).\nأفلت هنا ملف ZIP الذي وصلك بالبريد، أو ملفات CSV التي فيه.",
|
||||||
|
|||||||
@@ -799,6 +799,19 @@ const dict: Translations = {
|
|||||||
'import.src.tvtime': "Verfolgte Serien und gesehene Folgen",
|
'import.src.tvtime': "Verfolgte Serien und gesehene Folgen",
|
||||||
'import.src.mal': "Anime-Liste (XML-Export)",
|
'import.src.mal': "Anime-Liste (XML-Export)",
|
||||||
'import.src.anilist': "Öffentliche Anime-Liste, per Benutzername",
|
'import.src.anilist': "Öffentliche Anime-Liste, per Benutzername",
|
||||||
|
'import.text.name': "Liste einfügen",
|
||||||
|
'import.src.text': "Aus der Notizen-App oder beliebigem Text",
|
||||||
|
'import.steps.text': "Öffne deine Liste in der Notizen-App und kopiere den ganzen Text.\nFüge ihn hier ein, eine Zeile pro Titel. Nach dem Titel kannst du eine Bewertung (4.5/5, 8/10, ★★★★), einen Status (watched, watching, to watch) und deine Rezension angeben.\nDanach prüfst du jeden gefundenen Titel, bevor er hinzugefügt wird.",
|
||||||
|
'import.text.placeholder': "Inception (2010) 4.5/5 loved it\nBreaking Bad ★★★★★\nOne Piece - watching S3E12\nDune to watch",
|
||||||
|
'import.text.default': "Titel ohne Status sind:",
|
||||||
|
'import.text.seen': "Schon gesehen",
|
||||||
|
'import.text.analyze': "Titel suchen",
|
||||||
|
'import.text.reviewHint': "Prüfe die gefundenen Titel. Entferne den Haken bei denen, die du nicht willst, oder wähle den richtigen Titel.",
|
||||||
|
'import.text.toCheck': "Zu prüfen: {n}",
|
||||||
|
'import.text.none': "Kein Titel gefunden",
|
||||||
|
'import.text.check': "Prüfen",
|
||||||
|
'import.text.change': "Ändern",
|
||||||
|
'import.text.search': "Suchen",
|
||||||
'import.how': "Export besorgen",
|
'import.how': "Export besorgen",
|
||||||
'import.steps.letterboxd': "Öffne auf letterboxd.com Settings → Import & Export → Export your data.\nDu erhältst eine ZIP-Datei: lege sie unverändert hier ab (oder ihre CSV-Dateien).",
|
'import.steps.letterboxd': "Öffne auf letterboxd.com Settings → Import & Export → Export your data.\nDu erhältst eine ZIP-Datei: lege sie unverändert hier ab (oder ihre CSV-Dateien).",
|
||||||
'import.steps.tvtime': "Fordere in TV Time eine Kopie deiner Daten an (Einstellungen → Datenschutz oder Support „Request my data“).\nLege die per E-Mail erhaltene ZIP-Datei oder ihre CSV-Dateien hier ab.",
|
'import.steps.tvtime': "Fordere in TV Time eine Kopie deiner Daten an (Einstellungen → Datenschutz oder Support „Request my data“).\nLege die per E-Mail erhaltene ZIP-Datei oder ihre CSV-Dateien hier ab.",
|
||||||
|
|||||||
@@ -799,6 +799,19 @@ const dict: Translations = {
|
|||||||
'import.src.tvtime': "Followed shows and watched episodes",
|
'import.src.tvtime': "Followed shows and watched episodes",
|
||||||
'import.src.mal': "Anime list (XML export)",
|
'import.src.mal': "Anime list (XML export)",
|
||||||
'import.src.anilist': "Public anime list, by username",
|
'import.src.anilist': "Public anime list, by username",
|
||||||
|
'import.text.name': "Paste a list",
|
||||||
|
'import.src.text': "From the Notes app or any text",
|
||||||
|
'import.steps.text': "In the Notes app, open your list and copy all the text.\nPaste it here, one line per title. After the title you can add a rating (4.5/5, 8/10, ★★★★), a status (watched, watching, to watch) and your review.\nYou then check each title found before adding it.",
|
||||||
|
'import.text.placeholder': "Inception (2010) 4.5/5 loved it\nBreaking Bad ★★★★★\nOne Piece - watching S3E12\nDune to watch",
|
||||||
|
'import.text.default': "Titles without a status are:",
|
||||||
|
'import.text.seen': "Already watched",
|
||||||
|
'import.text.analyze': "Find the titles",
|
||||||
|
'import.text.reviewHint': "Check the titles found. Untick the ones you don't want, or pick the right title.",
|
||||||
|
'import.text.toCheck': "To check: {n}",
|
||||||
|
'import.text.none': "No title found",
|
||||||
|
'import.text.check': "To check",
|
||||||
|
'import.text.change': "Change",
|
||||||
|
'import.text.search': "Search",
|
||||||
'import.how': "Getting the export",
|
'import.how': "Getting the export",
|
||||||
'import.steps.letterboxd': "On letterboxd.com, open Settings → Import & Export → Export your data.\nYou get a ZIP file: drop it here as is (or its CSV files).",
|
'import.steps.letterboxd': "On letterboxd.com, open Settings → Import & Export → Export your data.\nYou get a ZIP file: drop it here as is (or its CSV files).",
|
||||||
'import.steps.tvtime': "In TV Time, request a copy of your data (Settings → Privacy, or support “Request my data”).\nDrop the ZIP you received by email here, or its CSV files.",
|
'import.steps.tvtime': "In TV Time, request a copy of your data (Settings → Privacy, or support “Request my data”).\nDrop the ZIP you received by email here, or its CSV files.",
|
||||||
|
|||||||
@@ -799,6 +799,19 @@ const dict: Translations = {
|
|||||||
'import.src.tvtime': "Series seguidas y episodios vistos",
|
'import.src.tvtime': "Series seguidas y episodios vistos",
|
||||||
'import.src.mal': "Lista de animes (exportación XML)",
|
'import.src.mal': "Lista de animes (exportación XML)",
|
||||||
'import.src.anilist': "Lista de animes pública, por nombre de usuario",
|
'import.src.anilist': "Lista de animes pública, por nombre de usuario",
|
||||||
|
'import.text.name': "Pegar una lista",
|
||||||
|
'import.src.text': "Desde la app Notas o cualquier texto",
|
||||||
|
'import.steps.text': "En la app Notas, abre tu lista y copia todo el texto.\nPégalo aquí, una línea por título. Después del título puedes poner una nota (4.5/5, 8/10, ★★★★), un estado (watched, watching, to watch) y tu reseña.\nLuego revisas cada título encontrado antes de añadirlo.",
|
||||||
|
'import.text.placeholder': "Inception (2010) 4.5/5 loved it\nBreaking Bad ★★★★★\nOne Piece - watching S3E12\nDune to watch",
|
||||||
|
'import.text.default': "Los títulos sin estado son:",
|
||||||
|
'import.text.seen': "Ya vistos",
|
||||||
|
'import.text.analyze': "Buscar los títulos",
|
||||||
|
'import.text.reviewHint': "Revisa los títulos encontrados. Desmarca los que no quieras o elige el título correcto.",
|
||||||
|
'import.text.toCheck': "Por revisar: {n}",
|
||||||
|
'import.text.none': "Ningún título encontrado",
|
||||||
|
'import.text.check': "Por revisar",
|
||||||
|
'import.text.change': "Cambiar",
|
||||||
|
'import.text.search': "Buscar",
|
||||||
'import.how': "Obtener la exportación",
|
'import.how': "Obtener la exportación",
|
||||||
'import.steps.letterboxd': "En letterboxd.com, abre Settings → Import & Export → Export your data.\nRecibes un archivo ZIP: suéltalo aquí tal cual (o sus archivos CSV).",
|
'import.steps.letterboxd': "En letterboxd.com, abre Settings → Import & Export → Export your data.\nRecibes un archivo ZIP: suéltalo aquí tal cual (o sus archivos CSV).",
|
||||||
'import.steps.tvtime': "En TV Time, solicita una copia de tus datos (Ajustes → Privacidad, o soporte «Request my data»).\nSuelta aquí el ZIP recibido por correo, o sus archivos CSV.",
|
'import.steps.tvtime': "En TV Time, solicita una copia de tus datos (Ajustes → Privacidad, o soporte «Request my data»).\nSuelta aquí el ZIP recibido por correo, o sus archivos CSV.",
|
||||||
|
|||||||
@@ -801,6 +801,19 @@ const dict = {
|
|||||||
'import.src.tvtime': "Séries suivies et épisodes vus",
|
'import.src.tvtime': "Séries suivies et épisodes vus",
|
||||||
'import.src.mal': "Liste d'animes (export XML)",
|
'import.src.mal': "Liste d'animes (export XML)",
|
||||||
'import.src.anilist': "Liste d'animes publique, par nom d'utilisateur",
|
'import.src.anilist': "Liste d'animes publique, par nom d'utilisateur",
|
||||||
|
'import.text.name': "Coller une liste",
|
||||||
|
'import.src.text': "Depuis l'app Notes ou n'importe quel texte",
|
||||||
|
'import.steps.text': "Dans l'app Notes, ouvre ta liste et copie tout le texte.\nColle-le ici, une ligne par titre. Après le titre, tu peux mettre une note (4,5/5, 8/10, ★★★★), un statut (vu, en cours, à voir) et ton avis.\nTu vérifies ensuite chaque titre trouvé avant de l'ajouter.",
|
||||||
|
'import.text.placeholder': "Inception (2010) 4,5/5 trop bien\nBreaking Bad ★★★★★\nOne Piece - en cours S3E12\nDune à voir",
|
||||||
|
'import.text.default': "Les titres sans statut sont :",
|
||||||
|
'import.text.seen': "Déjà vus",
|
||||||
|
'import.text.analyze': "Rechercher les titres",
|
||||||
|
'import.text.reviewHint': "Vérifie les titres trouvés. Décoche ceux à ne pas ajouter, ou choisis le bon titre.",
|
||||||
|
'import.text.toCheck': "À vérifier : {n}",
|
||||||
|
'import.text.none': "Aucun titre trouvé",
|
||||||
|
'import.text.check': "À vérifier",
|
||||||
|
'import.text.change': "Changer",
|
||||||
|
'import.text.search': "Chercher",
|
||||||
'import.how': "Récupérer l'export",
|
'import.how': "Récupérer l'export",
|
||||||
'import.steps.letterboxd': "Sur letterboxd.com, ouvre Settings → Import & Export → Export your data.\nTu reçois un fichier ZIP : dépose-le ici tel quel (ou ses fichiers CSV).",
|
'import.steps.letterboxd': "Sur letterboxd.com, ouvre Settings → Import & Export → Export your data.\nTu reçois un fichier ZIP : dépose-le ici tel quel (ou ses fichiers CSV).",
|
||||||
'import.steps.tvtime': "Dans TV Time, demande une copie de tes données (Paramètres → Confidentialité, ou support « Request my data »).\nDépose ici le ZIP reçu par e-mail, ou ses fichiers CSV.",
|
'import.steps.tvtime': "Dans TV Time, demande une copie de tes données (Paramètres → Confidentialité, ou support « Request my data »).\nDépose ici le ZIP reçu par e-mail, ou ses fichiers CSV.",
|
||||||
|
|||||||
@@ -799,6 +799,19 @@ const dict: Translations = {
|
|||||||
'import.src.tvtime': "फ़ॉलो की गई सीरीज़ और देखे गए एपिसोड",
|
'import.src.tvtime': "फ़ॉलो की गई सीरीज़ और देखे गए एपिसोड",
|
||||||
'import.src.mal': "एनीमे सूची (XML एक्सपोर्ट)",
|
'import.src.mal': "एनीमे सूची (XML एक्सपोर्ट)",
|
||||||
'import.src.anilist': "सार्वजनिक एनीमे सूची, यूज़रनेम से",
|
'import.src.anilist': "सार्वजनिक एनीमे सूची, यूज़रनेम से",
|
||||||
|
'import.text.name': "सूची चिपकाएँ",
|
||||||
|
'import.src.text': "Notes ऐप या किसी भी टेक्स्ट से",
|
||||||
|
'import.steps.text': "Notes ऐप में अपनी सूची खोलें और पूरा टेक्स्ट कॉपी करें।\nइसे यहाँ चिपकाएँ, हर पंक्ति में एक शीर्षक। शीर्षक के बाद रेटिंग (4.5/5, 8/10, ★★★★), स्थिति (watched, watching, to watch) और अपनी समीक्षा लिख सकते हैं।\nफिर जोड़ने से पहले हर मिले शीर्षक की जाँच करें।",
|
||||||
|
'import.text.placeholder': "Inception (2010) 4.5/5 loved it\nBreaking Bad ★★★★★\nOne Piece - watching S3E12\nDune to watch",
|
||||||
|
'import.text.default': "बिना स्थिति वाले शीर्षक हैं:",
|
||||||
|
'import.text.seen': "पहले से देखे",
|
||||||
|
'import.text.analyze': "शीर्षक खोजें",
|
||||||
|
'import.text.reviewHint': "मिले शीर्षकों की जाँच करें। जो नहीं चाहिए उनका निशान हटाएँ या सही शीर्षक चुनें।",
|
||||||
|
'import.text.toCheck': "जाँचना है: {n}",
|
||||||
|
'import.text.none': "कोई शीर्षक नहीं मिला",
|
||||||
|
'import.text.check': "जाँचें",
|
||||||
|
'import.text.change': "बदलें",
|
||||||
|
'import.text.search': "खोजें",
|
||||||
'import.how': "एक्सपोर्ट कैसे पाएँ",
|
'import.how': "एक्सपोर्ट कैसे पाएँ",
|
||||||
'import.steps.letterboxd': "letterboxd.com पर Settings → Import & Export → Export your data खोलें।\nआपको एक ZIP फ़ाइल मिलेगी: उसे जैसी है वैसी यहाँ छोड़ें (या उसकी CSV फ़ाइलें)।",
|
'import.steps.letterboxd': "letterboxd.com पर Settings → Import & Export → Export your data खोलें।\nआपको एक ZIP फ़ाइल मिलेगी: उसे जैसी है वैसी यहाँ छोड़ें (या उसकी CSV फ़ाइलें)।",
|
||||||
'import.steps.tvtime': "TV Time में अपने डेटा की कॉपी माँगें (सेटिंग्स → प्राइवेसी, या सपोर्ट “Request my data”)।\nईमेल से मिली ZIP या उसकी CSV फ़ाइलें यहाँ छोड़ें।",
|
'import.steps.tvtime': "TV Time में अपने डेटा की कॉपी माँगें (सेटिंग्स → प्राइवेसी, या सपोर्ट “Request my data”)।\nईमेल से मिली ZIP या उसकी CSV फ़ाइलें यहाँ छोड़ें।",
|
||||||
|
|||||||
@@ -799,6 +799,19 @@ const dict: Translations = {
|
|||||||
'import.src.tvtime': "Serial yang diikuti dan episode yang ditonton",
|
'import.src.tvtime': "Serial yang diikuti dan episode yang ditonton",
|
||||||
'import.src.mal': "Daftar anime (ekspor XML)",
|
'import.src.mal': "Daftar anime (ekspor XML)",
|
||||||
'import.src.anilist': "Daftar anime publik, lewat nama pengguna",
|
'import.src.anilist': "Daftar anime publik, lewat nama pengguna",
|
||||||
|
'import.text.name': "Tempel daftar",
|
||||||
|
'import.src.text': "Dari aplikasi Catatan atau teks apa pun",
|
||||||
|
'import.steps.text': "Di aplikasi Catatan, buka daftarmu dan salin semua teksnya.\nTempel di sini, satu baris per judul. Setelah judul kamu bisa menambahkan nilai (4.5/5, 8/10, ★★★★), status (watched, watching, to watch) dan ulasanmu.\nLalu kamu memeriksa setiap judul yang ditemukan sebelum ditambahkan.",
|
||||||
|
'import.text.placeholder': "Inception (2010) 4.5/5 loved it\nBreaking Bad ★★★★★\nOne Piece - watching S3E12\nDune to watch",
|
||||||
|
'import.text.default': "Judul tanpa status adalah:",
|
||||||
|
'import.text.seen': "Sudah ditonton",
|
||||||
|
'import.text.analyze': "Cari judul",
|
||||||
|
'import.text.reviewHint': "Periksa judul yang ditemukan. Hapus centang yang tidak diinginkan, atau pilih judul yang benar.",
|
||||||
|
'import.text.toCheck': "Perlu dicek: {n}",
|
||||||
|
'import.text.none': "Judul tidak ditemukan",
|
||||||
|
'import.text.check': "Perlu dicek",
|
||||||
|
'import.text.change': "Ganti",
|
||||||
|
'import.text.search': "Cari",
|
||||||
'import.how': "Cara mendapatkan ekspor",
|
'import.how': "Cara mendapatkan ekspor",
|
||||||
'import.steps.letterboxd': "Di letterboxd.com, buka Settings → Import & Export → Export your data.\nKamu akan mendapat file ZIP: letakkan di sini apa adanya (atau file CSV-nya).",
|
'import.steps.letterboxd': "Di letterboxd.com, buka Settings → Import & Export → Export your data.\nKamu akan mendapat file ZIP: letakkan di sini apa adanya (atau file CSV-nya).",
|
||||||
'import.steps.tvtime': "Di TV Time, minta salinan datamu (Pengaturan → Privasi, atau dukungan “Request my data”).\nLetakkan di sini ZIP yang diterima lewat email, atau file CSV-nya.",
|
'import.steps.tvtime': "Di TV Time, minta salinan datamu (Pengaturan → Privasi, atau dukungan “Request my data”).\nLetakkan di sini ZIP yang diterima lewat email, atau file CSV-nya.",
|
||||||
|
|||||||
@@ -799,6 +799,19 @@ const dict: Translations = {
|
|||||||
'import.src.tvtime': "Serie seguite ed episodi visti",
|
'import.src.tvtime': "Serie seguite ed episodi visti",
|
||||||
'import.src.mal': "Lista anime (esportazione XML)",
|
'import.src.mal': "Lista anime (esportazione XML)",
|
||||||
'import.src.anilist': "Lista anime pubblica, per nome utente",
|
'import.src.anilist': "Lista anime pubblica, per nome utente",
|
||||||
|
'import.text.name': "Incolla una lista",
|
||||||
|
'import.src.text': "Dall'app Note o da qualsiasi testo",
|
||||||
|
'import.steps.text': "Nell'app Note, apri la tua lista e copia tutto il testo.\nIncollalo qui, una riga per titolo. Dopo il titolo puoi aggiungere un voto (4.5/5, 8/10, ★★★★), uno stato (watched, watching, to watch) e la tua recensione.\nPoi controlli ogni titolo trovato prima di aggiungerlo.",
|
||||||
|
'import.text.placeholder': "Inception (2010) 4.5/5 loved it\nBreaking Bad ★★★★★\nOne Piece - watching S3E12\nDune to watch",
|
||||||
|
'import.text.default': "I titoli senza stato sono:",
|
||||||
|
'import.text.seen': "Già visti",
|
||||||
|
'import.text.analyze': "Cerca i titoli",
|
||||||
|
'import.text.reviewHint': "Controlla i titoli trovati. Togli la spunta a quelli da non aggiungere o scegli il titolo giusto.",
|
||||||
|
'import.text.toCheck': "Da controllare: {n}",
|
||||||
|
'import.text.none': "Nessun titolo trovato",
|
||||||
|
'import.text.check': "Da controllare",
|
||||||
|
'import.text.change': "Cambia",
|
||||||
|
'import.text.search': "Cerca",
|
||||||
'import.how': "Ottenere l'esportazione",
|
'import.how': "Ottenere l'esportazione",
|
||||||
'import.steps.letterboxd': "Su letterboxd.com, apri Settings → Import & Export → Export your data.\nRicevi un file ZIP: rilascialo qui così com’è (o i suoi file CSV).",
|
'import.steps.letterboxd': "Su letterboxd.com, apri Settings → Import & Export → Export your data.\nRicevi un file ZIP: rilascialo qui così com’è (o i suoi file CSV).",
|
||||||
'import.steps.tvtime': "In TV Time, richiedi una copia dei tuoi dati (Impostazioni → Privacy, o supporto «Request my data»).\nRilascia qui lo ZIP ricevuto via e-mail, o i suoi file CSV.",
|
'import.steps.tvtime': "In TV Time, richiedi una copia dei tuoi dati (Impostazioni → Privacy, o supporto «Request my data»).\nRilascia qui lo ZIP ricevuto via e-mail, o i suoi file CSV.",
|
||||||
|
|||||||
@@ -799,6 +799,19 @@ const dict: Translations = {
|
|||||||
'import.src.tvtime': "フォロー中のシリーズと視聴済みエピソード",
|
'import.src.tvtime': "フォロー中のシリーズと視聴済みエピソード",
|
||||||
'import.src.mal': "アニメリスト(XML エクスポート)",
|
'import.src.mal': "アニメリスト(XML エクスポート)",
|
||||||
'import.src.anilist': "公開アニメリスト(ユーザー名で)",
|
'import.src.anilist': "公開アニメリスト(ユーザー名で)",
|
||||||
|
'import.text.name': "リストを貼り付け",
|
||||||
|
'import.src.text': "メモアプリや任意のテキストから",
|
||||||
|
'import.steps.text': "メモアプリでリストを開き、テキストをすべてコピーします。\nここに貼り付けます(1行に1作品)。タイトルの後に評価(4.5/5、8/10、★★★★)、状態(watched、watching、to watch)、レビューを書けます。\n追加する前に、見つかった作品をひとつずつ確認します。",
|
||||||
|
'import.text.placeholder': "Inception (2010) 4.5/5 loved it\nBreaking Bad ★★★★★\nOne Piece - watching S3E12\nDune to watch",
|
||||||
|
'import.text.default': "状態のない作品は:",
|
||||||
|
'import.text.seen': "視聴済み",
|
||||||
|
'import.text.analyze': "作品を探す",
|
||||||
|
'import.text.reviewHint': "見つかった作品を確認してください。不要なものはチェックを外すか、正しい作品を選んでください。",
|
||||||
|
'import.text.toCheck': "要確認:{n}",
|
||||||
|
'import.text.none': "作品が見つかりません",
|
||||||
|
'import.text.check': "要確認",
|
||||||
|
'import.text.change': "変更",
|
||||||
|
'import.text.search': "検索",
|
||||||
'import.how': "エクスポートの入手方法",
|
'import.how': "エクスポートの入手方法",
|
||||||
'import.steps.letterboxd': "letterboxd.com で Settings → Import & Export → Export your data を開きます。\nZIP ファイルが届くので、そのままここにドロップしてください(中の CSV でも可)。",
|
'import.steps.letterboxd': "letterboxd.com で Settings → Import & Export → Export your data を開きます。\nZIP ファイルが届くので、そのままここにドロップしてください(中の CSV でも可)。",
|
||||||
'import.steps.tvtime': "TV Time でデータのコピーを依頼します(設定 → プライバシー、またはサポートの「Request my data」)。\nメールで届いた ZIP、またはその CSV をここにドロップしてください。",
|
'import.steps.tvtime': "TV Time でデータのコピーを依頼します(設定 → プライバシー、またはサポートの「Request my data」)。\nメールで届いた ZIP、またはその CSV をここにドロップしてください。",
|
||||||
|
|||||||
@@ -799,6 +799,19 @@ const dict: Translations = {
|
|||||||
'import.src.tvtime': "팔로우한 시리즈와 본 에피소드",
|
'import.src.tvtime': "팔로우한 시리즈와 본 에피소드",
|
||||||
'import.src.mal': "애니 목록 (XML 내보내기)",
|
'import.src.mal': "애니 목록 (XML 내보내기)",
|
||||||
'import.src.anilist': "공개 애니 목록, 사용자 이름으로",
|
'import.src.anilist': "공개 애니 목록, 사용자 이름으로",
|
||||||
|
'import.text.name': "목록 붙여넣기",
|
||||||
|
'import.src.text': "메모 앱 또는 아무 텍스트에서",
|
||||||
|
'import.steps.text': "메모 앱에서 목록을 열고 텍스트를 모두 복사하세요.\n여기에 붙여넣으세요. 한 줄에 한 작품입니다. 제목 뒤에 평점(4.5/5, 8/10, ★★★★), 상태(watched, watching, to watch), 리뷰를 쓸 수 있어요.\n추가하기 전에 찾은 작품을 하나씩 확인합니다.",
|
||||||
|
'import.text.placeholder': "Inception (2010) 4.5/5 loved it\nBreaking Bad ★★★★★\nOne Piece - watching S3E12\nDune to watch",
|
||||||
|
'import.text.default': "상태가 없는 작품은:",
|
||||||
|
'import.text.seen': "이미 봄",
|
||||||
|
'import.text.analyze': "작품 찾기",
|
||||||
|
'import.text.reviewHint': "찾은 작품을 확인하세요. 원하지 않는 작품은 선택을 해제하거나 올바른 작품을 고르세요.",
|
||||||
|
'import.text.toCheck': "확인 필요: {n}",
|
||||||
|
'import.text.none': "작품을 찾지 못했어요",
|
||||||
|
'import.text.check': "확인 필요",
|
||||||
|
'import.text.change': "변경",
|
||||||
|
'import.text.search': "검색",
|
||||||
'import.how': "내보내기 파일 받기",
|
'import.how': "내보내기 파일 받기",
|
||||||
'import.steps.letterboxd': "letterboxd.com에서 Settings → Import & Export → Export your data를 여세요.\nZIP 파일을 받으면 그대로 여기에 놓으세요 (또는 안의 CSV 파일).",
|
'import.steps.letterboxd': "letterboxd.com에서 Settings → Import & Export → Export your data를 여세요.\nZIP 파일을 받으면 그대로 여기에 놓으세요 (또는 안의 CSV 파일).",
|
||||||
'import.steps.tvtime': "TV Time에서 내 데이터 사본을 요청하세요 (설정 → 개인정보, 또는 지원 “Request my data”).\n이메일로 받은 ZIP이나 그 안의 CSV 파일을 여기에 놓으세요.",
|
'import.steps.tvtime': "TV Time에서 내 데이터 사본을 요청하세요 (설정 → 개인정보, 또는 지원 “Request my data”).\n이메일로 받은 ZIP이나 그 안의 CSV 파일을 여기에 놓으세요.",
|
||||||
|
|||||||
@@ -799,6 +799,19 @@ const dict: Translations = {
|
|||||||
'import.src.tvtime': "Gevolgde series en bekeken afleveringen",
|
'import.src.tvtime': "Gevolgde series en bekeken afleveringen",
|
||||||
'import.src.mal': "Animelijst (XML-export)",
|
'import.src.mal': "Animelijst (XML-export)",
|
||||||
'import.src.anilist': "Openbare animelijst, via gebruikersnaam",
|
'import.src.anilist': "Openbare animelijst, via gebruikersnaam",
|
||||||
|
'import.text.name': "Lijst plakken",
|
||||||
|
'import.src.text': "Uit de Notities-app of andere tekst",
|
||||||
|
'import.steps.text': "Open je lijst in de Notities-app en kopieer alle tekst.\nPlak hem hier, één regel per titel. Na de titel kun je een score (4.5/5, 8/10, ★★★★), een status (watched, watching, to watch) en je recensie zetten.\nDaarna controleer je elke gevonden titel voordat hij wordt toegevoegd.",
|
||||||
|
'import.text.placeholder': "Inception (2010) 4.5/5 loved it\nBreaking Bad ★★★★★\nOne Piece - watching S3E12\nDune to watch",
|
||||||
|
'import.text.default': "Titels zonder status zijn:",
|
||||||
|
'import.text.seen': "Al gezien",
|
||||||
|
'import.text.analyze': "Titels zoeken",
|
||||||
|
'import.text.reviewHint': "Controleer de gevonden titels. Vink uit wat je niet wilt, of kies de juiste titel.",
|
||||||
|
'import.text.toCheck': "Te controleren: {n}",
|
||||||
|
'import.text.none': "Geen titel gevonden",
|
||||||
|
'import.text.check': "Controleren",
|
||||||
|
'import.text.change': "Wijzigen",
|
||||||
|
'import.text.search': "Zoeken",
|
||||||
'import.how': "Export ophalen",
|
'import.how': "Export ophalen",
|
||||||
'import.steps.letterboxd': "Open op letterboxd.com Settings → Import & Export → Export your data.\nJe krijgt een ZIP-bestand: zet het hier neer zoals het is (of de CSV-bestanden).",
|
'import.steps.letterboxd': "Open op letterboxd.com Settings → Import & Export → Export your data.\nJe krijgt een ZIP-bestand: zet het hier neer zoals het is (of de CSV-bestanden).",
|
||||||
'import.steps.tvtime': "Vraag in TV Time een kopie van je gegevens aan (Instellingen → Privacy, of support “Request my data”).\nZet de per e-mail ontvangen ZIP hier neer, of de CSV-bestanden.",
|
'import.steps.tvtime': "Vraag in TV Time een kopie van je gegevens aan (Instellingen → Privacy, of support “Request my data”).\nZet de per e-mail ontvangen ZIP hier neer, of de CSV-bestanden.",
|
||||||
|
|||||||
@@ -891,6 +891,19 @@ const dict: Translations = {
|
|||||||
'import.src.tvtime': "Obserwowane seriale i obejrzane odcinki",
|
'import.src.tvtime': "Obserwowane seriale i obejrzane odcinki",
|
||||||
'import.src.mal': "Lista anime (eksport XML)",
|
'import.src.mal': "Lista anime (eksport XML)",
|
||||||
'import.src.anilist': "Publiczna lista anime, po nazwie użytkownika",
|
'import.src.anilist': "Publiczna lista anime, po nazwie użytkownika",
|
||||||
|
'import.text.name': "Wklej listę",
|
||||||
|
'import.src.text': "Z aplikacji Notatki lub dowolnego tekstu",
|
||||||
|
'import.steps.text': "W aplikacji Notatki otwórz swoją listę i skopiuj cały tekst.\nWklej go tutaj, jeden tytuł w wierszu. Po tytule możesz dodać ocenę (4.5/5, 8/10, ★★★★), status (watched, watching, to watch) i recenzję.\nNastępnie sprawdzasz każdy znaleziony tytuł przed dodaniem.",
|
||||||
|
'import.text.placeholder': "Inception (2010) 4.5/5 loved it\nBreaking Bad ★★★★★\nOne Piece - watching S3E12\nDune to watch",
|
||||||
|
'import.text.default': "Tytuły bez statusu to:",
|
||||||
|
'import.text.seen': "Już obejrzane",
|
||||||
|
'import.text.analyze': "Szukaj tytułów",
|
||||||
|
'import.text.reviewHint': "Sprawdź znalezione tytuły. Odznacz te, których nie chcesz, lub wybierz właściwy tytuł.",
|
||||||
|
'import.text.toCheck': "Do sprawdzenia: {n}",
|
||||||
|
'import.text.none': "Nie znaleziono tytułu",
|
||||||
|
'import.text.check': "Do sprawdzenia",
|
||||||
|
'import.text.change': "Zmień",
|
||||||
|
'import.text.search': "Szukaj",
|
||||||
'import.how': "Jak pobrać eksport",
|
'import.how': "Jak pobrać eksport",
|
||||||
'import.steps.letterboxd': "Na letterboxd.com otwórz Settings → Import & Export → Export your data.\nOtrzymasz plik ZIP: upuść go tutaj bez zmian (albo jego pliki CSV).",
|
'import.steps.letterboxd': "Na letterboxd.com otwórz Settings → Import & Export → Export your data.\nOtrzymasz plik ZIP: upuść go tutaj bez zmian (albo jego pliki CSV).",
|
||||||
'import.steps.tvtime': "W TV Time poproś o kopię swoich danych (Ustawienia → Prywatność lub wsparcie „Request my data”).\nUpuść tutaj ZIP otrzymany e-mailem albo jego pliki CSV.",
|
'import.steps.tvtime': "W TV Time poproś o kopię swoich danych (Ustawienia → Prywatność lub wsparcie „Request my data”).\nUpuść tutaj ZIP otrzymany e-mailem albo jego pliki CSV.",
|
||||||
|
|||||||
@@ -799,6 +799,19 @@ const dict: Translations = {
|
|||||||
'import.src.tvtime': "Séries seguidas e episódios vistos",
|
'import.src.tvtime': "Séries seguidas e episódios vistos",
|
||||||
'import.src.mal': "Lista de animes (exportação XML)",
|
'import.src.mal': "Lista de animes (exportação XML)",
|
||||||
'import.src.anilist': "Lista de animes pública, pelo nome de usuário",
|
'import.src.anilist': "Lista de animes pública, pelo nome de usuário",
|
||||||
|
'import.text.name': "Colar uma lista",
|
||||||
|
'import.src.text': "Do app Notas ou de qualquer texto",
|
||||||
|
'import.steps.text': "No app Notas, abra sua lista e copie todo o texto.\nCole aqui, uma linha por título. Depois do título você pode pôr uma nota (4.5/5, 8/10, ★★★★), um status (watched, watching, to watch) e sua resenha.\nDepois você confere cada título encontrado antes de adicioná-lo.",
|
||||||
|
'import.text.placeholder': "Inception (2010) 4.5/5 loved it\nBreaking Bad ★★★★★\nOne Piece - watching S3E12\nDune to watch",
|
||||||
|
'import.text.default': "Os títulos sem status são:",
|
||||||
|
'import.text.seen': "Já vistos",
|
||||||
|
'import.text.analyze': "Buscar os títulos",
|
||||||
|
'import.text.reviewHint': "Confira os títulos encontrados. Desmarque os que não quer ou escolha o título certo.",
|
||||||
|
'import.text.toCheck': "A conferir: {n}",
|
||||||
|
'import.text.none': "Nenhum título encontrado",
|
||||||
|
'import.text.check': "A conferir",
|
||||||
|
'import.text.change': "Trocar",
|
||||||
|
'import.text.search': "Buscar",
|
||||||
'import.how': "Obter a exportação",
|
'import.how': "Obter a exportação",
|
||||||
'import.steps.letterboxd': "Em letterboxd.com, abra Settings → Import & Export → Export your data.\nVocê recebe um arquivo ZIP: solte-o aqui como está (ou os arquivos CSV dele).",
|
'import.steps.letterboxd': "Em letterboxd.com, abra Settings → Import & Export → Export your data.\nVocê recebe um arquivo ZIP: solte-o aqui como está (ou os arquivos CSV dele).",
|
||||||
'import.steps.tvtime': "No TV Time, peça uma cópia dos seus dados (Configurações → Privacidade, ou suporte “Request my data”).\nSolte aqui o ZIP recebido por e-mail, ou os arquivos CSV dele.",
|
'import.steps.tvtime': "No TV Time, peça uma cópia dos seus dados (Configurações → Privacidade, ou suporte “Request my data”).\nSolte aqui o ZIP recebido por e-mail, ou os arquivos CSV dele.",
|
||||||
|
|||||||
@@ -891,6 +891,19 @@ const dict: Translations = {
|
|||||||
'import.src.tvtime': "Отслеживаемые сериалы и просмотренные серии",
|
'import.src.tvtime': "Отслеживаемые сериалы и просмотренные серии",
|
||||||
'import.src.mal': "Список аниме (экспорт XML)",
|
'import.src.mal': "Список аниме (экспорт XML)",
|
||||||
'import.src.anilist': "Публичный список аниме по имени пользователя",
|
'import.src.anilist': "Публичный список аниме по имени пользователя",
|
||||||
|
'import.text.name': "Вставить список",
|
||||||
|
'import.src.text': "Из приложения «Заметки» или любого текста",
|
||||||
|
'import.steps.text': "Откройте свой список в «Заметках» и скопируйте весь текст.\nВставьте его сюда, по одному названию в строке. После названия можно указать оценку (4.5/5, 8/10, ★★★★), статус (watched, watching, to watch) и отзыв.\nЗатем вы проверяете каждое найденное название перед добавлением.",
|
||||||
|
'import.text.placeholder': "Inception (2010) 4.5/5 loved it\nBreaking Bad ★★★★★\nOne Piece - watching S3E12\nDune to watch",
|
||||||
|
'import.text.default': "Названия без статуса:",
|
||||||
|
'import.text.seen': "Уже просмотрены",
|
||||||
|
'import.text.analyze': "Найти названия",
|
||||||
|
'import.text.reviewHint': "Проверьте найденные названия. Снимите отметку с ненужных или выберите правильное название.",
|
||||||
|
'import.text.toCheck': "Проверить: {n}",
|
||||||
|
'import.text.none': "Ничего не найдено",
|
||||||
|
'import.text.check': "Проверить",
|
||||||
|
'import.text.change': "Изменить",
|
||||||
|
'import.text.search': "Искать",
|
||||||
'import.how': "Как получить экспорт",
|
'import.how': "Как получить экспорт",
|
||||||
'import.steps.letterboxd': "На letterboxd.com открой Settings → Import & Export → Export your data.\nТы получишь ZIP-файл: перетащи его сюда как есть (или его CSV-файлы).",
|
'import.steps.letterboxd': "На letterboxd.com открой Settings → Import & Export → Export your data.\nТы получишь ZIP-файл: перетащи его сюда как есть (или его CSV-файлы).",
|
||||||
'import.steps.tvtime': "В TV Time запроси копию своих данных (Настройки → Конфиденциальность или поддержка «Request my data»).\nПеретащи сюда ZIP из письма или его CSV-файлы.",
|
'import.steps.tvtime': "В TV Time запроси копию своих данных (Настройки → Конфиденциальность или поддержка «Request my data»).\nПеретащи сюда ZIP из письма или его CSV-файлы.",
|
||||||
|
|||||||
@@ -799,6 +799,19 @@ const dict: Translations = {
|
|||||||
'import.src.tvtime': "ซีรีส์ที่ติดตามและตอนที่ดูแล้ว",
|
'import.src.tvtime': "ซีรีส์ที่ติดตามและตอนที่ดูแล้ว",
|
||||||
'import.src.mal': "รายการอนิเมะ (ส่งออก XML)",
|
'import.src.mal': "รายการอนิเมะ (ส่งออก XML)",
|
||||||
'import.src.anilist': "รายการอนิเมะสาธารณะ ด้วยชื่อผู้ใช้",
|
'import.src.anilist': "รายการอนิเมะสาธารณะ ด้วยชื่อผู้ใช้",
|
||||||
|
'import.text.name': "วางรายการ",
|
||||||
|
'import.src.text': "จากแอปโน้ตหรือข้อความใดก็ได้",
|
||||||
|
'import.steps.text': "เปิดรายการของคุณในแอปโน้ตแล้วคัดลอกข้อความทั้งหมด\nวางที่นี่ บรรทัดละหนึ่งเรื่อง หลังชื่อเรื่องใส่คะแนน (4.5/5, 8/10, ★★★★) สถานะ (watched, watching, to watch) และรีวิวได้\nจากนั้นตรวจสอบแต่ละเรื่องที่พบก่อนเพิ่ม",
|
||||||
|
'import.text.placeholder': "Inception (2010) 4.5/5 loved it\nBreaking Bad ★★★★★\nOne Piece - watching S3E12\nDune to watch",
|
||||||
|
'import.text.default': "เรื่องที่ไม่มีสถานะคือ:",
|
||||||
|
'import.text.seen': "ดูแล้ว",
|
||||||
|
'import.text.analyze': "ค้นหาเรื่อง",
|
||||||
|
'import.text.reviewHint': "ตรวจสอบเรื่องที่พบ เอาเครื่องหมายออกจากเรื่องที่ไม่ต้องการ หรือเลือกเรื่องที่ถูกต้อง",
|
||||||
|
'import.text.toCheck': "ต้องตรวจสอบ: {n}",
|
||||||
|
'import.text.none': "ไม่พบเรื่อง",
|
||||||
|
'import.text.check': "ตรวจสอบ",
|
||||||
|
'import.text.change': "เปลี่ยน",
|
||||||
|
'import.text.search': "ค้นหา",
|
||||||
'import.how': "วิธีรับไฟล์ส่งออก",
|
'import.how': "วิธีรับไฟล์ส่งออก",
|
||||||
'import.steps.letterboxd': "บน letterboxd.com เปิด Settings → Import & Export → Export your data\nคุณจะได้ไฟล์ ZIP: วางไว้ที่นี่ได้เลย (หรือไฟล์ CSV ข้างใน)",
|
'import.steps.letterboxd': "บน letterboxd.com เปิด Settings → Import & Export → Export your data\nคุณจะได้ไฟล์ ZIP: วางไว้ที่นี่ได้เลย (หรือไฟล์ CSV ข้างใน)",
|
||||||
'import.steps.tvtime': "ใน TV Time ขอสำเนาข้อมูลของคุณ (การตั้งค่า → ความเป็นส่วนตัว หรือฝ่ายช่วยเหลือ “Request my data”)\nวาง ZIP ที่ได้รับทางอีเมล หรือไฟล์ CSV ข้างในไว้ที่นี่",
|
'import.steps.tvtime': "ใน TV Time ขอสำเนาข้อมูลของคุณ (การตั้งค่า → ความเป็นส่วนตัว หรือฝ่ายช่วยเหลือ “Request my data”)\nวาง ZIP ที่ได้รับทางอีเมล หรือไฟล์ CSV ข้างในไว้ที่นี่",
|
||||||
|
|||||||
@@ -799,6 +799,19 @@ const dict: Translations = {
|
|||||||
'import.src.tvtime': "Takip edilen diziler ve izlenen bölümler",
|
'import.src.tvtime': "Takip edilen diziler ve izlenen bölümler",
|
||||||
'import.src.mal': "Anime listesi (XML dışa aktarımı)",
|
'import.src.mal': "Anime listesi (XML dışa aktarımı)",
|
||||||
'import.src.anilist': "Herkese açık anime listesi, kullanıcı adıyla",
|
'import.src.anilist': "Herkese açık anime listesi, kullanıcı adıyla",
|
||||||
|
'import.text.name': "Liste yapıştır",
|
||||||
|
'import.src.text': "Notlar uygulamasından veya herhangi bir metinden",
|
||||||
|
'import.steps.text': "Notlar uygulamasında listeni aç ve tüm metni kopyala.\nBuraya yapıştır, her satıra bir başlık. Başlıktan sonra puan (4.5/5, 8/10, ★★★★), durum (watched, watching, to watch) ve yorumunu ekleyebilirsin.\nArdından bulunan her başlığı eklemeden önce kontrol edersin.",
|
||||||
|
'import.text.placeholder': "Inception (2010) 4.5/5 loved it\nBreaking Bad ★★★★★\nOne Piece - watching S3E12\nDune to watch",
|
||||||
|
'import.text.default': "Durumu olmayan başlıklar:",
|
||||||
|
'import.text.seen': "Zaten izlendi",
|
||||||
|
'import.text.analyze': "Başlıkları bul",
|
||||||
|
'import.text.reviewHint': "Bulunan başlıkları kontrol et. İstemediklerinin işaretini kaldır veya doğru başlığı seç.",
|
||||||
|
'import.text.toCheck': "Kontrol edilecek: {n}",
|
||||||
|
'import.text.none': "Başlık bulunamadı",
|
||||||
|
'import.text.check': "Kontrol et",
|
||||||
|
'import.text.change': "Değiştir",
|
||||||
|
'import.text.search': "Ara",
|
||||||
'import.how': "Dışa aktarımı alma",
|
'import.how': "Dışa aktarımı alma",
|
||||||
'import.steps.letterboxd': "letterboxd.com'da Settings → Import & Export → Export your data'yı aç.\nBir ZIP dosyası alırsın: olduğu gibi buraya bırak (ya da CSV dosyalarını).",
|
'import.steps.letterboxd': "letterboxd.com'da Settings → Import & Export → Export your data'yı aç.\nBir ZIP dosyası alırsın: olduğu gibi buraya bırak (ya da CSV dosyalarını).",
|
||||||
'import.steps.tvtime': "TV Time’da verilerinin bir kopyasını iste (Ayarlar → Gizlilik ya da destek “Request my data”).\nE-postayla gelen ZIP’i ya da CSV dosyalarını buraya bırak.",
|
'import.steps.tvtime': "TV Time’da verilerinin bir kopyasını iste (Ayarlar → Gizlilik ya da destek “Request my data”).\nE-postayla gelen ZIP’i ya da CSV dosyalarını buraya bırak.",
|
||||||
|
|||||||
@@ -799,6 +799,19 @@ const dict: Translations = {
|
|||||||
'import.src.tvtime': "Phim bộ đang theo dõi và tập đã xem",
|
'import.src.tvtime': "Phim bộ đang theo dõi và tập đã xem",
|
||||||
'import.src.mal': "Danh sách anime (xuất XML)",
|
'import.src.mal': "Danh sách anime (xuất XML)",
|
||||||
'import.src.anilist': "Danh sách anime công khai, theo tên người dùng",
|
'import.src.anilist': "Danh sách anime công khai, theo tên người dùng",
|
||||||
|
'import.text.name': "Dán danh sách",
|
||||||
|
'import.src.text': "Từ ứng dụng Ghi chú hoặc văn bản bất kỳ",
|
||||||
|
'import.steps.text': "Trong ứng dụng Ghi chú, mở danh sách và sao chép toàn bộ văn bản.\nDán vào đây, mỗi dòng một tựa. Sau tựa, bạn có thể thêm điểm (4.5/5, 8/10, ★★★★), trạng thái (watched, watching, to watch) và đánh giá.\nSau đó bạn kiểm tra từng tựa tìm được trước khi thêm.",
|
||||||
|
'import.text.placeholder': "Inception (2010) 4.5/5 loved it\nBreaking Bad ★★★★★\nOne Piece - watching S3E12\nDune to watch",
|
||||||
|
'import.text.default': "Các tựa không có trạng thái là:",
|
||||||
|
'import.text.seen': "Đã xem",
|
||||||
|
'import.text.analyze': "Tìm các tựa",
|
||||||
|
'import.text.reviewHint': "Kiểm tra các tựa tìm được. Bỏ chọn tựa không muốn, hoặc chọn đúng tựa.",
|
||||||
|
'import.text.toCheck': "Cần kiểm tra: {n}",
|
||||||
|
'import.text.none': "Không tìm thấy tựa",
|
||||||
|
'import.text.check': "Cần kiểm tra",
|
||||||
|
'import.text.change': "Đổi",
|
||||||
|
'import.text.search': "Tìm",
|
||||||
'import.how': "Cách lấy tệp xuất",
|
'import.how': "Cách lấy tệp xuất",
|
||||||
'import.steps.letterboxd': "Trên letterboxd.com, mở Settings → Import & Export → Export your data.\nBạn nhận được tệp ZIP: thả nguyên tệp vào đây (hoặc các tệp CSV bên trong).",
|
'import.steps.letterboxd': "Trên letterboxd.com, mở Settings → Import & Export → Export your data.\nBạn nhận được tệp ZIP: thả nguyên tệp vào đây (hoặc các tệp CSV bên trong).",
|
||||||
'import.steps.tvtime': "Trong TV Time, yêu cầu bản sao dữ liệu (Cài đặt → Quyền riêng tư, hoặc hỗ trợ “Request my data”).\nThả tệp ZIP nhận qua email, hoặc các tệp CSV bên trong, vào đây.",
|
'import.steps.tvtime': "Trong TV Time, yêu cầu bản sao dữ liệu (Cài đặt → Quyền riêng tư, hoặc hỗ trợ “Request my data”).\nThả tệp ZIP nhận qua email, hoặc các tệp CSV bên trong, vào đây.",
|
||||||
|
|||||||
@@ -799,6 +799,19 @@ const dict: Translations = {
|
|||||||
'import.src.tvtime': "追的剧和看过的集",
|
'import.src.tvtime': "追的剧和看过的集",
|
||||||
'import.src.mal': "动画列表(XML 导出)",
|
'import.src.mal': "动画列表(XML 导出)",
|
||||||
'import.src.anilist': "公开的动画列表,按用户名",
|
'import.src.anilist': "公开的动画列表,按用户名",
|
||||||
|
'import.text.name': "粘贴列表",
|
||||||
|
'import.src.text': "来自备忘录或任意文本",
|
||||||
|
'import.steps.text': "在备忘录中打开你的列表并复制全部文字。\n粘贴到这里,每行一个标题。标题后可以写评分(4.5/5、8/10、★★★★)、状态(watched、watching、to watch)和你的评价。\n添加前,你会逐一确认找到的标题。",
|
||||||
|
'import.text.placeholder': "Inception (2010) 4.5/5 loved it\nBreaking Bad ★★★★★\nOne Piece - watching S3E12\nDune to watch",
|
||||||
|
'import.text.default': "没有状态的标题视为:",
|
||||||
|
'import.text.seen': "已看过",
|
||||||
|
'import.text.analyze': "查找标题",
|
||||||
|
'import.text.reviewHint': "确认找到的标题。取消勾选不需要的,或选择正确的标题。",
|
||||||
|
'import.text.toCheck': "待确认:{n}",
|
||||||
|
'import.text.none': "未找到标题",
|
||||||
|
'import.text.check': "待确认",
|
||||||
|
'import.text.change': "更换",
|
||||||
|
'import.text.search': "搜索",
|
||||||
'import.how': "获取导出文件",
|
'import.how': "获取导出文件",
|
||||||
'import.steps.letterboxd': "在 letterboxd.com 打开 Settings → Import & Export → Export your data。\n你会得到一个 ZIP 文件:直接拖到这里(或其中的 CSV 文件)。",
|
'import.steps.letterboxd': "在 letterboxd.com 打开 Settings → Import & Export → Export your data。\n你会得到一个 ZIP 文件:直接拖到这里(或其中的 CSV 文件)。",
|
||||||
'import.steps.tvtime': "在 TV Time 中申请数据副本(设置 → 隐私,或客服“Request my data”)。\n把邮件收到的 ZIP 或其中的 CSV 文件拖到这里。",
|
'import.steps.tvtime': "在 TV Time 中申请数据副本(设置 → 隐私,或客服“Request my data”)。\n把邮件收到的 ZIP 或其中的 CSV 文件拖到这里。",
|
||||||
|
|||||||
+106
-1
@@ -1,7 +1,8 @@
|
|||||||
import { t } from '../../i18n'
|
import { t } from '../../i18n'
|
||||||
import { ANILIST, ANILIST_FIELDS, aniToResult, CLOUD_TMDB, getTmdbDetails, sanitizeMeta, tmdbFindExternal, tmdbImportSearch, type AniMedia, type SearchResult } from '../catalogApi'
|
import { ANILIST, ANILIST_FIELDS, aniToResult, CLOUD_TMDB, getTmdbDetails, sanitizeMeta, searchAll, tmdbFindExternal, tmdbImportSearch, type AniMedia, type SearchResult } from '../catalogApi'
|
||||||
import type { MediaInput } from '../../types'
|
import type { MediaInput } from '../../types'
|
||||||
import { anilistEntries, titleKey, type AniListEntry, type ImportEntry } from './sources'
|
import { anilistEntries, titleKey, type AniListEntry, type ImportEntry } from './sources'
|
||||||
|
import type { TextEntry } from './textList'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Recherche des fiches correspondantes (TMDB pour les films et séries, AniList pour les animes).
|
* Recherche des fiches correspondantes (TMDB pour les films et séries, AniList pour les animes).
|
||||||
@@ -390,3 +391,107 @@ export async function resolveEntries(entries: ImportEntry[], opts: ResolveOption
|
|||||||
}).finally(saveCache)
|
}).finally(saveCache)
|
||||||
return found
|
return found
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ─── Liste collée (app Notes…) ───
|
||||||
|
|
||||||
|
const KIND_OK: Record<ImportEntry['kind'], (r: SearchResult) => boolean> = {
|
||||||
|
movie: (r) => r.typeGuess === 'film',
|
||||||
|
// Une section « Séries » contient souvent aussi des animes
|
||||||
|
tv: (r) => r.typeGuess !== 'film',
|
||||||
|
anime: (r) => r.typeGuess === 'anime' || r.source === 'anilist',
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Meilleur résultat pour une ligne de texte. `sure` : même titre (et même année / bon type si connus). */
|
||||||
|
export function pickTextMatch(list: SearchResult[], e: Pick<TextEntry, 'title' | 'year' | 'kind' | 'kindKnown'>): { result?: SearchResult; sure: boolean } {
|
||||||
|
const typed = e.kindKnown ? list.filter(KIND_OK[e.kind]) : list
|
||||||
|
const cands = typed.length ? typed : list
|
||||||
|
const want = titleKey(e.title)
|
||||||
|
const same = (r: SearchResult) => [r.title, r.originalTitle, ...(r.altTitles ?? [])].some((x) => x && titleKey(x) === want)
|
||||||
|
if (e.year) {
|
||||||
|
const sameYear = cands.filter((r) => r.year === e.year)
|
||||||
|
const hit = sameYear.find(same) ?? sameYear[0]
|
||||||
|
if (hit) return { result: hit, sure: true }
|
||||||
|
}
|
||||||
|
const hit = cands.find(same)
|
||||||
|
if (hit) return { result: hit, sure: !e.kindKnown || typed.length > 0 }
|
||||||
|
return { result: cands[0], sure: false }
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Métadonnées d'un résultat choisi : la fiche TMDB complète (référence, année, durée, saisons…). */
|
||||||
|
export async function matchFor(result: SearchResult, key?: string): Promise<Match> {
|
||||||
|
let meta: Partial<MediaInput> = {
|
||||||
|
title: result.title,
|
||||||
|
originalTitle: result.originalTitle,
|
||||||
|
year: result.year,
|
||||||
|
type: result.typeGuess,
|
||||||
|
externalId: result.externalId,
|
||||||
|
...result.prefill,
|
||||||
|
poster: result.posterUrl,
|
||||||
|
}
|
||||||
|
if (key && result.externalId.startsWith('tmdb:')) {
|
||||||
|
const details = await getTmdbDetails(result, key).catch((err) => {
|
||||||
|
if (isRateError(err)) throw err // la recherche attend et réessaie
|
||||||
|
return undefined
|
||||||
|
})
|
||||||
|
if (details) meta = { ...meta, ...details, poster: result.posterUrl ?? meta.poster }
|
||||||
|
}
|
||||||
|
return { result, meta }
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Recherche de chaque ligne (même recherche que l'ajout d'un titre : TMDB puis AniList). */
|
||||||
|
export async function resolveTextEntries(entries: TextEntry[], opts: ResolveOptions): Promise<{ found: Map<string, Match>; unsure: Set<string> }> {
|
||||||
|
const { token } = opts
|
||||||
|
const key = opts.tmdbKey?.trim() || undefined
|
||||||
|
const found = new Map<string, Match>()
|
||||||
|
const unsure = new Set<string>()
|
||||||
|
const progress: Progress = { done: 0, total: entries.length }
|
||||||
|
const emit = () => opts.onProgress({ ...progress })
|
||||||
|
const onWait = (until?: number) => {
|
||||||
|
progress.waitUntil = until
|
||||||
|
emit()
|
||||||
|
}
|
||||||
|
emit()
|
||||||
|
// AniList est interrogé à chaque recherche : ~66 par minute au plus
|
||||||
|
const rate = limiter(4, 900)
|
||||||
|
await pool(entries, 3, token, async (e) => {
|
||||||
|
try {
|
||||||
|
await rate(token)
|
||||||
|
let list = await withRetry(() => searchAll(e.title, key), token, onWait)
|
||||||
|
let pick = pickTextMatch(list, e)
|
||||||
|
// « Déjà vu » : le mot retiré faisait partie du titre
|
||||||
|
if (e.fullTitle && !pick.sure) {
|
||||||
|
await rate(token)
|
||||||
|
const fullList = await withRetry(() => searchAll(e.fullTitle!, key), token, onWait)
|
||||||
|
const full = pickTextMatch(fullList, { ...e, title: e.fullTitle })
|
||||||
|
if (full.sure) {
|
||||||
|
list = fullList
|
||||||
|
pick = full
|
||||||
|
e.title = e.fullTitle
|
||||||
|
e.status = e.fullStatus ?? e.status
|
||||||
|
if (e.status === 'a_voir') e.rating = undefined
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!pick.result) return
|
||||||
|
found.set(e.key, await withRetry(() => matchFor(pick.result!, key), token, onWait))
|
||||||
|
if (!pick.sure) unsure.add(e.key)
|
||||||
|
} catch (err) {
|
||||||
|
if (err instanceof CancelledError) throw err
|
||||||
|
if (!navigator.onLine) throw new Error(t('search.offline'))
|
||||||
|
} finally {
|
||||||
|
progress.done++
|
||||||
|
emit()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
return { found, unsure }
|
||||||
|
}
|
||||||
|
|
||||||
|
/** « S3E12 » → épisodes vus, une fois les saisons connues. */
|
||||||
|
export function withProgress(e: TextEntry, match?: Match): TextEntry {
|
||||||
|
if (!e.progress) return e
|
||||||
|
const seasons = match?.meta.seasons
|
||||||
|
const { season, episode } = e.progress
|
||||||
|
let watched: number | undefined
|
||||||
|
if (seasons?.length) watched = seasons.slice(0, season - 1).reduce((a, b) => a + b, 0) + episode
|
||||||
|
else if (season === 1) watched = episode
|
||||||
|
return watched ? { ...e, episodesWatched: Math.min(100000, watched) } : e
|
||||||
|
}
|
||||||
@@ -8,7 +8,7 @@ import { parseCsv, pick, type CsvRow, type TextFile } from './files'
|
|||||||
* vers un format commun, avant la recherche des fiches correspondantes.
|
* vers un format commun, avant la recherche des fiches correspondantes.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
export type ImportSource = 'letterboxd' | 'tvtime' | 'mal' | 'anilist'
|
export type ImportSource = 'text' | 'letterboxd' | 'tvtime' | 'mal' | 'anilist'
|
||||||
export type EntryKind = 'movie' | 'tv' | 'anime'
|
export type EntryKind = 'movie' | 'tv' | 'anime'
|
||||||
|
|
||||||
export interface ImportEntry {
|
export interface ImportEntry {
|
||||||
|
|||||||
@@ -0,0 +1,233 @@
|
|||||||
|
import type { WatchStatus } from '../../types'
|
||||||
|
import { cleanText, LIMITS } from '../security'
|
||||||
|
import { titleKey, type EntryKind, type ImportEntry } from './sources'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Liste collée depuis l'app Notes (ou n'importe quel texte) : une ligne par titre.
|
||||||
|
* « Inception (2010) 4,5/5 trop bien » « Breaking Bad ★★★★★ » « One Piece - en cours S3E12 »
|
||||||
|
* « - [x] Dune 2 : 8/10 » « Films à voir : » (titre de section, s'applique aux lignes suivantes)
|
||||||
|
* Ce qui suit le titre peut contenir une note, une année, un statut, une progression et un avis (le reste du texte).
|
||||||
|
*/
|
||||||
|
|
||||||
|
export const TEXT_MAX_LINES = 500
|
||||||
|
export const TEXT_MAX_CHARS = 100_000
|
||||||
|
|
||||||
|
/** Texte sans accents, en minuscules (pour reconnaître les mots-clés). */
|
||||||
|
const plain = (s: string) => s.normalize('NFD').replace(/[̀-ͯ]/g, '').toLowerCase()
|
||||||
|
|
||||||
|
// ─── Titres de section (« Films », « Séries à voir », « Animes vus :») ───
|
||||||
|
|
||||||
|
const HEAD_KIND: [RegExp, EntryKind][] = [
|
||||||
|
[/\b(films?|movies?|cinema)\b/, 'movie'],
|
||||||
|
[/\b(series?|shows?|tv shows?|tv|k-?dramas?|c-?dramas?|dramas?)\b/, 'tv'],
|
||||||
|
[/\b(animes?|animations? japonaises?|mangas?)\b/, 'anime'],
|
||||||
|
]
|
||||||
|
const HEAD_STATUS: [RegExp, WatchStatus][] = [
|
||||||
|
[/\b(a voir|a regarder|a mater|to watch|watchlist|plan to watch|envies?|wishlist)\b/, 'a_voir'],
|
||||||
|
[/\b(en cours|watching|currently watching)\b/, 'en_cours'],
|
||||||
|
[/\b(deja vus?|vus?|vues|termines?|terminees?|finis?|finies|watched|seen|completed|done)\b/, 'termine'],
|
||||||
|
[/\b(en pause|on hold|paused)\b/, 'pause'],
|
||||||
|
[/\b(abandonnes?|abandonnees?|dropped)\b/, 'abandonne'],
|
||||||
|
]
|
||||||
|
const HEAD_FILLER = /\b(mes|my|les|the|a|et|and|de|des|du|to|ma|liste|list|que|j'ai|i|ve|have|pour|plus|tard|later)\b/g
|
||||||
|
|
||||||
|
function heading(line: string, colon: boolean): { kind?: EntryKind; status?: WatchStatus } | undefined {
|
||||||
|
const whole = plain(line).replace(/[^\p{L}\p{N}' -]+/gu, ' ').replace(/\s+/g, ' ').trim()
|
||||||
|
let s = plain(line).replace(/[^\p{L}\p{N}' -]+/gu, ' ').replace(/\s+/g, ' ').trim()
|
||||||
|
if (!s || s.length > 40) return undefined
|
||||||
|
let kind: EntryKind | undefined
|
||||||
|
let status: WatchStatus | undefined
|
||||||
|
for (const [re, k] of HEAD_KIND) if (re.test(s)) ((kind ??= k), (s = s.replace(re, ' ')))
|
||||||
|
for (const [re, st] of HEAD_STATUS) if (re.test(s)) ((status ??= st), (s = s.replace(re, ' ')))
|
||||||
|
if (!kind && !status) return undefined
|
||||||
|
// Statut seul (« Déjà vu » est aussi un film) : avec « : » ou sous une forme typique de liste
|
||||||
|
if (!kind && !colon && !/^(?:mes |my )?(a voir|a regarder|to watch|watchlist|en cours|vus|deja vus|termines|finis|watched|seen)$/.test(whole)) return undefined
|
||||||
|
// Tout le reste doit être du remplissage (« Mes films à voir plus tard ») : sinon c'est un titre (« Drive », « Vu du ciel »)
|
||||||
|
return s.replace(HEAD_FILLER, ' ').replace(/[' -]/g, '').trim() ? undefined : { kind, status }
|
||||||
|
}
|
||||||
|
|
||||||
|
// ─── Morceaux reconnus après le titre ───
|
||||||
|
|
||||||
|
const STATUS_WORDS: [RegExp, WatchStatus][] = [
|
||||||
|
[/\b(a voir|a regarder|a mater|to watch|plan to watch|watchlist|pas vu|pas encore vu|not seen)\b/, 'a_voir'],
|
||||||
|
[/\b(en cours|encours|commence|commencee|watching|ongoing)\b/, 'en_cours'],
|
||||||
|
[/\b(en pause|pause|on hold)\b/, 'pause'],
|
||||||
|
[/\b(abandonnee?s?|lache|lachee|drop|dropped|arrete|arretee)\b/, 'abandonne'],
|
||||||
|
[/\b(deja vus?|vus?|vues?|fini|finie|termine|terminee|watched|seen|done|finished|completed)\b/, 'termine'],
|
||||||
|
]
|
||||||
|
|
||||||
|
/** Note trouvée dans le texte → sur 10 (pas d'un demi-point d'étoile). */
|
||||||
|
function findRating(s: string): { rating: number; index: number; length: number } | undefined {
|
||||||
|
const toTen = (v: number) => Math.min(10, Math.max(1, Math.round(v)))
|
||||||
|
// 4,5/5 · 8/10 · 16/20 · 85/100
|
||||||
|
let m = /(\d{1,3}(?:[.,]\d{1,2})?)\s*\/\s*(5|10|20|100)\b/.exec(s)
|
||||||
|
if (m) {
|
||||||
|
const v = Number(m[1].replace(',', '.'))
|
||||||
|
const den = Number(m[2])
|
||||||
|
if (v > 0 && v <= den) return { rating: toTen((v / den) * 10), index: m.index, length: m[0].length }
|
||||||
|
}
|
||||||
|
// ★★★★½ · ⭐⭐⭐ · 🌟🌟
|
||||||
|
m = /(?:[★⭐🌟]️?){1,5}\s*(½|,5|\.5)?/u.exec(s)
|
||||||
|
if (m) {
|
||||||
|
const stars = (m[0].match(/[★⭐🌟]/gu) ?? []).length
|
||||||
|
return { rating: toTen(stars * 2 + (m[1] ? 1 : 0)), index: m.index, length: m[0].length }
|
||||||
|
}
|
||||||
|
// 4,5 étoiles · 4 stars · 3.5★ · 4*
|
||||||
|
m = /(\d(?:[.,]5)?)\s*(?:etoiles?|étoiles?|stars?|\*|☆)/iu.exec(s)
|
||||||
|
if (m) {
|
||||||
|
const v = Number(m[1].replace(',', '.'))
|
||||||
|
if (v > 0 && v <= 5) return { rating: toTen(v * 2), index: m.index, length: m[0].length }
|
||||||
|
}
|
||||||
|
return undefined
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface TextOptions {
|
||||||
|
/** Statut des lignes qui n'en donnent aucun (ni note, ni avis, ni section) */
|
||||||
|
defaultStatus: 'termine' | 'a_voir'
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface TextEntry extends ImportEntry {
|
||||||
|
/** Ligne d'origine, affichée à la vérification */
|
||||||
|
line: string
|
||||||
|
/** Type donné par une section (« Films : ») : sinon on cherche partout */
|
||||||
|
kindKnown: boolean
|
||||||
|
/** Progression « S2E5 » (convertie en épisodes vus une fois les saisons connues) */
|
||||||
|
progress?: { season: number; episode: number }
|
||||||
|
/** « Déjà vu », « Ni vu ni connu » : le mot de statut fait peut-être partie du titre. Titre complet et statut à reprendre dans ce cas. */
|
||||||
|
fullTitle?: string
|
||||||
|
fullStatus?: WatchStatus
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Puces, cases à cocher et numéros en début de ligne. */
|
||||||
|
const BULLET = /^\s*(?:[-*•◦▪▫‣⁃·–—>]+|\d{1,4}\s*[.)-]|\[[ xX✓✔]?\]|[☐☑☒✅✔✓❌🔲🔳]️?)\s*/u
|
||||||
|
const DONE_MARK = /^\s*(?:[-*•]\s*)?(?:\[[xX✓✔]\]|[☑☒✅✔✓]️?)/u
|
||||||
|
const TODO_MARK = /^\s*(?:[-*•]\s*)?(?:\[ ?\]|[☐🔲🔳])/u
|
||||||
|
|
||||||
|
function parseLine(raw: string, ctx: { kind?: EntryKind; status?: WatchStatus }, opts: TextOptions, n: number): TextEntry | undefined {
|
||||||
|
let s = raw.replace(/\s+/g, ' ').trim()
|
||||||
|
const checked = DONE_MARK.test(s) ? 'termine' : TODO_MARK.test(s) ? 'a_voir' : undefined
|
||||||
|
for (let i = 0; i < 3 && BULLET.test(s); i++) s = s.replace(BULLET, '')
|
||||||
|
if (!s) return undefined
|
||||||
|
|
||||||
|
// Coupure entre le titre et la suite : séparateur entouré d'espaces, note, année entre parenthèses, épisode
|
||||||
|
const cuts: number[] = []
|
||||||
|
const sep = /\s[-–—|:=>]+\s|\s?\|\s?|\s→\s/.exec(s)
|
||||||
|
if (sep) cuts.push(sep.index)
|
||||||
|
const rating = findRating(s)
|
||||||
|
if (rating) cuts.push(rating.index)
|
||||||
|
const yearParen = /[([](\d{4})[)\]]/.exec(s)
|
||||||
|
if (yearParen) cuts.push(yearParen.index)
|
||||||
|
const ep = /\b(?:s|saison|season)\s?(\d{1,3})\s?(?:e|ep|épisode|episode|x)\s?(\d{1,4})\b/i.exec(s) ?? /\b(\d{1,2})x(\d{1,4})\b/.exec(s)
|
||||||
|
if (ep) cuts.push(ep.index)
|
||||||
|
const cut = Math.min(s.length, ...cuts.filter((i) => i > 0))
|
||||||
|
let title = s.slice(0, cut)
|
||||||
|
let rest = s.slice(cut)
|
||||||
|
|
||||||
|
// Statut collé à la fin du titre sans séparateur : « Inception vu », « Dune à voir »
|
||||||
|
let status: WatchStatus | undefined
|
||||||
|
let fullTitle: string | undefined
|
||||||
|
const titlePlain = plain(title)
|
||||||
|
for (const [re, st] of STATUS_WORDS) {
|
||||||
|
const end = new RegExp(`\\s(?:${re.source.slice(2, -2)})\\s*$`)
|
||||||
|
const m = end.exec(titlePlain)
|
||||||
|
if (m && m.index > 0) {
|
||||||
|
status = st
|
||||||
|
fullTitle = title
|
||||||
|
title = title.slice(0, m.index)
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
title = cleanText(title.replace(/^[^\p{L}\p{N}"'«“(]+|[\s,;:.!?\-–—]+$/gu, '').replace(/^["'«“]\s*|\s*["'»”]$/g, ''), LIMITS.title) ?? ''
|
||||||
|
if (!title || title.length < 1 || !/[\p{L}\p{N}]/u.test(title)) return undefined
|
||||||
|
|
||||||
|
// Ce qui suit : on retire la note, l'année, l'épisode, le statut ; le reste est l'avis
|
||||||
|
let year: number | undefined
|
||||||
|
if (rating) rest = rest.replace(s.slice(rating.index, rating.index + rating.length), ' ')
|
||||||
|
if (yearParen) {
|
||||||
|
const y = Number(yearParen[1])
|
||||||
|
if (y >= 1870 && y <= 2200) year = y
|
||||||
|
rest = rest.replace(yearParen[0], ' ')
|
||||||
|
} else {
|
||||||
|
const m = /^\s*[-–—|:,]?\s*(\d{4})\b/.exec(rest)
|
||||||
|
const y = m ? Number(m[1]) : NaN
|
||||||
|
if (y >= 1870 && y <= 2200) {
|
||||||
|
year = y
|
||||||
|
rest = rest.replace(m![0], ' ')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
let progress: TextEntry['progress']
|
||||||
|
if (ep) {
|
||||||
|
const season = Number(ep[1])
|
||||||
|
const episode = Number(ep[2])
|
||||||
|
if (season >= 1 && episode >= 1) progress = { season, episode }
|
||||||
|
rest = rest.replace(ep[0], ' ')
|
||||||
|
}
|
||||||
|
const restPlain = plain(rest)
|
||||||
|
if (!status) {
|
||||||
|
for (const [re, st] of STATUS_WORDS) {
|
||||||
|
const m = re.exec(restPlain)
|
||||||
|
// Seulement un statut posé seul (« - vu », « : en cours »), pas un mot au milieu de l'avis
|
||||||
|
if (m && /^[\s\-–—|:,.()[\]!]*$/.test(restPlain.slice(0, m.index))) {
|
||||||
|
status = st
|
||||||
|
rest = rest.slice(0, m.index) + rest.slice(m.index + m[0].length)
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const notes = cleanText(rest.replace(/^[\s\-–—|:,;.=>→()[\]]+|[\s\-–—|:,;=>→([]+$/g, '').replace(/\s+/g, ' '), LIMITS.notes)
|
||||||
|
const review = notes && /[\p{L}]{2}/u.test(notes) ? notes : undefined
|
||||||
|
|
||||||
|
const pickStatus = (st?: WatchStatus): WatchStatus =>
|
||||||
|
st ?? checked ?? (progress ? 'en_cours' : rating || review ? 'termine' : (ctx.status ?? opts.defaultStatus))
|
||||||
|
const finalStatus = pickStatus(status)
|
||||||
|
const clean = (v: string) => cleanText(v.replace(/^[^\p{L}\p{N}"'«“(]+|[\s,;:.!?\-–—]+$/gu, ''), LIMITS.title)
|
||||||
|
return {
|
||||||
|
key: `txt:${n}:${titleKey(title)}`,
|
||||||
|
line: s.slice(0, 300),
|
||||||
|
kind: ctx.kind ?? (progress ? 'tv' : 'movie'),
|
||||||
|
kindKnown: !!ctx.kind,
|
||||||
|
title,
|
||||||
|
year,
|
||||||
|
status: finalStatus,
|
||||||
|
rating: finalStatus === 'a_voir' ? undefined : rating?.rating,
|
||||||
|
notes: review,
|
||||||
|
progress,
|
||||||
|
fullTitle: fullTitle ? clean(fullTitle) : undefined,
|
||||||
|
fullStatus: fullTitle ? pickStatus(undefined) : undefined,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Lit le texte collé : une entrée par titre (les doublons exacts sont fusionnés). */
|
||||||
|
export function parseTextList(text: string, opts: TextOptions): TextEntry[] {
|
||||||
|
const lines = text.slice(0, TEXT_MAX_CHARS).split(/\r?\n/)
|
||||||
|
const ctx: { kind?: EntryKind; status?: WatchStatus } = {}
|
||||||
|
const out = new Map<string, TextEntry>()
|
||||||
|
let n = 0
|
||||||
|
for (const raw of lines) {
|
||||||
|
if (out.size >= TEXT_MAX_LINES) break
|
||||||
|
const line = raw.trim()
|
||||||
|
if (!line) continue
|
||||||
|
const head = heading(line.replace(/:\s*$/, ''), /:\s*$/.test(line))
|
||||||
|
if (head) {
|
||||||
|
// Nouvelle section : « Films » remet le statut à zéro, « À voir » garde le type en cours
|
||||||
|
if (head.kind) {
|
||||||
|
ctx.kind = head.kind
|
||||||
|
ctx.status = head.status
|
||||||
|
} else ctx.status = head.status
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
const e = parseLine(line, ctx, opts, n++)
|
||||||
|
if (!e) continue
|
||||||
|
const dup = `${e.kind}|${titleKey(e.title)}|${e.year ?? ''}`
|
||||||
|
const prev = out.get(dup)
|
||||||
|
if (prev) {
|
||||||
|
// Même titre deux fois : on garde ce qui est le plus renseigné
|
||||||
|
prev.rating ??= e.rating
|
||||||
|
prev.notes ??= e.notes
|
||||||
|
if (prev.status === 'a_voir') prev.status = e.status
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
out.set(dup, e)
|
||||||
|
}
|
||||||
|
return [...out.values()]
|
||||||
|
}
|
||||||
Reference in new issue
Block a user