Initial commit
Some checks failed
Docker / docker (push) Failing after 26s

Interface web pour noter rapidement les films non notés sur Trakt.
Enrichissement TMDB (titres/résumés FR), notation 1-10 en un clic,
bouton passer, filtres, tri, pagination.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
dev
2026-03-04 13:33:58 +00:00
commit 26808fc2b0
13 changed files with 1327 additions and 0 deletions

34
trakt.py Normal file
View File

@@ -0,0 +1,34 @@
import asyncio
import httpx
class TraktClient:
BASE_URL = "https://api.trakt.tv"
def __init__(self, client_id: str, access_token: str):
self.headers = {
"Content-Type": "application/json",
"trakt-api-version": "2",
"trakt-api-key": client_id,
"Authorization": f"Bearer {access_token}",
}
async def get_watched_and_ratings(self):
async with httpx.AsyncClient(timeout=60) as client:
watched_r, ratings_r = await asyncio.gather(
client.get(f"{self.BASE_URL}/sync/watched/movies", headers=self.headers),
client.get(f"{self.BASE_URL}/sync/ratings/movies", headers=self.headers),
)
watched_r.raise_for_status()
ratings_r.raise_for_status()
return watched_r.json(), ratings_r.json()
async def rate_movie(self, trakt_id: int, rating: int):
async with httpx.AsyncClient(timeout=30) as client:
r = await client.post(
f"{self.BASE_URL}/sync/ratings",
headers=self.headers,
json={"movies": [{"rating": rating, "ids": {"trakt": trakt_id}}]},
)
r.raise_for_status()
return r.json()