wip: Fix scanner's create requests

This commit is contained in:
Zoe Roux 2025-05-23 12:20:47 +02:00
parent 585f7d2740
commit 0f4f22d6af
No known key found for this signature in database
6 changed files with 30135 additions and 9 deletions

30125
jojo.json Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,5 @@
import logging
from asyncio import CancelledError, TaskGroup, create_task, sleep
from asyncio import CancelledError, TaskGroup, create_task
from contextlib import asynccontextmanager
from fastapi import FastAPI

View File

@ -58,19 +58,19 @@ class KyooClient(metaclass=Singleton):
r.raise_for_status()
async def create_movie(self, movie: Movie) -> Resource:
logger.debug("sending movie %s", movie.model_dump_json())
logger.debug("sending movie %s", movie.model_dump_json(by_alias=True))
async with self._client.post(
"movies",
json=movie.model_dump_json(),
json=movie.model_dump_json(by_alias=True),
) as r:
r.raise_for_status()
return Resource(**await r.json())
async def create_serie(self, serie: Serie) -> Resource:
logger.debug("sending serie %s", serie.model_dump_json())
logger.debug("sending serie %s", serie.model_dump_json(by_alias=True))
async with self._client.post(
"series",
json=serie.model_dump_json(),
json=serie.model_dump_json(by_alias=True),
) as r:
r.raise_for_status()
return Resource(**await r.json())

View File

@ -104,7 +104,7 @@ class FsScanner:
async def _register(self, videos: list[str] | set[str]):
# TODO: we should probably chunk those
vids: list[Video] = []
for path in videos:
for path in list(videos)[:1]:
try:
vid = await identify(path)
vid = self._match(vid)

View File

@ -685,8 +685,8 @@ class TheMovieDatabase(Provider):
),
staff=Person(
slug=to_slug(person["name"]),
name=person["name"],
latin_name=person["original_name"],
name=person["original_name"],
latin_name=person["name"],
image=self._map_image(person["profile_path"]),
external_id={
self.name: MetadataId(

View File

@ -8,10 +8,11 @@ from pydantic import BaseModel, ConfigDict, GetJsonSchemaHandler
from pydantic.alias_generators import to_camel
from pydantic.json_schema import JsonSchemaValue
from pydantic_core import core_schema
from slugify import slugify
def to_slug(title: str) -> str:
return title
return slugify(title)
def clean(val: str) -> str | None: