fix channel sort number when reordering channels (#2700)

* fix channel sort number when reordering channels

* tryparse
This commit is contained in:
Jason Dove
2025-12-03 18:33:47 -06:00
committed by GitHub
parent 72dc401829
commit 3e0a9aae1e
2 changed files with 11 additions and 0 deletions
+2
View File
@@ -40,6 +40,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- Fix loading requested number of epg entries for motion graphics elements
- Fix bug with mirror channels where seemingly random content would be played every ~40 seconds
- Fix chronological sorting for Other Videos that have release date metadata
- Fix playout sorting after using channel number editor
- If your playouts are sorted incorrectly, use the channel number editor to fix (swap two channels, then swap them back)
### Changed
- No longer round framerate to nearest integer when normalizing framerate
@@ -1,3 +1,4 @@
using System.Globalization;
using System.Threading.Channels;
using ErsatzTV.Core;
using ErsatzTV.Infrastructure.Data;
@@ -38,6 +39,14 @@ public class UpdateChannelNumbersHandler(
foreach (var channel in channelsToUpdate)
{
channel.Number = numberUpdates[channel.Id];
if (double.TryParse(channel.Number, CultureInfo.InvariantCulture, out double sortNumber))
{
channel.SortNumber = sortNumber;
}
else
{
return BaseError.New($"Failed to parse channel number {channel.Number}");
}
}
// save those changes