Dispatcharr/apps/epg/serializers.py
Dispatcharr fe8d6fd082 Updated EPGData
Added EPG Data endpoint
2025-03-21 12:23:23 -05:00

26 lines
No EOL
825 B
Python

from rest_framework import serializers
from .models import EPGSource, EPGData, ProgramData
from apps.channels.models import Channel
class EPGSourceSerializer(serializers.ModelSerializer):
class Meta:
model = EPGSource
fields = ['id', 'name', 'source_type', 'url', 'api_key', 'is_active']
class ProgramDataSerializer(serializers.ModelSerializer):
class Meta:
model = ProgramData
fields = ['id', 'start_time', 'end_time', 'title', 'sub_title', 'description', 'tvg_id']
class EPGDataSerializer(serializers.ModelSerializer):
"""
Only returns the tvg_id and the 'name' field from EPGData.
We assume 'name' is effectively the channel name.
"""
class Meta:
model = EPGData
fields = [
'id',
'tvg_id',
'name',
]