mirror of
https://github.com/Dispatcharr/Dispatcharr.git
synced 2026-01-23 02:35:14 +00:00
26 lines
No EOL
825 B
Python
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',
|
|
] |