Get full release date.

This commit is contained in:
SergeantPanda 2025-08-05 15:50:28 -05:00
parent a66028ff02
commit 0120419d09
6 changed files with 17 additions and 13 deletions

View file

@ -123,7 +123,7 @@ class MovieViewSet(viewsets.ReadOnlyModelViewSet):
'description': info.get('description', info.get('plot', '')),
'plot': info.get('plot', info.get('description', '')),
'year': self._extract_year(info.get('releasedate', '')),
'release_date': info.get('releasedate', ''),
'release_date': info.get('release_date', ''),
'releasedate': info.get('releasedate', ''),
'genre': info.get('genre', ''),
'director': info.get('director', ''),
@ -295,6 +295,7 @@ class SeriesViewSet(viewsets.ReadOnlyModelViewSet):
'episode_number': episode.episode_number,
'season_number': episode.season_number,
'description': episode.description,
'release_date': episode.release_date,
'plot': episode.description,
'duration': episode.duration,
'duration_secs': episode.duration * 60 if episode.duration else None,

View file

@ -1,4 +1,4 @@
# Generated by Django 5.2.4 on 2025-08-05 15:48
# Generated by Django 5.2.4 on 2025-08-05 20:40
import django.db.models.deletion
import uuid
@ -88,7 +88,7 @@ class Migration(migrations.Migration):
('uuid', models.UUIDField(default=uuid.uuid4, editable=False, unique=True)),
('name', models.CharField(max_length=255)),
('description', models.TextField(blank=True, null=True)),
('year', models.IntegerField(blank=True, null=True)),
('release_date', models.DateField(blank=True, null=True)),
('rating', models.CharField(blank=True, max_length=10, null=True)),
('duration', models.IntegerField(blank=True, help_text='Duration in minutes', null=True)),
('season_number', models.IntegerField(blank=True, null=True)),

View file

@ -128,7 +128,7 @@ class Episode(models.Model):
uuid = models.UUIDField(default=uuid.uuid4, editable=False, unique=True)
name = models.CharField(max_length=255)
description = models.TextField(blank=True, null=True)
year = models.IntegerField(blank=True, null=True)
release_date = models.DateField(blank=True, null=True)
rating = models.CharField(max_length=10, blank=True, null=True)
duration = models.IntegerField(blank=True, null=True, help_text="Duration in minutes")

View file

@ -329,22 +329,24 @@ def refresh_series_episodes(account, series, series_id):
# Build episode stream URL
stream_url = f"{account.server_url}/series/{account.username}/{account.password}/{episode_data['id']}.{episode_data.get('container_extension', 'mp4')}"
# Get episode info (metadata is nested in 'info' object)
episode_info = episode_data.get('info', {})
episode_dict = {
'name': episode_data.get('title', f"Episode {episode_data.get('episode_num', '')}"),
'series': series,
'season_number': int(season_num) if season_num.isdigit() else None,
'episode_number': episode_data.get('episode_num'),
'url': stream_url,
'description': episode_data.get('plot'),
'year': episode_data.get('air_date', '').split('-')[0] if episode_data.get('air_date') else None,
'rating': episode_data.get('rating'),
'duration': episode_data.get('duration_secs', 0) // 60 if episode_data.get('duration_secs') else None,
'description': episode_info.get('plot') or episode_info.get('overview'),
'release_date': episode_info.get('release_date') or episode_info.get('releasedate'),
'rating': episode_info.get('rating'),
'duration': episode_info.get('duration_secs'),
'container_extension': episode_data.get('container_extension'),
'tmdb_id': episode_data.get('tmdb_id'),
'imdb_id': episode_data.get('imdb_id'),
'tmdb_id': episode_info.get('tmdb_id'),
'imdb_id': episode_info.get('imdb_id'),
'custom_properties': episode_data if episode_data else None
}
# Use new Episode model
episode, created = Episode.objects.update_or_create(
stream_id=episode_data['id'],

View file

@ -533,7 +533,7 @@ const SeriesModal = ({ series, opened, onClose }) => {
<Table.Th style={{ width: '60px' }}>Ep</Table.Th>
<Table.Th>Title</Table.Th>
<Table.Th style={{ width: '80px' }}>Duration</Table.Th>
<Table.Th style={{ width: '60px' }}>Year</Table.Th>
<Table.Th style={{ width: '60px' }}>Date</Table.Th>
<Table.Th style={{ width: '80px' }}>Action</Table.Th>
</Table.Tr>
</Table.Thead>
@ -568,7 +568,7 @@ const SeriesModal = ({ series, opened, onClose }) => {
</Table.Td>
<Table.Td>
<Text size="xs" color="dimmed">
{episode.year}
{episode.release_date ? new Date(episode.release_date).toLocaleDateString() : 'N/A'}
</Text>
</Table.Td>
<Table.Td>

View file

@ -317,6 +317,7 @@ const useVODStore = create((set, get) => ({
type: 'episode',
uuid: episode.id, // Use the stream ID as UUID for playback
logo: episode.movie_image ? { url: episode.movie_image } : null,
release_date: episode.release_date || null,
};
episodesData[episode.id] = episodeData;
});