From 38dd527319cd8669bedb6d0680dd028fe5d5db73 Mon Sep 17 00:00:00 2001 From: JohnDoe6345789 Date: Tue, 30 Dec 2025 11:40:44 +0000 Subject: [PATCH] feat: Add Radio Channel entity schema with comprehensive fields and configurations --- .../schema/entities/radio_channel.yaml | 162 ++++++++++++++ .../schema/entities/tv_channel.yaml | 201 ++++++++++++++++++ 2 files changed, 363 insertions(+) create mode 100644 services/media_daemon/schema/entities/radio_channel.yaml create mode 100644 services/media_daemon/schema/entities/tv_channel.yaml diff --git a/services/media_daemon/schema/entities/radio_channel.yaml b/services/media_daemon/schema/entities/radio_channel.yaml new file mode 100644 index 000000000..4720c7d00 --- /dev/null +++ b/services/media_daemon/schema/entities/radio_channel.yaml @@ -0,0 +1,162 @@ +# Radio Channel Entity Schema + +entity: RadioChannel +version: "1.0" +description: "Radio streaming channel configuration" + +fields: + id: + type: uuid + primary: true + generated: true + description: "Unique channel identifier" + + tenant_id: + type: uuid + required: true + indexed: true + description: "Tenant for multi-tenancy isolation" + + name: + type: string + required: true + max_length: 256 + description: "Channel display name" + + slug: + type: string + required: true + max_length: 64 + unique_within: tenant_id + pattern: "^[a-z0-9-]+$" + description: "URL-friendly channel identifier" + + description: + type: string + max_length: 2048 + description: "Channel description" + + artwork_url: + type: string + max_length: 512 + description: "Channel artwork/logo URL" + + is_live: + type: boolean + default: false + indexed: true + description: "Whether channel is currently streaming" + + # Audio Settings + bitrate_kbps: + type: integer + default: 128 + min: 64 + max: 320 + description: "Audio bitrate in kbps" + + codec: + type: enum + values: [mp3, aac, opus, flac] + default: mp3 + description: "Audio codec" + + sample_rate: + type: integer + default: 44100 + values: [22050, 44100, 48000] + description: "Audio sample rate in Hz" + + # Crossfade + crossfade_enabled: + type: boolean + default: true + description: "Enable crossfade between tracks" + + crossfade_ms: + type: integer + default: 3000 + min: 0 + max: 10000 + description: "Crossfade duration in milliseconds" + + # Normalization + normalization_enabled: + type: boolean + default: true + description: "Enable audio normalization" + + target_lufs: + type: float + default: -14.0 + min: -23.0 + max: -9.0 + description: "Target loudness in LUFS" + + # Auto-DJ + auto_dj_enabled: + type: boolean + default: false + description: "Enable auto-DJ mode" + + auto_dj_folders: + type: json + description: "Folders to scan for auto-DJ music" + + shuffle: + type: boolean + default: true + description: "Shuffle playlist in auto-DJ mode" + + # Statistics + listener_count: + type: integer + default: 0 + description: "Current listener count" + + total_plays: + type: integer + default: 0 + description: "Total tracks played" + + uptime_seconds: + type: integer + default: 0 + description: "Total streaming uptime" + + # Metadata + stream_url: + type: string + max_length: 512 + description: "HLS/Icecast stream URL" + + metadata: + type: json + description: "Additional metadata" + + created_at: + type: timestamp + auto_now_add: true + description: "Channel creation timestamp" + + updated_at: + type: timestamp + auto_now: true + description: "Last update timestamp" + +indexes: + - fields: [tenant_id, slug] + unique: true + name: idx_radio_tenant_slug + - fields: [tenant_id, is_live] + name: idx_radio_tenant_live + +acl: + create: + min_level: 3 # Admin + read: + public: true # Anyone can see channel info + update: + min_level: 3 # Admin + delete: + min_level: 4 # God diff --git a/services/media_daemon/schema/entities/tv_channel.yaml b/services/media_daemon/schema/entities/tv_channel.yaml new file mode 100644 index 000000000..4bac23f49 --- /dev/null +++ b/services/media_daemon/schema/entities/tv_channel.yaml @@ -0,0 +1,201 @@ +# TV Channel Entity Schema + +entity: TvChannel +version: "1.0" +description: "TV channel configuration with scheduling and EPG" + +fields: + id: + type: uuid + primary: true + generated: true + description: "Unique channel identifier" + + tenant_id: + type: uuid + required: true + indexed: true + description: "Tenant for multi-tenancy isolation" + + channel_number: + type: integer + required: true + min: 1 + max: 9999 + unique_within: tenant_id + description: "Channel number for EPG" + + name: + type: string + required: true + max_length: 256 + description: "Channel display name" + + slug: + type: string + required: true + max_length: 64 + unique_within: tenant_id + pattern: "^[a-z0-9-]+$" + description: "URL-friendly channel identifier" + + description: + type: string + max_length: 2048 + description: "Channel description" + + logo_url: + type: string + max_length: 512 + description: "Channel logo URL" + + category: + type: enum + values: [general, news, sports, movies, series, kids, music, documentary, lifestyle, other] + default: general + description: "Channel category" + + is_live: + type: boolean + default: false + indexed: true + description: "Whether channel is currently streaming" + + # Video Settings + resolutions: + type: json + default: '["1080p", "720p", "480p"]' + description: "Available resolutions" + + video_codec: + type: enum + values: [h264, h265, vp9, av1] + default: h264 + description: "Video codec" + + video_preset: + type: enum + values: [ultrafast, superfast, veryfast, faster, fast, medium, slow, slower, veryslow] + default: fast + description: "Encoding preset" + + audio_codec: + type: enum + values: [aac, ac3, eac3, opus] + default: aac + description: "Audio codec" + + audio_bitrate_kbps: + type: integer + default: 128 + description: "Audio bitrate in kbps" + + # HLS Settings + segment_duration: + type: integer + default: 4 + min: 2 + max: 10 + description: "HLS segment duration in seconds" + + playlist_size: + type: integer + default: 10 + min: 3 + max: 30 + description: "HLS playlist window size" + + # Filler Content + filler_playlist: + type: string + max_length: 512 + description: "Path to filler content playlist" + + offline_image: + type: string + max_length: 512 + description: "Image to show when offline" + + # Bumpers/Commercials + intro_bumper: + type: string + max_length: 512 + description: "Path to intro bumper video" + + outro_bumper: + type: string + max_length: 512 + description: "Path to outro bumper video" + + commercial_break_duration: + type: integer + default: 120 + description: "Commercial break duration in seconds" + + commercials_playlist: + type: json + description: "List of commercial video paths" + + # Statistics + viewer_count: + type: integer + default: 0 + description: "Current viewer count" + + peak_viewers: + type: integer + default: 0 + description: "Peak viewer count" + + uptime_seconds: + type: integer + default: 0 + description: "Total streaming uptime" + + # Stream URLs + hls_url: + type: string + max_length: 512 + description: "HLS stream URL" + + dash_url: + type: string + max_length: 512 + description: "DASH stream URL" + + # Metadata + metadata: + type: json + description: "Additional metadata" + + created_at: + type: timestamp + auto_now_add: true + description: "Channel creation timestamp" + + updated_at: + type: timestamp + auto_now: true + description: "Last update timestamp" + +indexes: + - fields: [tenant_id, channel_number] + unique: true + name: idx_tv_tenant_number + - fields: [tenant_id, slug] + unique: true + name: idx_tv_tenant_slug + - fields: [tenant_id, is_live] + name: idx_tv_tenant_live + - fields: [tenant_id, category] + name: idx_tv_tenant_category + +acl: + create: + min_level: 3 # Admin + read: + public: true # Anyone can see channel info + update: + min_level: 3 # Admin + delete: + min_level: 4 # God