Enhancement: Add 'Include New Tag' option to mark programs as new in custom dummy EPG output

This commit is contained in:
SergeantPanda 2025-10-25 11:47:54 -05:00
parent 423c56f582
commit 3e2e704765
2 changed files with 31 additions and 0 deletions

View file

@ -356,6 +356,7 @@ def generate_custom_dummy_programs(channel_id, channel_name, now, num_days, cust
categories = [cat.strip() for cat in category_string.split(',') if cat.strip()] if category_string else []
include_date = custom_properties.get('include_date', True)
include_live = custom_properties.get('include_live', False)
include_new = custom_properties.get('include_new', False)
# Parse timezone name
try:
@ -749,6 +750,10 @@ def generate_custom_dummy_programs(channel_id, channel_name, now, num_days, cust
if include_live:
main_event_custom_properties['live'] = True
# Add new flag if requested
if include_new:
main_event_custom_properties['new'] = True
# Add program poster URL if provided
if program_poster_url:
main_event_custom_properties['icon'] = program_poster_url
@ -912,6 +917,10 @@ def generate_custom_dummy_programs(channel_id, channel_name, now, num_days, cust
if include_live:
program_custom_properties['live'] = True
# Add new flag if requested
if include_new:
program_custom_properties['new'] = True
# Add program poster URL if provided
if program_poster_url:
program_custom_properties['icon'] = program_poster_url
@ -978,6 +987,10 @@ def generate_dummy_epg(
if custom_data.get('live', False):
xml_lines.append(f" <live />")
# New tag
if custom_data.get('new', False):
xml_lines.append(f" <new />")
xml_lines.append(f" </programme>")
return xml_lines
@ -1232,6 +1245,10 @@ def generate_epg(request, profile_name=None, user=None):
if custom_data.get('live', False):
yield f" <live />\n"
# New tag
if custom_data.get('new', False):
yield f" <new />\n"
# Icon/poster URL
if 'icon' in custom_data:
yield f" <icon src=\"{html.escape(custom_data['icon'])}\" />\n"
@ -1277,6 +1294,10 @@ def generate_epg(request, profile_name=None, user=None):
if custom_data.get('live', False):
yield f" <live />\n"
# New tag
if custom_data.get('new', False):
yield f" <new />\n"
# Icon/poster URL
if 'icon' in custom_data:
yield f" <icon src=\"{html.escape(custom_data['icon'])}\" />\n"

View file

@ -68,6 +68,7 @@ const DummyEPGForm = ({ epg, isOpen, onClose }) => {
category: '',
include_date: true,
include_live: false,
include_new: false,
},
},
validate: {
@ -401,6 +402,7 @@ const DummyEPGForm = ({ epg, isOpen, onClose }) => {
category: custom.category || '',
include_date: custom.include_date ?? true,
include_live: custom.include_live ?? false,
include_new: custom.include_new ?? false,
},
});
@ -798,6 +800,14 @@ const DummyEPGForm = ({ epg, isOpen, onClose }) => {
})}
/>
<Checkbox
label="Include New Tag"
description="Mark programs as new content with the <new /> tag in EPG output. Note: Only added to the main event, not upcoming/ended filler programs."
{...form.getInputProps('custom_properties.include_new', {
type: 'checkbox',
})}
/>
{/* Testing & Preview */}
<Divider label="Test Your Configuration" labelPosition="center" />