modify metadataproviders to support movies

This commit is contained in:
maxDorninger
2025-06-22 20:59:58 +02:00
parent 6784a800cf
commit 5a8d3b1ef9
4 changed files with 225 additions and 16 deletions

View File

@@ -1,18 +1,22 @@
from uuid import UUID
from PIL import Image
import requests
import pillow_avif
pillow_avif
def get_year_from_first_air_date(first_air_date: str | None) -> int | None:
def get_year_from_date(first_air_date: str | None) -> int | None:
if first_air_date:
return int(first_air_date.split("-")[0])
else:
return None
def download_poster_image(storage_path=None, poster_url=None, show=None) -> bool:
def download_poster_image(storage_path=None, poster_url=None, id: UUID=None) -> bool:
res = requests.get(poster_url, stream=True)
if res.status_code == 200:
image_file_path = storage_path.joinpath(str(show.id))
image_file_path = storage_path.joinpath(str(id))
with open(str(image_file_path) + ".jpg", "wb") as f:
f.write(res.content)