fix duplicate database migration; fix ssa subtitles (#2216)

This commit is contained in:
Jason Dove
2025-07-28 19:23:59 +00:00
committed by GitHub
parent 1df9104854
commit 74733a8026
4 changed files with 17 additions and 6 deletions
+1
View File
@@ -16,6 +16,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- Fix app startup with MySql/MariaDB
- YAML playout: fix `pad_to_next` always running over time
- Fix playback with text subtitles when seeking into content, i.e. when first joining a channel
- Fix playback with `.ass` and `.ssa` text subtitles
### Changed
- Always tell ffmpeg to stop encoding with a specific duration
@@ -76,8 +76,8 @@ public abstract class PipelineBuilderBase : IPipelineBuilder
{
IPipelineStep outputFormat = Path.GetExtension(inputFile).ToLowerInvariant() switch
{
"ass" or "ssa" => new OutputFormatAss(),
"vtt" => new OutputFormatWebVtt(),
".ass" or ".ssa" => new OutputFormatAss(),
".vtt" => new OutputFormatWebVtt(),
_ => new OutputFormatSrt()
};
+2 -2
View File
@@ -198,8 +198,8 @@ public class InternalController : ControllerBase
{
string mimeType = Path.GetExtension(path).ToLowerInvariant() switch
{
"ass" or "ssa" => "text/x-ssa",
"vtt" => "text/vtt",
".ass" or ".ssa" => "text/x-ssa",
".vtt" => "text/vtt",
_ => "application/x-subrip"
};
@@ -31,13 +31,23 @@ public class DatabaseMigratorService : BackgroundService
using IServiceScope scope = _serviceScopeFactory.CreateScope();
await using TvContext dbContext = scope.ServiceProvider.GetRequiredService<TvContext>();
await dbContext.Database.MigrateAsync("Add_MediaFilePathHash", stoppingToken);
List<string> pendingMigrations = await dbContext.Database
.GetPendingMigrationsAsync(stoppingToken)
.Map(l => l.ToList());
if (pendingMigrations.Contains("Add_MediaFilePathHash", StringComparer.OrdinalIgnoreCase))
{
await dbContext.Database.MigrateAsync("Add_MediaFilePathHash", stoppingToken);
}
// this can't be part of a migration, so we have to stop here and run some sql
await PopulatePathHashes(dbContext);
// then continue migrating
await dbContext.Database.MigrateAsync(stoppingToken);
if (pendingMigrations.Count > 0)
{
await dbContext.Database.MigrateAsync(stoppingToken);
}
await DbInitializer.Initialize(dbContext, stoppingToken);