From 948b3735bdc524b60cefca3f59643586c2642204 Mon Sep 17 00:00:00 2001 From: Jason Dove <1695733+jasongdove@users.noreply.github.com> Date: Tue, 14 Nov 2023 05:50:51 -0600 Subject: [PATCH] fix file not found music videos (#1502) * fix indexing music videos in file not found state * update dependencies --- CHANGELOG.md | 1 + ErsatzTV.Core.Tests/ErsatzTV.Core.Tests.csproj | 2 +- ErsatzTV.Core/ErsatzTV.Core.csproj | 2 +- .../ErsatzTV.Infrastructure.Sqlite.csproj | 2 +- .../ErsatzTV.Infrastructure.csproj | 4 ++-- .../Search/ElasticSearchIndex.cs | 2 +- .../Search/LuceneSearchIndex.cs | 18 +++++++++++------- ErsatzTV.Scanner/ErsatzTV.Scanner.csproj | 2 +- ErsatzTV/ErsatzTV.csproj | 2 +- 9 files changed, 20 insertions(+), 15 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ffab33ecd..d5fec5513 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -35,6 +35,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Fix displaying multiple languages in UI for movies, artists, shows - Fix MySQL queries that could fail during media server library scans - Fix scanning Jellyfin libraries when library options and/or path infos are not returned from Jellyfin API +- Fix error indexing music videos in `File Not Found` state ### Changed - Upgrade ffmpeg to 6.1, which is now *required* for all installs diff --git a/ErsatzTV.Core.Tests/ErsatzTV.Core.Tests.csproj b/ErsatzTV.Core.Tests/ErsatzTV.Core.Tests.csproj index 5ea4329ae..74b630e28 100644 --- a/ErsatzTV.Core.Tests/ErsatzTV.Core.Tests.csproj +++ b/ErsatzTV.Core.Tests/ErsatzTV.Core.Tests.csproj @@ -24,7 +24,7 @@ - + diff --git a/ErsatzTV.Core/ErsatzTV.Core.csproj b/ErsatzTV.Core/ErsatzTV.Core.csproj index 5ebb31699..cec61a8a0 100644 --- a/ErsatzTV.Core/ErsatzTV.Core.csproj +++ b/ErsatzTV.Core/ErsatzTV.Core.csproj @@ -25,7 +25,7 @@ runtime; build; native; contentfiles; analyzers; buildtransitive - + diff --git a/ErsatzTV.Infrastructure.Sqlite/ErsatzTV.Infrastructure.Sqlite.csproj b/ErsatzTV.Infrastructure.Sqlite/ErsatzTV.Infrastructure.Sqlite.csproj index cf4002885..cc1abdfa3 100644 --- a/ErsatzTV.Infrastructure.Sqlite/ErsatzTV.Infrastructure.Sqlite.csproj +++ b/ErsatzTV.Infrastructure.Sqlite/ErsatzTV.Infrastructure.Sqlite.csproj @@ -14,7 +14,7 @@ - + diff --git a/ErsatzTV.Infrastructure/ErsatzTV.Infrastructure.csproj b/ErsatzTV.Infrastructure/ErsatzTV.Infrastructure.csproj index dc611447d..daa8516ea 100644 --- a/ErsatzTV.Infrastructure/ErsatzTV.Infrastructure.csproj +++ b/ErsatzTV.Infrastructure/ErsatzTV.Infrastructure.csproj @@ -12,9 +12,9 @@ - + - + diff --git a/ErsatzTV.Infrastructure/Search/ElasticSearchIndex.cs b/ErsatzTV.Infrastructure/Search/ElasticSearchIndex.cs index 0c0584fac..31a7bc1f1 100644 --- a/ErsatzTV.Infrastructure/Search/ElasticSearchIndex.cs +++ b/ErsatzTV.Infrastructure/Search/ElasticSearchIndex.cs @@ -480,7 +480,7 @@ public class ElasticSearchIndex : ISearchIndex Id = musicVideo.Id, Type = LuceneSearchIndex.MusicVideoType, Title = metadata.Title, - SortTitle = metadata.SortTitle.ToLowerInvariant(), + SortTitle = (metadata.SortTitle ?? string.Empty).ToLowerInvariant(), LibraryName = musicVideo.LibraryPath.Library.Name, LibraryId = musicVideo.LibraryPath.Library.Id, TitleAndYear = LuceneSearchIndex.GetTitleAndYear(metadata), diff --git a/ErsatzTV.Infrastructure/Search/LuceneSearchIndex.cs b/ErsatzTV.Infrastructure/Search/LuceneSearchIndex.cs index 167cdd6c8..d57022bd4 100644 --- a/ErsatzTV.Infrastructure/Search/LuceneSearchIndex.cs +++ b/ErsatzTV.Infrastructure/Search/LuceneSearchIndex.cs @@ -808,8 +808,8 @@ public sealed class LuceneSearchIndex : ISearchIndex { new StringField(IdField, musicVideo.Id.ToString(CultureInfo.InvariantCulture), Field.Store.YES), new StringField(TypeField, MusicVideoType, Field.Store.YES), - new TextField(TitleField, metadata.Title, Field.Store.NO), - new StringField(SortTitleField, metadata.SortTitle.ToLowerInvariant(), Field.Store.NO), + new TextField(TitleField, metadata.Title ?? string.Empty, Field.Store.NO), + new StringField(SortTitleField, (metadata.SortTitle ?? string.Empty).ToLowerInvariant(), Field.Store.NO), new TextField(LibraryNameField, musicVideo.LibraryPath.Library.Name, Field.Store.NO), new StringField( LibraryIdField, @@ -1317,12 +1317,16 @@ public sealed class LuceneSearchIndex : ISearchIndex internal static string GetJumpLetter(Metadata metadata) { - char c = (metadata.SortTitle ?? " ").ToLowerInvariant().Head(); - return c switch + foreach (char c in (metadata.SortTitle ?? " ").ToLowerInvariant().HeadOrNone()) { - (>= 'a' and <= 'z') => c.ToString(), - _ => "#" - }; + return c switch + { + >= 'a' and <= 'z' => c.ToString(), + _ => "#" + }; + } + + return "#"; } private static string OtherVideoTitle(OtherVideoMetadata ovm) => diff --git a/ErsatzTV.Scanner/ErsatzTV.Scanner.csproj b/ErsatzTV.Scanner/ErsatzTV.Scanner.csproj index c6708c1d2..aa7d903c7 100644 --- a/ErsatzTV.Scanner/ErsatzTV.Scanner.csproj +++ b/ErsatzTV.Scanner/ErsatzTV.Scanner.csproj @@ -27,7 +27,7 @@ - + diff --git a/ErsatzTV/ErsatzTV.csproj b/ErsatzTV/ErsatzTV.csproj index d33e14b07..01c3e8ecc 100644 --- a/ErsatzTV/ErsatzTV.csproj +++ b/ErsatzTV/ErsatzTV.csproj @@ -78,7 +78,7 @@ - +