The Free Software Media System - Server Backend & API
review comments
cvium05e40ecb933f
diff --git a/Emby.Server.Implementations/Data/SqliteExtensions.cs b/Emby.Server.Implementations/Data/SqliteExtensions.csindex f3b3da64f4..30e334393c 100644--- a/Emby.Server.Implementations/Data/SqliteExtensions.cs+++ b/Emby.Server.Implementations/Data/SqliteExtensions.cs@@ -243,6 +243,7 @@ namespace Emby.Server.Implementations.Datapublic static int SelectScalarInt(this SqliteCommand command){var result = command.ExecuteScalar();+ // Can't be null since the method is used to retrieve Countreturn Convert.ToInt32(result!, CultureInfo.InvariantCulture);}diff --git a/Jellyfin.Server/Migrations/Routines/RemoveDuplicateExtras.cs b/Jellyfin.Server/Migrations/Routines/RemoveDuplicateExtras.csindex 98017e3ef4..6c34e1f5bb 100644--- a/Jellyfin.Server/Migrations/Routines/RemoveDuplicateExtras.cs+++ b/Jellyfin.Server/Migrations/Routines/RemoveDuplicateExtras.cs@@ -39,11 +39,11 @@ namespace Jellyfin.Server.Migrations.Routinesvar dataPath = _paths.DataPath;var dbPath = Path.Combine(dataPath, DbFilename);using (var connection = new SqliteConnection($"Filename={dbPath}"))+ using (var transaction = connection.BeginTransaction()){// Query the database for the ids of duplicate extrasvar queryResult = connection.Query("SELECT t1.Path FROM TypedBaseItems AS t1, TypedBaseItems AS t2 WHERE t1.Path=t2.Path AND t1.Type!=t2.Type AND t1.Type='MediaBrowser.Controller.Entities.Video'");- // TODO does this LINQ execute before the reader is disposed?- var bads = string.Join(", ", queryResult.Select(x => x.GetString(0)).ToList());+ var bads = string.Join(", ", queryResult.Select(x => x.GetString(0)));// Do nothing if no duplicate extras were detectedif (bads.Length == 0)@@ -75,6 +75,7 @@ namespace Jellyfin.Server.Migrations.Routines// Delete all duplicate extras_logger.LogInformation("Removing found duplicated extras for the following items: {DuplicateExtras}", bads);connection.Execute("DELETE FROM TypedBaseItems WHERE rowid IN (SELECT t1.rowid FROM TypedBaseItems AS t1, TypedBaseItems AS t2 WHERE t1.Path=t2.Path AND t1.Type!=t2.Type AND t1.Type='MediaBrowser.Controller.Entities.Video')");+ transaction.Commit();}}}