From 7104bb67ca5334157ce67bd8de8d1d10ae3aabdc Mon Sep 17 00:00:00 2001 From: WithoutPants <53250216+WithoutPants@users.noreply.github.com> Date: Thu, 20 Oct 2022 10:58:42 +1100 Subject: [PATCH] Handle null video durations in migration (#3021) --- pkg/file/video/scan.go | 1 + pkg/sqlite/migrations/32_files.up.sql | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/pkg/file/video/scan.go b/pkg/file/video/scan.go index b1ddf2d83..141d6cc63 100644 --- a/pkg/file/video/scan.go +++ b/pkg/file/video/scan.go @@ -75,5 +75,6 @@ func (d *Decorator) IsMissingMetadata(ctx context.Context, fs file.FS, f file.Fi return vf.VideoCodec == unsetString || vf.AudioCodec == unsetString || vf.Format == unsetString || vf.Width == unsetNumber || vf.Height == unsetNumber || vf.FrameRate == unsetNumber || + vf.Duration == unsetNumber || vf.BitRate == unsetNumber || interactive != vf.Interactive } diff --git a/pkg/sqlite/migrations/32_files.up.sql b/pkg/sqlite/migrations/32_files.up.sql index 8e76b0d37..548f8c620 100644 --- a/pkg/sqlite/migrations/32_files.up.sql +++ b/pkg/sqlite/migrations/32_files.up.sql @@ -458,7 +458,7 @@ INSERT INTO `video_files` ) SELECT `files`.`id`, - `scenes`.`duration`, + COALESCE(`scenes`.`duration`, -1), -- special values for unset to be updated during scan COALESCE(`scenes`.`video_codec`, 'unset'), COALESCE(`scenes`.`format`, 'unset'),