mirror of
https://github.com/Dispatcharr/Dispatcharr.git
synced 2026-01-23 02:35:14 +00:00
Enhancement: Add {starttime_long} and {endtime_long} to custom dummy EPG.
This commit is contained in:
parent
28c211cd56
commit
c9d7e66545
2 changed files with 18 additions and 0 deletions
|
|
@ -592,6 +592,9 @@ def generate_custom_dummy_programs(channel_id, channel_name, now, num_days, cust
|
|||
else:
|
||||
all_groups['starttime'] = f"{hour_12} {ampm}"
|
||||
|
||||
# Format long version that always includes minutes (e.g., "9:00 PM" instead of "9 PM")
|
||||
all_groups['starttime_long'] = f"{hour_12}:{minute:02d} {ampm}"
|
||||
|
||||
# Calculate end time based on program duration
|
||||
# Create a datetime for calculations
|
||||
temp_start = datetime.now(source_tz).replace(hour=hour_24, minute=minute, second=0, microsecond=0)
|
||||
|
|
@ -621,6 +624,9 @@ def generate_custom_dummy_programs(channel_id, channel_name, now, num_days, cust
|
|||
else:
|
||||
all_groups['endtime'] = f"{end_hour_12} {end_ampm}"
|
||||
|
||||
# Format long version that always includes minutes (e.g., "9:00 PM" instead of "9 PM")
|
||||
all_groups['endtime_long'] = f"{end_hour_12}:{end_minute:02d} {end_ampm}"
|
||||
|
||||
# Generate programs
|
||||
programs = []
|
||||
|
||||
|
|
|
|||
|
|
@ -246,6 +246,10 @@ const DummyEPGForm = ({ epg, isOpen, onClose }) => {
|
|||
} else {
|
||||
allGroups.starttime = `${hour12} ${ampmDisplay}`;
|
||||
}
|
||||
|
||||
// Format long versions that always include minutes
|
||||
allGroups.starttime_long = `${hour12}:${convertedMinute.toString().padStart(2, '0')} ${ampmDisplay}`;
|
||||
allGroups.starttime24_long = `${hour24.toString().padStart(2, '0')}:${convertedMinute.toString().padStart(2, '0')}`;
|
||||
} else {
|
||||
// No timezone conversion - use original logic
|
||||
// Format 24-hour start time string
|
||||
|
|
@ -270,6 +274,9 @@ const DummyEPGForm = ({ epg, isOpen, onClose }) => {
|
|||
} else {
|
||||
allGroups.starttime = `${hour12} ${ampmDisplay}`;
|
||||
}
|
||||
|
||||
// Format long version that always includes minutes
|
||||
allGroups.starttime_long = `${hour12}:${minute.toString().padStart(2, '0')} ${ampmDisplay}`;
|
||||
}
|
||||
|
||||
// Calculate end time based on program duration
|
||||
|
|
@ -306,12 +313,17 @@ const DummyEPGForm = ({ epg, isOpen, onClose }) => {
|
|||
allGroups.endtime = `${endHour12} ${endAmpmDisplay}`;
|
||||
}
|
||||
|
||||
// Format long version that always includes minutes
|
||||
allGroups.endtime_long = `${endHour12}:${endMinute.toString().padStart(2, '0')} ${endAmpmDisplay}`;
|
||||
|
||||
// Store calculated placeholders for display in preview
|
||||
result.calculatedPlaceholders = {
|
||||
starttime: allGroups.starttime,
|
||||
starttime24: allGroups.starttime24,
|
||||
starttime_long: allGroups.starttime_long,
|
||||
endtime: allGroups.endtime,
|
||||
endtime24: allGroups.endtime24,
|
||||
endtime_long: allGroups.endtime_long,
|
||||
};
|
||||
} catch (e) {
|
||||
// If parsing fails, leave starttime/endtime as placeholders
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue