impoort stuff!

This commit is contained in:
Lars Behrends
2025-10-24 16:04:34 +02:00
parent 73d8441787
commit 218d0c28c0
17 changed files with 3043 additions and 277 deletions

View File

@@ -1,179 +1,348 @@
{% extends "layouts/app.twig" %}
{% block content %}
<div class="px-4 py-6 sm:px-0">
<div class="container-fluid px-4 py-3">
<!-- Back button -->
<div class="mb-6">
<a href="{{ path_for('movies.index') }}" class="inline-flex items-center text-sm text-indigo-600 hover:text-indigo-800">
<svg class="w-4 h-4 mr-2" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<div class="mb-4">
<a href="{{ path_for('movies.index') }}" class="btn btn-link text-decoration-none p-0">
<svg class="me-2" width="16" height="16" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 19l-7-7 7-7"/>
</svg>
Back to Movies
</a>
</div>
<div class="bg-white shadow rounded-lg overflow-hidden">
<div class="md:flex">
<div class="card shadow-sm">
<div class="row g-0">
<!-- Movie poster -->
<div class="md:w-1/3 p-6">
<div class="aspect-[2/3] bg-gray-200 rounded-lg overflow-hidden">
{% if movie.poster_url %}
<img src="{{ movie.poster_url }}" alt="{{ movie.title }}" class="w-full h-full object-cover">
{% else %}
<div class="w-full h-full flex items-center justify-center bg-gray-100">
<svg class="h-24 w-24 text-gray-400" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 4V2a1 1 0 011-1h8a1 1 0 011 1v2h4a1 1 0 010 2h-1v14a2 2 0 01-2 2H6a2 2 0 01-2-2V6H3a1 1 0 010-2h4z"/>
</svg>
<div class="col-md-4">
<div class="card-body p-4">
<div class="ratio ratio-2x3">
{% if movie.poster_url %}
<img src="/images/{{ movie.poster_url }}" alt="{{ movie.title }}" class="img-fluid rounded">
{% else %}
<div class="w-100 h-100 d-flex align-items-center justify-content-center bg-light rounded">
<svg class="text-muted" width="96" height="96" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 4V2a1 1 0 011-1h8a1 1 0 011 1v2h4a1 1 0 010 2h-1v14a2 2 0 01-2 2H6a2 2 0 01-2-2V6H3a1 1 0 010-2h4z"/>
</svg>
</div>
{% endif %}
</div>
<!-- Action buttons -->
<div class="mt-4 d-grid gap-2">
<button class="btn btn-primary">
<svg class="me-2" width="16" height="16" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M14.828 14.828a4 4 0 01-5.656 0M9 10h1m4 0h1m-6 8a9 9 0 110-18 9 9 0 010 18z"/>
</svg>
Mark as Watched
</button>
<button class="btn btn-outline-danger">
<svg class="me-2" width="16" height="16" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4.318 6.318a4.5 4.5 0 000 6.364L12 20.364l7.682-7.682a4.5 4.5 0 00-6.364-6.364L12 7.636l-1.318-1.318a4.5 4.5 0 00-6.364 0z"/>
</svg>
Add to Favorites
</button>
</div>
{% endif %}
</div>
</div>
<!-- Movie details -->
<div class="md:w-2/3 p-6">
<div class="mb-6">
<h1 class="text-3xl font-bold text-gray-900 mb-2">{{ movie.title }}</h1>
<!-- Movie metadata -->
<div class="flex flex-wrap gap-4 text-sm text-gray-600 mb-4">
{% if movie.release_date %}
<span class="flex items-center">
<svg class="w-4 h-4 mr-1" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z"/>
</svg>
{{ movie.release_date|date('Y') }}
</span>
<div class="col-md-8">
<div class="card-body p-4">
<div class="mb-4">
<h1 class="display-4 fw-bold text-dark mb-2">{{ movie.title }}</h1>
{% if movie.tagline %}
<p class="lead text-muted mb-3">{{ movie.tagline }}</p>
{% endif %}
{% if movie.rating %}
<span class="flex items-center">
<svg class="w-4 h-4 mr-1" fill="currentColor" viewBox="0 0 20 20">
<path d="M9.049 2.927c.3-.921 1.603-.921 1.902 0l1.07 3.292a1 1 0 00.95.69h3.462c.969 0 1.371 1.24.588 1.81l-2.8 2.034a1 1 0 00-.364 1.118l1.07 3.292c.3.921-.755 1.688-1.54 1.118l-2.8-2.034a1 1 0 00-1.175 0l-2.8 2.034c-.784.57-1.838-.197-1.539-1.118l1.07-3.292a1 1 0 00-.364-1.118L2.98 8.72c-.783-.57-.38-1.81.588-1.81h3.461a1 1 0 00.951-.69l1.07-3.292z"/>
</svg>
{{ movie.rating }}/10
</span>
{% endif %}
{% if movie.runtime_minutes %}
<span class="flex items-center">
<svg class="w-4 h-4 mr-1" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"/>
</svg>
{{ (movie.runtime_minutes / 60)|round(1) }}h {{ movie.runtime_minutes % 60 }}m
</span>
{% endif %}
<span class="flex items-center">
<svg class="w-4 h-4 mr-1" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M17 20h5v-2a3 3 0 00-5.356-1.857M17 20H7m10 0v-2c0-.656-.126-1.283-.356-1.857M7 20H2v-2a3 3 0 015.356-1.857M7 20v-2c0-.656.126-1.283.356-1.857m0 0a5.002 5.002 0 019.288 0M15 7a3 3 0 11-6 0 3 3 0 016 0zm6 3a2 2 0 11-4 0 2 2 0 014 0zM7 10a2 2 0 11-4 0 2 2 0 014 0z"/>
</svg>
{{ movie.source_name }}
</span>
</div>
<!-- Status badges -->
<div class="flex flex-wrap gap-2">
{% if movie.watched %}
<span class="inline-flex items-center px-3 py-1 rounded-full text-sm font-medium bg-green-100 text-green-800">
<svg class="w-4 h-4 mr-1" fill="currentColor" viewBox="0 0 20 20">
<path fill-rule="evenodd" d="M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z" clip-rule="evenodd"/>
</svg>
Watched
</span>
{% endif %}
{% if movie.watch_count > 0 %}
<span class="inline-flex items-center px-3 py-1 rounded-full text-sm font-medium bg-blue-100 text-blue-800">
{{ movie.watch_count }} watch{{ movie.watch_count > 1 ? 'es' : '' }}
</span>
{% endif %}
{% if movie.is_favorite %}
<span class="inline-flex items-center px-3 py-1 rounded-full text-sm font-medium bg-red-100 text-red-800">
<svg class="w-4 h-4 mr-1" fill="currentColor" viewBox="0 0 20 20">
<path d="M3.172 5.172a4 4 0 015.656 0L10 6.343l1.172-1.171a4 4 0 115.656 5.656L10 17.657l-6.828-6.829a4 4 0 010-5.656z"/>
</svg>
Favorite
</span>
{% endif %}
</div>
</div>
<!-- Overview -->
{% if movie.overview %}
<div class="mb-6">
<h2 class="text-lg font-semibold text-gray-900 mb-2">Overview</h2>
<p class="text-gray-700 leading-relaxed">{{ movie.overview }}</p>
</div>
{% endif %}
<!-- Additional details -->
<div class="grid grid-cols-1 md:grid-cols-2 gap-6">
<!-- Cast & Crew -->
{% if movie.cast or movie.director or movie.writer %}
<div>
<h3 class="text-md font-semibold text-gray-900 mb-3">Cast & Crew</h3>
<dl class="space-y-2">
{% if movie.director %}
<div>
<dt class="text-sm font-medium text-gray-500">Director</dt>
<dd class="text-sm text-gray-900">{{ movie.director }}</dd>
</div>
<!-- Movie metadata -->
<div class="d-flex flex-wrap gap-3 small text-muted mb-3">
{% if movie.release_date %}
<span class="d-flex align-items-center">
<svg class="me-1" width="16" height="16" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z"/>
</svg>
{{ movie.release_date|date('Y') }}
</span>
{% endif %}
{% if movie.writer %}
<div>
<dt class="text-sm font-medium text-gray-500">Writer</dt>
<dd class="text-sm text-gray-900">{{ movie.writer }}</dd>
</div>
{% endif %}
{% if movie.cast %}
<div>
<dt class="text-sm font-medium text-gray-500">Cast</dt>
<dd class="text-sm text-gray-900">{{ movie.cast }}</dd>
</div>
{% endif %}
</dl>
</div>
{% endif %}
<!-- Genres & Studios -->
{% if movie.genre or metadata.studios %}
<div>
<h3 class="text-md font-semibold text-gray-900 mb-3">Details</h3>
<dl class="space-y-2">
{% if movie.genre %}
<div>
<dt class="text-sm font-medium text-gray-500">Genre</dt>
<dd class="text-sm text-gray-900">{{ movie.genre }}</dd>
</div>
{% if movie.rating %}
<span class="d-flex align-items-center">
<svg class="me-1" width="16" height="16" fill="currentColor" viewBox="0 0 20 20">
<path d="M9.049 2.927c.3-.921 1.603-.921 1.902 0l1.07 3.292a1 1 0 00.95.69h3.462c.969 0 1.371 1.24.588 1.81l-2.8 2.034a1 1 0 00-.364 1.118l1.07 3.292c.3.921-.755 1.688-1.54 1.118l-2.8-2.034a1 1 0 00-1.175 0l-2.8 2.034c-.784.57-1.838-.197-1.539-1.118l1.07-3.292a1 1 0 00-.364-1.118L2.98 8.72c-.783-.57-.38-1.81.588-1.81h3.461a1 1 0 00.951-.69l1.07-3.292z"/>
</svg>
{{ movie.rating }}/10
</span>
{% endif %}
{% if metadata.studios %}
<div>
<dt class="text-sm font-medium text-gray-500">Studio</dt>
<dd class="text-sm text-gray-900">{{ metadata.studios|join(', ') }}</dd>
</div>
{% endif %}
</dl>
</div>
{% endif %}
</div>
<!-- Metadata (for debugging/advanced users) -->
{% if metadata %}
<div class="mt-6 pt-6 border-t border-gray-200">
<details class="group">
<summary class="cursor-pointer text-sm font-medium text-gray-700 hover:text-gray-900 flex items-center">
<svg class="w-4 h-4 mr-2 group-open:rotate-90 transition-transform" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5l7 7-7 7"/>
</svg>
Technical Details
</summary>
<div class="mt-4 text-sm">
<pre class="bg-gray-50 p-4 rounded-lg overflow-x-auto">{{ metadata|json_encode(constant('JSON_PRETTY_PRINT')) }}</pre>
{% if movie.runtime_minutes %}
<span class="d-flex align-items-center">
<svg class="me-1" width="16" height="16" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"/>
</svg>
{{ (movie.runtime_minutes / 60)|round(1) }}h {{ movie.runtime_minutes % 60 }}m
</span>
{% endif %}
{% if movie.vote_count %}
<span class="d-flex align-items-center">
<svg class="me-1" width="16" height="16" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M17 20h5v-2a3 3 0 00-5.356-1.857M17 20H7m10 0v-2c0-.656-.126-1.283-.356-1.857M7 20H2v-2a3 3 0 015.356-1.857M7 20v-2c0-.656.126-1.283.356-1.857m0 0a5.002 5.002 0 019.288 0M15 7a3 3 0 11-6 0 3 3 0 016 0zm6 3a2 2 0 11-4 0 2 2 0 014 0zM7 10a2 2 0 11-4 0 2 2 0 014 0z"/>
</svg>
{{ movie.vote_count }} votes
</span>
{% endif %}
<span class="d-flex align-items-center">
<svg class="me-1" width="16" height="16" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M17 20h5v-2a3 3 0 00-5.356-1.857M17 20H7m10 0v-2c0-.656-.126-1.283-.356-1.857M7 20H2v-2a3 3 0 015.356-1.857M7 20v-2c0-.656.126-1.283.356-1.857m0 0a5.002 5.002 0 019.288 0M15 7a3 3 0 11-6 0 3 3 0 016 0zm6 3a2 2 0 11-4 0 2 2 0 014 0zM7 10a2 2 0 11-4 0 2 2 0 014 0z"/>
</svg>
{{ movie.source_name }}
</span>
</div>
</details>
<!-- Status badges -->
<div class="d-flex flex-wrap gap-2">
{% if movie.watched %}
<span class="badge bg-success d-flex align-items-center">
<svg class="me-1" width="12" height="12" fill="currentColor" viewBox="0 0 20 20">
<path fill-rule="evenodd" d="M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z" clip-rule="evenodd"/>
</svg>
Watched
</span>
{% endif %}
{% if movie.watch_count > 0 %}
<span class="badge bg-primary">{{ movie.watch_count }} watch{{ movie.watch_count > 1 ? 'es' : '' }}</span>
{% endif %}
{% if movie.is_favorite %}
<span class="badge bg-danger d-flex align-items-center">
<svg class="me-1" width="12" height="12" fill="currentColor" viewBox="0 0 20 20">
<path d="M3.172 5.172a4 4 0 015.656 0L10 6.343l1.172-1.171a4 4 0 115.656 5.656L10 17.657l-6.828-6.829a4 4 0 010-5.656z"/>
</svg>
Favorite
</span>
{% endif %}
{% if movie.status %}
<span class="badge bg-secondary">{{ movie.status|title }}</span>
{% endif %}
</div>
</div>
<!-- Overview -->
{% if movie.overview %}
<div class="mb-4">
<h2 class="h5 fw-semibold text-dark mb-2">Overview</h2>
<p class="text-muted">{{ movie.overview }}</p>
</div>
{% endif %}
<!-- Cast & Crew Section -->
<div class="mb-4">
<h2 class="h5 fw-semibold text-dark mb-3">Cast & Crew</h2>
<div class="row g-3">
{% if movie.director %}
<div class="col-md-6">
<div class="d-flex align-items-center">
<svg class="me-2 text-muted" width="20" height="20" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M16 7a4 4 0 11-8 0 4 4 0 018 0zM12 14a7 7 0 00-7 7h14a7 7 0 00-7-7z"/>
</svg>
<div>
<small class="text-muted d-block">Director</small>
<span class="fw-medium">{{ movie.director }}</span>
</div>
</div>
</div>
{% endif %}
{% if movie.writer %}
<div class="col-md-6">
<div class="d-flex align-items-center">
<svg class="me-2 text-muted" width="20" height="20" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z"/>
</svg>
<div>
<small class="text-muted d-block">Writer</small>
<span class="fw-medium">{{ movie.writer }}</span>
</div>
</div>
</div>
{% endif %}
</div>
{% if actors %}
<div class="mt-3">
<small class="text-muted d-block mb-2">Cast</small>
<div class="d-flex flex-wrap gap-2">
{% for actor in actors %}
<span class="badge bg-light text-dark">{{ actor.name }}</span>
{% endfor %}
</div>
</div>
{% endif %}
</div>
<!-- Movie Details Grid -->
<div class="row g-4 mb-4">
<!-- Genres -->
{% if movie.genre %}
<div class="col-md-4">
<h3 class="h6 fw-semibold text-dark mb-3">Genres</h3>
<div class="d-flex flex-wrap gap-2">
{% for genre in movie.genre|split(',') %}
<span class="badge bg-primary">{{ genre|trim }}</span>
{% endfor %}
</div>
</div>
{% endif %}
<!-- Production -->
{% if movie.production_companies or movie.production_countries %}
<div class="col-md-4">
<h3 class="h6 fw-semibold text-dark mb-3">Production</h3>
<div class="mb-2">
{% if movie.production_companies %}
<small class="text-muted d-block">Companies</small>
<span class="fw-medium">{{ movie.production_companies }}</span>
{% endif %}
</div>
{% if movie.production_countries %}
<div class="mb-2">
<small class="text-muted d-block">Countries</small>
<span class="fw-medium">{{ movie.production_countries }}</span>
</div>
{% endif %}
</div>
{% endif %}
<!-- Technical Details -->
{% if movie.budget or movie.revenue or movie.original_language %}
<div class="col-md-4">
<h3 class="h6 fw-semibold text-dark mb-3">Technical</h3>
<div class="mb-2">
{% if movie.budget %}
<small class="text-muted d-block">Budget</small>
<span class="fw-medium">${{ movie.budget|number_format(0, '.', ',') }}</span>
{% endif %}
</div>
{% if movie.revenue %}
<div class="mb-2">
<small class="text-muted d-block">Revenue</small>
<span class="fw-medium">${{ movie.revenue|number_format(0, '.', ',') }}</span>
</div>
{% endif %}
{% if movie.original_language %}
<div class="mb-2">
<small class="text-muted d-block">Language</small>
<span class="fw-medium">{{ movie.original_language|upper }}</span>
</div>
{% endif %}
</div>
{% endif %}
</div>
<!-- Collection/Series Info -->
{% if movie.belongs_to_collection %}
<div class="mb-4 p-3 bg-light rounded">
<h3 class="h6 fw-semibold text-dark mb-2">Collection</h3>
<span class="fw-medium">{{ movie.belongs_to_collection }}</span>
</div>
{% endif %}
<!-- Streaming & Availability -->
{% if movie.streaming_providers or movie.availability %}
<div class="mb-4">
<h3 class="h5 fw-semibold text-dark mb-3">Where to Watch</h3>
<div class="row g-3">
{% if movie.streaming_providers %}
<div class="col-md-6">
<small class="text-muted d-block mb-2">Streaming</small>
<div class="d-flex flex-wrap gap-2">
{% for provider in movie.streaming_providers %}
<span class="badge bg-success">{{ provider }}</span>
{% endfor %}
</div>
</div>
{% endif %}
{% if movie.availability %}
<div class="col-md-6">
<small class="text-muted d-block mb-2">Availability</small>
<span class="fw-medium">{{ movie.availability }}</span>
</div>
{% endif %}
</div>
</div>
{% endif %}
<!-- User Reviews & Ratings -->
{% if movie.user_reviews or movie.critic_reviews %}
<div class="mb-4">
<h3 class="h5 fw-semibold text-dark mb-3">Reviews & Ratings</h3>
<div class="row g-4">
{% if movie.user_reviews %}
<div class="col-md-6">
<h4 class="h6 fw-semibold text-dark mb-2">User Reviews</h4>
<div class="vstack gap-3">
{% for review in movie.user_reviews[:3] %}
<div class="p-3 bg-light rounded">
<div class="d-flex align-items-center mb-2">
<div class="d-flex text-warning">
{% for i in 1..5 %}
<svg class="me-1" width="16" height="16" fill="{{ i <= review.rating ? 'currentColor' : 'none' }}" viewBox="0 0 20 20">
<path d="M9.049 2.927c.3-.921 1.603-.921 1.902 0l1.07 3.292a1 1 0 00.95.69h3.462c.969 0 1.371 1.24.588 1.81l-2.8 2.034a1 1 0 00-.364 1.118l1.07 3.292c.3.921-.755 1.688-1.54 1.118l-2.8-2.034a1 1 0 00-1.175 0l-2.8 2.034c-.784.57-1.838-.197-1.539-1.118l1.07-3.292a1 1 0 00-.364-1.118L2.98 8.72c-.783-.57-.38-1.81.588-1.81h3.461a1 1 0 00.951-.69l1.07-3.292z"/>
</svg>
{% endfor %}
</div>
<span class="ms-2 small text-muted">{{ review.author }}</span>
</div>
<p class="small text-muted">{{ review.content|slice(0, 150) }}{% if review.content|length > 150 %}...{% endif %}</p>
</div>
{% endfor %}
</div>
</div>
{% endif %}
{% if movie.critic_reviews %}
<div class="col-md-6">
<h4 class="h6 fw-semibold text-dark mb-2">Critic Reviews</h4>
<div class="vstack gap-3">
{% for review in movie.critic_reviews[:3] %}
<div class="p-3 bg-light rounded">
<div class="d-flex align-items-center justify-content-between mb-2">
<span class="fw-medium">{{ review.publication }}</span>
<span class="badge bg-info">{{ review.rating }}/100</span>
</div>
<p class="small text-muted">{{ review.excerpt|slice(0, 150) }}{% if review.excerpt|length > 150 %}...{% endif %}</p>
</div>
{% endfor %}
</div>
</div>
{% endif %}
</div>
</div>
{% endif %}
<!-- Metadata (for debugging/advanced users) -->
{% if metadata %}
<div class="mt-4 pt-4 border-top">
<details class="group">
<summary class="cursor-pointer small fw-medium text-muted hover:text-dark d-flex align-items-center">
<svg class="me-2 group-open:rotate-90 transition-transform" width="16" height="16" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5l7 7-7 7"/>
</svg>
Technical Details & Metadata
</summary>
<div class="mt-3 small">
<pre class="bg-light p-3 rounded"><code>{{ metadata|json_encode(constant('JSON_PRETTY_PRINT')) }}</code></pre>
</div>
</details>
</div>
{% endif %}
</div>
{% endif %}
</div>
</div>
</div>