aboutsummaryrefslogtreecommitdiff
path: root/Jellyfin.Server/Migrations/Routines/RemoveDuplicateExtras.cs
diff options
context:
space:
mode:
authorcvium <clausvium@gmail.com>2023-08-21 15:31:02 +0200
committercvium <clausvium@gmail.com>2023-08-21 15:31:02 +0200
commitd223f5b5186f89ff9c6e931ae2341b44b190946d (patch)
treec464958c37debfefabfff068ba1777e9ea954958 /Jellyfin.Server/Migrations/Routines/RemoveDuplicateExtras.cs
parent061d79c113404359068e94256104f955720bd1eb (diff)
completely remove sqlitepcl
Diffstat (limited to 'Jellyfin.Server/Migrations/Routines/RemoveDuplicateExtras.cs')
-rw-r--r--Jellyfin.Server/Migrations/Routines/RemoveDuplicateExtras.cs13
1 files changed, 6 insertions, 7 deletions
diff --git a/Jellyfin.Server/Migrations/Routines/RemoveDuplicateExtras.cs b/Jellyfin.Server/Migrations/Routines/RemoveDuplicateExtras.cs
index 6c26e47e1..98017e3ef 100644
--- a/Jellyfin.Server/Migrations/Routines/RemoveDuplicateExtras.cs
+++ b/Jellyfin.Server/Migrations/Routines/RemoveDuplicateExtras.cs
@@ -1,10 +1,11 @@
using System;
using System.Globalization;
using System.IO;
-
+using System.Linq;
+using Emby.Server.Implementations.Data;
using MediaBrowser.Controller;
+using Microsoft.Data.Sqlite;
using Microsoft.Extensions.Logging;
-using SQLitePCL.pretty;
namespace Jellyfin.Server.Migrations.Routines
{
@@ -37,14 +38,12 @@ namespace Jellyfin.Server.Migrations.Routines
{
var dataPath = _paths.DataPath;
var dbPath = Path.Combine(dataPath, DbFilename);
- using (var connection = SQLite3.Open(
- dbPath,
- ConnectionFlags.ReadWrite,
- null))
+ using (var connection = new SqliteConnection($"Filename={dbPath}"))
{
// Query the database for the ids of duplicate extras
var 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'");
- var bads = string.Join(", ", queryResult.SelectScalarString());
+ // TODO does this LINQ execute before the reader is disposed?
+ var bads = string.Join(", ", queryResult.Select(x => x.GetString(0)).ToList());
// Do nothing if no duplicate extras were detected
if (bads.Length == 0)