The Free Software Media System - Server Backend & API
Fix modification checks and make sure to use UTC (#14347)
Tim Eiselec6e568692ee1
diff --git a/Emby.Photos/PhotoProvider.cs b/Emby.Photos/PhotoProvider.csindex ac6c41ca52..4aca412ba1 100644--- a/Emby.Photos/PhotoProvider.cs+++ b/Emby.Photos/PhotoProvider.cs@@ -108,7 +108,7 @@ public class PhotoProvider : ICustomMetadataProvider<Photo>, IForcedProvider, IHvar dateTaken = image.ImageTag.DateTime;if (dateTaken.HasValue){- item.DateCreated = dateTaken.Value;+ item.DateCreated = dateTaken.Value.ToUniversalTime();item.PremiereDate = dateTaken.Value;item.ProductionYear = dateTaken.Value.Year;}diff --git a/Emby.Server.Implementations/HttpServer/WebSocketConnection.cs b/Emby.Server.Implementations/HttpServer/WebSocketConnection.csindex a720c86fb2..373b0994a6 100644--- a/Emby.Server.Implementations/HttpServer/WebSocketConnection.cs+++ b/Emby.Server.Implementations/HttpServer/WebSocketConnection.cs@@ -57,7 +57,7 @@ namespace Emby.Server.Implementations.HttpServerRemoteEndPoint = remoteEndPoint;_jsonOptions = JsonDefaults.Options;- LastActivityDate = DateTime.Now;+ LastActivityDate = DateTime.UtcNow;}/// <inheritdoc />diff --git a/Emby.Server.Implementations/Images/BaseDynamicImageProvider.cs b/Emby.Server.Implementations/Images/BaseDynamicImageProvider.csindex 8b28691498..4874eca8e6 100644--- a/Emby.Server.Implementations/Images/BaseDynamicImageProvider.cs+++ b/Emby.Server.Implementations/Images/BaseDynamicImageProvider.cs@@ -43,13 +43,11 @@ namespace Emby.Server.Implementations.Imagesprotected IImageProcessor ImageProcessor { get; set; }protected virtual IReadOnlyCollection<ImageType> SupportedImages { get; }- = new ImageType[] { ImageType.Primary };+ = [ImageType.Primary];/// <inheritdoc />public string Name => "Dynamic Image Provider";- protected virtual int MaxImageAgeDays => 7;-public int Order => 0;protected virtual bool Supports(BaseItem item) => true;@@ -292,8 +290,14 @@ namespace Emby.Server.Implementations.Imagesprotected virtual bool HasChangedByDate(BaseItem item, ItemImageInfo image){- var age = DateTime.UtcNow - image.DateModified;- return age.TotalDays > MaxImageAgeDays;+ var path = image.Path;+ if (!string.IsNullOrEmpty(path))+ {+ var modificationDate = FileSystem.GetLastWriteTimeUtc(path);+ return image.DateModified != modificationDate;+ }++ return false;}protected string CreateSingleImage(IEnumerable<BaseItem> itemsWithImages, string outputPathWithoutExtension, ImageType imageType)diff --git a/Emby.Server.Implementations/Library/LibraryManager.cs b/Emby.Server.Implementations/Library/LibraryManager.csindex 47d6663a16..6ffe67776b 100644--- a/Emby.Server.Implementations/Library/LibraryManager.cs+++ b/Emby.Server.Implementations/Library/LibraryManager.cs@@ -2050,13 +2050,17 @@ namespace Emby.Server.Implementations.Library/// <inheritdoc />public async Task UpdateItemsAsync(IReadOnlyList<BaseItem> items, BaseItem parent, ItemUpdateType updateReason, CancellationToken cancellationToken){- _itemRepository.SaveItems(items, cancellationToken);-foreach (var item in items){+ item.DateLastSaved = DateTime.UtcNow;await RunMetadataSavers(item, updateReason).ConfigureAwait(false);++ // Modify again, so saved value is after write time of externally saved metadata+ item.DateLastSaved = DateTime.UtcNow;}+ _itemRepository.SaveItems(items, cancellationToken);+if (ItemUpdated is not null){foreach (var item in items)@@ -2097,8 +2101,6 @@ namespace Emby.Server.Implementations.Libraryawait ProviderManager.SaveMetadataAsync(item, updateReason).ConfigureAwait(false);}- item.DateLastSaved = DateTime.UtcNow;-await UpdateImagesAsync(item, updateReason >= ItemUpdateType.ImageUpdate).ConfigureAwait(false);}@@ -2384,12 +2386,13 @@ namespace Emby.Server.Implementations.LibraryisNew = true;}- var refresh = isNew || DateTime.UtcNow - item.DateLastRefreshed >= _viewRefreshInterval;+ var lastRefreshedUtc = item.DateLastRefreshed;+ var refresh = isNew || DateTime.UtcNow - lastRefreshedUtc >= _viewRefreshInterval;if (!refresh && !item.DisplayParentId.IsEmpty()){var displayParent = GetItemById(item.DisplayParentId);- refresh = displayParent is not null && displayParent.DateLastSaved > item.DateLastRefreshed;+ refresh = displayParent is not null && displayParent.DateLastSaved > lastRefreshedUtc;}if (refresh)@@ -2447,12 +2450,13 @@ namespace Emby.Server.Implementations.LibraryisNew = true;}- var refresh = isNew || DateTime.UtcNow - item.DateLastRefreshed >= _viewRefreshInterval;+ var lastRefreshedUtc = item.DateLastRefreshed;+ var refresh = isNew || DateTime.UtcNow - lastRefreshedUtc >= _viewRefreshInterval;if (!refresh && !item.DisplayParentId.IsEmpty()){var displayParent = GetItemById(item.DisplayParentId);- refresh = displayParent is not null && displayParent.DateLastSaved > item.DateLastRefreshed;+ refresh = displayParent is not null && displayParent.DateLastSaved > lastRefreshedUtc;}if (refresh)@@ -2522,12 +2526,13 @@ namespace Emby.Server.Implementations.Libraryitem.UpdateToRepositoryAsync(ItemUpdateType.MetadataEdit, CancellationToken.None).GetAwaiter().GetResult();}- var refresh = isNew || DateTime.UtcNow - item.DateLastRefreshed >= _viewRefreshInterval;+ var lastRefreshedUtc = item.DateLastRefreshed;+ var refresh = isNew || DateTime.UtcNow - lastRefreshedUtc >= _viewRefreshInterval;if (!refresh && !item.DisplayParentId.IsEmpty()){var displayParent = GetItemById(item.DisplayParentId);- refresh = displayParent is not null && displayParent.DateLastSaved > item.DateLastRefreshed;+ refresh = displayParent is not null && displayParent.DateLastSaved > lastRefreshedUtc;}if (refresh)@@ -2991,13 +2996,12 @@ namespace Emby.Server.Implementations.Library{var path = Person.GetPath(person.Name);var info = Directory.CreateDirectory(path);- var lastWriteTime = info.LastWriteTimeUtc;personEntity = new Person(){Name = person.Name,Id = GetItemByNameId<Person>(path),DateCreated = info.CreationTimeUtc,- DateModified = lastWriteTime,+ DateModified = info.LastWriteTimeUtc,Path = path};diff --git a/Emby.Server.Implementations/Library/ResolverHelper.cs b/Emby.Server.Implementations/Library/ResolverHelper.csindex ab6bc49073..06aa772bd9 100644--- a/Emby.Server.Implementations/Library/ResolverHelper.cs+++ b/Emby.Server.Implementations/Library/ResolverHelper.cs@@ -140,7 +140,7 @@ namespace Emby.Server.Implementations.Libraryif (fileCreationDate is not null){var dateCreated = fileCreationDate;- if (dateCreated.Equals(DateTime.MinValue))+ if (dateCreated == DateTime.MinValue){dateCreated = DateTime.UtcNow;}diff --git a/Emby.Server.Implementations/Plugins/PluginManager.cs b/Emby.Server.Implementations/Plugins/PluginManager.csindex 8eeca3667e..91ccb16ef9 100644--- a/Emby.Server.Implementations/Plugins/PluginManager.cs+++ b/Emby.Server.Implementations/Plugins/PluginManager.cs@@ -423,7 +423,7 @@ namespace Emby.Server.Implementations.PluginsOverview = packageInfo.Overview,Owner = packageInfo.Owner,TargetAbi = versionInfo.TargetAbi ?? string.Empty,- Timestamp = string.IsNullOrEmpty(versionInfo.Timestamp) ? DateTime.MinValue : DateTime.Parse(versionInfo.Timestamp, CultureInfo.InvariantCulture),+ Timestamp = string.IsNullOrEmpty(versionInfo.Timestamp) ? DateTime.MinValue : DateTime.Parse(versionInfo.Timestamp, CultureInfo.InvariantCulture, DateTimeStyles.AdjustToUniversal),Version = versionInfo.Version,Status = status == PluginStatus.Disabled ? PluginStatus.Disabled : PluginStatus.Active, // Keep disabled state.AutoUpdate = true,diff --git a/Emby.Server.Implementations/Sorting/StartDateComparer.cs b/Emby.Server.Implementations/Sorting/StartDateComparer.csindex e0b438ef1a..861ca2d3a0 100644--- a/Emby.Server.Implementations/Sorting/StartDateComparer.cs+++ b/Emby.Server.Implementations/Sorting/StartDateComparer.cs@@ -5,7 +5,6 @@ using Jellyfin.Data.Enums;using MediaBrowser.Controller.Entities;using MediaBrowser.Controller.LiveTv;using MediaBrowser.Controller.Sorting;-using MediaBrowser.Model.Querying;namespace Emby.Server.Implementations.Sorting{diff --git a/Jellyfin.Server.Implementations/Item/BaseItemRepository.cs b/Jellyfin.Server.Implementations/Item/BaseItemRepository.csindex e1e7e1a074..52585c996a 100644--- a/Jellyfin.Server.Implementations/Item/BaseItemRepository.cs+++ b/Jellyfin.Server.Implementations/Item/BaseItemRepository.cs@@ -540,7 +540,7 @@ public sealed class BaseItemRepository}var itemValueMaps = tuples- .Select(e => (Item: e.Item, Values: GetItemValuesToSave(e.Item, e.InheritedTags)))+ .Select(e => (e.Item, Values: GetItemValuesToSave(e.Item, e.InheritedTags))).ToArray();var allListedItemValues = itemValueMaps.SelectMany(f => f.Values)@@ -567,7 +567,7 @@ public sealed class BaseItemRepositoryvar itemValuesStore = existingValues.Concat(missingItemValues).ToArray();var valueMap = itemValueMaps- .Select(f => (Item: f.Item, Values: f.Values.Select(e => itemValuesStore.First(g => g.Value == e.Value && g.Type == e.MagicNumber)).ToArray()))+ .Select(f => (f.Item, Values: f.Values.Select(e => itemValuesStore.First(g => g.Value == e.Value && g.Type == e.MagicNumber)).ToArray())).ToArray();var mappedValues = context.ItemValuesMap.Where(e => ids.Contains(e.ItemId)).ToList();@@ -702,11 +702,11 @@ public sealed class BaseItemRepositorydto.ExternalId = entity.ExternalId;dto.Size = entity.Size;dto.Genres = string.IsNullOrWhiteSpace(entity.Genres) ? [] : entity.Genres.Split('|');- dto.DateCreated = entity.DateCreated.GetValueOrDefault();- dto.DateModified = entity.DateModified.GetValueOrDefault();+ dto.DateCreated = entity.DateCreated ?? DateTime.SpecifyKind(DateTime.MinValue, DateTimeKind.Utc);+ dto.DateModified = entity.DateModified ?? DateTime.SpecifyKind(DateTime.MinValue, DateTimeKind.Utc);dto.ChannelId = entity.ChannelId ?? Guid.Empty;- dto.DateLastRefreshed = entity.DateLastRefreshed.GetValueOrDefault();- dto.DateLastSaved = entity.DateLastSaved.GetValueOrDefault();+ dto.DateLastRefreshed = entity.DateLastRefreshed ?? DateTime.SpecifyKind(DateTime.MinValue, DateTimeKind.Utc);+ dto.DateLastSaved = entity.DateLastSaved ?? DateTime.SpecifyKind(DateTime.MinValue, DateTimeKind.Utc);dto.OwnerId = string.IsNullOrWhiteSpace(entity.OwnerId) ? Guid.Empty : (Guid.TryParse(entity.OwnerId, out var ownerId) ? ownerId : Guid.Empty);dto.Width = entity.Width.GetValueOrDefault();dto.Height = entity.Height.GetValueOrDefault();@@ -807,7 +807,7 @@ public sealed class BaseItemRepositoryif (dto is Folder folder){- folder.DateLastMediaAdded = entity.DateLastMediaAdded;+ folder.DateLastMediaAdded = entity.DateLastMediaAdded ?? DateTime.SpecifyKind(DateTime.MinValue, DateTimeKind.Utc);}return dto;@@ -867,11 +867,11 @@ public sealed class BaseItemRepositoryentity.ExternalId = dto.ExternalId;entity.Size = dto.Size;entity.Genres = string.Join('|', dto.Genres);- entity.DateCreated = dto.DateCreated;- entity.DateModified = dto.DateModified;+ entity.DateCreated = dto.DateCreated == DateTime.MinValue ? null : dto.DateCreated;+ entity.DateModified = dto.DateModified == DateTime.MinValue ? null : dto.DateModified;entity.ChannelId = dto.ChannelId;- entity.DateLastRefreshed = dto.DateLastRefreshed;- entity.DateLastSaved = dto.DateLastSaved;+ entity.DateLastRefreshed = dto.DateLastRefreshed == DateTime.MinValue ? null : dto.DateLastRefreshed;+ entity.DateLastSaved = dto.DateLastSaved == DateTime.MinValue ? null : dto.DateLastSaved;entity.OwnerId = dto.OwnerId.ToString();entity.Width = dto.Width;entity.Height = dto.Height;@@ -981,7 +981,7 @@ public sealed class BaseItemRepositoryif (dto is Folder folder){- entity.DateLastMediaAdded = folder.DateLastMediaAdded;+ entity.DateLastMediaAdded = folder.DateLastMediaAdded == DateTime.MinValue ? null : folder.DateLastMediaAdded;entity.IsFolder = folder.IsFolder;}@@ -1302,7 +1302,7 @@ public sealed class BaseItemRepository{Path = appHost?.ExpandVirtualPath(e.Path) ?? e.Path,BlurHash = e.Blurhash is null ? null : Encoding.UTF8.GetString(e.Blurhash),- DateModified = e.DateModified,+ DateModified = e.DateModified ?? DateTime.SpecifyKind(DateTime.MinValue, DateTimeKind.Utc),Height = e.Height,Width = e.Width,Type = (ImageType)e.ImageTypediff --git a/Jellyfin.Server/Migrations/Routines/FixDates.cs b/Jellyfin.Server/Migrations/Routines/FixDates.csnew file mode 100644index 0000000000..f112502b9f--- /dev/null+++ b/Jellyfin.Server/Migrations/Routines/FixDates.cs@@ -0,0 +1,168 @@+using System;+using System.Diagnostics;+using System.Linq;+using System.Threading;+using System.Threading.Tasks;+using Jellyfin.Database.Implementations;+using Jellyfin.Server.ServerSetupApp;+using Microsoft.EntityFrameworkCore;+using Microsoft.Extensions.Logging;++namespace Jellyfin.Server.Migrations.Routines;++/// <summary>+/// Migration to fix dates saved in the database to always be UTC.+/// </summary>+[JellyfinMigration("2025-06-20T18:00:00", nameof(FixDates))]+public class FixDates : IAsyncMigrationRoutine+{+ private const int PageSize = 5000;++ private readonly ILogger _logger;+ private readonly IDbContextFactory<JellyfinDbContext> _dbProvider;++ /// <summary>+ /// Initializes a new instance of the <see cref="FixDates"/> class.+ /// </summary>+ /// <param name="logger">The logger.</param>+ /// <param name="startupLogger">The startup logger for Startup UI integration.</param>+ /// <param name="dbProvider">Instance of the <see cref="IDbContextFactory{JellyfinDbContext}"/> interface.</param>+ public FixDates(+ ILogger<FixDates> logger,+ IStartupLogger<FixDates> startupLogger,+ IDbContextFactory<JellyfinDbContext> dbProvider)+ {+ _logger = startupLogger.With(logger);+ _dbProvider = dbProvider;+ }++ /// <inheritdoc />+ public async Task PerformAsync(CancellationToken cancellationToken)+ {+ if (!TimeZoneInfo.Local.Equals(TimeZoneInfo.Utc))+ {+ using var context = await _dbProvider.CreateDbContextAsync(cancellationToken).ConfigureAwait(false);+ var sw = Stopwatch.StartNew();++ await FixBaseItemsAsync(context, sw, cancellationToken).ConfigureAwait(false);+ sw.Reset();+ await FixChaptersAsync(context, sw, cancellationToken).ConfigureAwait(false);+ sw.Reset();+ await FixBaseItemImageInfos(context, sw, cancellationToken).ConfigureAwait(false);+ }+ }++ private async Task FixBaseItemsAsync(JellyfinDbContext context, Stopwatch sw, CancellationToken cancellationToken)+ {+ int itemCount = 0;++ var baseQuery = context.BaseItems.OrderBy(e => e.Id);+ var records = baseQuery.Count();+ _logger.LogInformation("Fixing dates for {Count} BaseItems.", records);++ sw.Start();+ await foreach (var result in context.BaseItems.OrderBy(e => e.Id)+ .WithPartitionProgress(+ (partition) =>+ _logger.LogInformation(+ "Processing BaseItems batch {BatchNumber} ({ProcessedSoFar}/{TotalRecords}) - Time: {ElapsedTime}",+ partition + 1,+ Math.Min((partition + 1) * PageSize, records),+ records,+ sw.Elapsed))+ .PartitionEagerAsync(PageSize, cancellationToken)+ .WithCancellation(cancellationToken)+ .ConfigureAwait(false))+ {+ result.DateCreated = ToUniversalTime(result.DateCreated);+ result.DateLastMediaAdded = ToUniversalTime(result.DateLastMediaAdded);+ result.DateLastRefreshed = ToUniversalTime(result.DateLastRefreshed);+ result.DateLastSaved = ToUniversalTime(result.DateLastSaved);+ result.DateModified = ToUniversalTime(result.DateModified);+ itemCount++;+ }++ var saveCount = await context.SaveChangesAsync(cancellationToken).ConfigureAwait(false);+ _logger.LogInformation("BaseItems: Processed {ItemCount} items, saved {SaveCount} changes in {ElapsedTime}", itemCount, saveCount, sw.Elapsed);+ }++ private async Task FixChaptersAsync(JellyfinDbContext context, Stopwatch sw, CancellationToken cancellationToken)+ {+ int itemCount = 0;++ var baseQuery = context.Chapters;+ var records = baseQuery.Count();+ _logger.LogInformation("Fixing dates for {Count} Chapters.", records);++ sw.Start();+ await foreach (var result in context.Chapters.OrderBy(e => e.ItemId)+ .WithPartitionProgress(+ (partition) =>+ _logger.LogInformation(+ "Processing Chapter batch {BatchNumber} ({ProcessedSoFar}/{TotalRecords}) - Time: {ElapsedTime}",+ partition + 1,+ Math.Min((partition + 1) * PageSize, records),+ records,+ sw.Elapsed))+ .PartitionEagerAsync(PageSize, cancellationToken)+ .WithCancellation(cancellationToken)+ .ConfigureAwait(false))+ {+ result.ImageDateModified = ToUniversalTime(result.ImageDateModified, true);+ itemCount++;+ }++ var saveCount = await context.SaveChangesAsync(cancellationToken).ConfigureAwait(false);+ _logger.LogInformation("Chapters: Processed {ItemCount} items, saved {SaveCount} changes in {ElapsedTime}", itemCount, saveCount, sw.Elapsed);+ }++ private async Task FixBaseItemImageInfos(JellyfinDbContext context, Stopwatch sw, CancellationToken cancellationToken)+ {+ int itemCount = 0;++ var baseQuery = context.BaseItemImageInfos;+ var records = baseQuery.Count();+ _logger.LogInformation("Fixing dates for {Count} BaseItemImageInfos.", records);++ sw.Start();+ await foreach (var result in context.BaseItemImageInfos.OrderBy(e => e.Id)+ .WithPartitionProgress(+ (partition) =>+ _logger.LogInformation(+ "Processing BaseItemImageInfos batch {BatchNumber} ({ProcessedSoFar}/{TotalRecords}) - Time: {ElapsedTime}",+ partition + 1,+ Math.Min((partition + 1) * PageSize, records),+ records,+ sw.Elapsed))+ .PartitionEagerAsync(PageSize, cancellationToken)+ .WithCancellation(cancellationToken)+ .ConfigureAwait(false))+ {+ result.DateModified = ToUniversalTime(result.DateModified);+ itemCount++;+ }++ var saveCount = await context.SaveChangesAsync(cancellationToken).ConfigureAwait(false);+ _logger.LogInformation("BaseItemImageInfos: Processed {ItemCount} items, saved {SaveCount} changes in {ElapsedTime}", itemCount, saveCount, sw.Elapsed);+ }++ private DateTime? ToUniversalTime(DateTime? dateTime, bool isUTC = false)+ {+ if (dateTime is null)+ {+ return null;+ }++ if (dateTime.Value.Year == 1 && dateTime.Value.Month == 1 && dateTime.Value.Day == 1)+ {+ return null;+ }++ if (dateTime.Value.Kind == DateTimeKind.Utc || isUTC)+ {+ return dateTime.Value;+ }++ return dateTime.Value.ToUniversalTime();+ }+}diff --git a/MediaBrowser.Controller/Entities/BaseItem.cs b/MediaBrowser.Controller/Entities/BaseItem.csindex 96984758f8..4efa3f410d 100644--- a/MediaBrowser.Controller/Entities/BaseItem.cs+++ b/MediaBrowser.Controller/Entities/BaseItem.cs@@ -1423,23 +1423,16 @@ namespace MediaBrowser.Controller.Entitiespublic virtual bool RequiresRefresh(){- if (string.IsNullOrEmpty(Path) || DateModified == default)+ if (string.IsNullOrEmpty(Path) || DateModified == DateTime.MinValue){return false;}var info = FileSystem.GetFileSystemInfo(Path);- if (info.Exists)- {- if (info.IsDirectory)- {- return info.LastWriteTimeUtc != DateModified;- }- return info.LastWriteTimeUtc != DateModified;- }-- return false;+ return info.Exists+ ? info.LastWriteTimeUtc != DateModified+ : false;}public virtual List<string> GetUserDataKeys()diff --git a/MediaBrowser.LocalMetadata/Savers/BaseXmlSaver.cs b/MediaBrowser.LocalMetadata/Savers/BaseXmlSaver.csindex c25adb7746..025a815247 100644--- a/MediaBrowser.LocalMetadata/Savers/BaseXmlSaver.cs+++ b/MediaBrowser.LocalMetadata/Savers/BaseXmlSaver.cs@@ -235,11 +235,11 @@ namespace MediaBrowser.LocalMetadata.Savers{if (item is Person){- await writer.WriteElementStringAsync(null, "DeathDate", null, item.EndDate.Value.ToLocalTime().ToString("yyyy-MM-dd", CultureInfo.InvariantCulture)).ConfigureAwait(false);+ await writer.WriteElementStringAsync(null, "DeathDate", null, item.EndDate.Value.ToString("yyyy-MM-dd", CultureInfo.InvariantCulture)).ConfigureAwait(false);}else if (item is not Episode){- await writer.WriteElementStringAsync(null, "EndDate", null, item.EndDate.Value.ToLocalTime().ToString("yyyy-MM-dd", CultureInfo.InvariantCulture)).ConfigureAwait(false);+ await writer.WriteElementStringAsync(null, "EndDate", null, item.EndDate.Value.ToString("yyyy-MM-dd", CultureInfo.InvariantCulture)).ConfigureAwait(false);}}diff --git a/MediaBrowser.Providers/Manager/MetadataService.cs b/MediaBrowser.Providers/Manager/MetadataService.csindex cd95bf6ef1..5c855328b8 100644--- a/MediaBrowser.Providers/Manager/MetadataService.cs+++ b/MediaBrowser.Providers/Manager/MetadataService.cs@@ -73,11 +73,11 @@ namespace MediaBrowser.Providers.Managerpublic virtual int Order => 0;- private FileSystemMetadata TryGetFile(string path, IDirectoryService directoryService)+ private FileSystemMetadata TryGetFileSystemMetadata(string path, IDirectoryService directoryService){try{- return directoryService.GetFile(path);+ return directoryService.GetFileSystemEntry(path);}catch (Exception ex){@@ -92,7 +92,7 @@ namespace MediaBrowser.Providers.Managervar updateType = ItemUpdateType.None;var libraryOptions = LibraryManager.GetLibraryOptions(item);- var isFirstRefresh = item.DateLastRefreshed.Date == DateTime.MinValue.Date;+ var isFirstRefresh = item.DateLastRefreshed == DateTime.MinValue;var hasRefreshedMetadata = true;var hasRefreshedImages = true;@@ -225,7 +225,7 @@ namespace MediaBrowser.Providers.Manager{if (item.IsFileProtocol){- var file = TryGetFile(item.Path, refreshOptions.DirectoryService);+ var file = TryGetFileSystemMetadata(item.Path, refreshOptions.DirectoryService);if (file is not null){item.DateModified = file.LastWriteTimeUtc;@@ -1180,12 +1180,12 @@ namespace MediaBrowser.Providers.Managertarget.LockedFields = target.LockedFields.Concat(source.LockedFields).Distinct().ToArray();}- if (source.DateCreated != default)+ if (source.DateCreated != DateTime.MinValue){target.DateCreated = source.DateCreated;}- if (replaceData || source.DateModified != default)+ if (replaceData || source.DateModified != DateTime.MinValue){target.DateModified = source.DateModified;}diff --git a/MediaBrowser.Providers/Manager/ProviderManager.cs b/MediaBrowser.Providers/Manager/ProviderManager.csindex 1a29548f24..87ca728d38 100644--- a/MediaBrowser.Providers/Manager/ProviderManager.cs+++ b/MediaBrowser.Providers/Manager/ProviderManager.cs@@ -669,8 +669,13 @@ namespace MediaBrowser.Providers.Managerprivate async Task SaveMetadataAsync(BaseItem item, ItemUpdateType updateType, IEnumerable<IMetadataSaver> savers){var libraryOptions = _libraryManager.GetLibraryOptions(item);+ var applicableSavers = savers.Where(i => IsSaverEnabledForItem(i, item, libraryOptions, updateType, false)).ToList();+ if (applicableSavers.Count == 0)+ {+ return;+ }- foreach (var saver in savers.Where(i => IsSaverEnabledForItem(i, item, libraryOptions, updateType, false)))+ foreach (var saver in applicableSavers){_logger.LogDebug("Saving {Item} to {Saver}", item.Path ?? item.Name, saver.Name);@@ -714,6 +719,8 @@ namespace MediaBrowser.Providers.Manager}}}++ _libraryManager.CreateItem(item, null);}/// <summary>diff --git a/MediaBrowser.XbmcMetadata/Providers/BaseNfoProvider.cs b/MediaBrowser.XbmcMetadata/Providers/BaseNfoProvider.csindex 22c065b5d4..c671e7a932 100644--- a/MediaBrowser.XbmcMetadata/Providers/BaseNfoProvider.cs+++ b/MediaBrowser.XbmcMetadata/Providers/BaseNfoProvider.cs@@ -1,5 +1,6 @@#pragma warning disable CS1591+using System;using System.IO;using System.Threading;using System.Threading.Tasks;diff --git a/src/Jellyfin.Database/Jellyfin.Database.Implementations/Entities/BaseItemImageInfo.cs b/src/Jellyfin.Database/Jellyfin.Database.Implementations/Entities/BaseItemImageInfo.csindex 71d60fc25d..cd14764e49 100644--- a/src/Jellyfin.Database/Jellyfin.Database.Implementations/Entities/BaseItemImageInfo.cs+++ b/src/Jellyfin.Database/Jellyfin.Database.Implementations/Entities/BaseItemImageInfo.cs@@ -22,7 +22,7 @@ public class BaseItemImageInfo/// <summary>/// Gets or Sets the time the image was last modified./// </summary>- public DateTime DateModified { get; set; }+ public DateTime? DateModified { get; set; }/// <summary>/// Gets or Sets the imagetype.diff --git a/src/Jellyfin.Database/Jellyfin.Database.Implementations/QueryPartitionHelpers.cs b/src/Jellyfin.Database/Jellyfin.Database.Implementations/QueryPartitionHelpers.csindex bb66bddca3..c20dfeeb5a 100644--- a/src/Jellyfin.Database/Jellyfin.Database.Implementations/QueryPartitionHelpers.cs+++ b/src/Jellyfin.Database/Jellyfin.Database.Implementations/QueryPartitionHelpers.cs@@ -82,7 +82,7 @@ public static class QueryPartitionHelpers/// <typeparam name="TEntity">The entity to load.</typeparam>/// <param name="partitionInfo">The source query.</param>/// <param name="partitionSize">The number of elements to load per partition.</param>- /// <param name="cancellationToken">The cancelation token.</param>+ /// <param name="cancellationToken">The cancellation token.</param>/// <returns>A enumerable representing the whole of the query.</returns>public static async IAsyncEnumerable<TEntity> PartitionAsync<TEntity>(this ProgressablePartitionReporting<TEntity> partitionInfo, int partitionSize, [EnumeratorCancellation] CancellationToken cancellationToken = default){@@ -98,7 +98,7 @@ public static class QueryPartitionHelpers/// <typeparam name="TEntity">The entity to load.</typeparam>/// <param name="partitionInfo">The source query.</param>/// <param name="partitionSize">The number of elements to load per partition.</param>- /// <param name="cancellationToken">The cancelation token.</param>+ /// <param name="cancellationToken">The cancellation token.</param>/// <returns>A enumerable representing the whole of the query.</returns>public static async IAsyncEnumerable<TEntity> PartitionEagerAsync<TEntity>(this ProgressablePartitionReporting<TEntity> partitionInfo, int partitionSize, [EnumeratorCancellation] CancellationToken cancellationToken = default){@@ -115,7 +115,7 @@ public static class QueryPartitionHelpers/// <param name="query">The source query.</param>/// <param name="partitionSize">The number of elements to load per partition.</param>/// <param name="progressablePartition">Reporting helper.</param>- /// <param name="cancellationToken">The cancelation token.</param>+ /// <param name="cancellationToken">The cancellation token.</param>/// <returns>A enumerable representing the whole of the query.</returns>public static async IAsyncEnumerable<TEntity> PartitionAsync<TEntity>(this IOrderedQueryable<TEntity> query,@@ -154,7 +154,7 @@ public static class QueryPartitionHelpers/// <param name="query">The source query.</param>/// <param name="partitionSize">The number of elements to load per partition.</param>/// <param name="progressablePartition">Reporting helper.</param>- /// <param name="cancellationToken">The cancelation token.</param>+ /// <param name="cancellationToken">The cancellation token.</param>/// <returns>A enumerable representing the whole of the query.</returns>public static async IAsyncEnumerable<TEntity> PartitionEagerAsync<TEntity>(this IOrderedQueryable<TEntity> query,diff --git a/src/Jellyfin.Database/Jellyfin.Database.Providers.Sqlite/Migrations/20250622170802_BaseItemImageInfoDateModifiedNullable.Designer.cs b/src/Jellyfin.Database/Jellyfin.Database.Providers.Sqlite/Migrations/20250622170802_BaseItemImageInfoDateModifiedNullable.Designer.csnew file mode 100644index 0000000000..a0622c14d5--- /dev/null+++ b/src/Jellyfin.Database/Jellyfin.Database.Providers.Sqlite/Migrations/20250622170802_BaseItemImageInfoDateModifiedNullable.Designer.cs@@ -0,0 +1,1709 @@+// <auto-generated />+using System;+using Jellyfin.Database.Implementations;+using Microsoft.EntityFrameworkCore;+using Microsoft.EntityFrameworkCore.Infrastructure;+using Microsoft.EntityFrameworkCore.Migrations;+using Microsoft.EntityFrameworkCore.Storage.ValueConversion;++#nullable disable++namespace Jellyfin.Server.Implementations.Migrations+{+ [DbContext(typeof(JellyfinDbContext))]+ [Migration("20250622170802_BaseItemImageInfoDateModifiedNullable")]+ partial class BaseItemImageInfoDateModifiedNullable+ {+ /// <inheritdoc />+ protected override void BuildTargetModel(ModelBuilder modelBuilder)+ {+#pragma warning disable 612, 618+ modelBuilder.HasAnnotation("ProductVersion", "9.0.6");++ modelBuilder.Entity("Jellyfin.Database.Implementations.Entities.AccessSchedule", b =>+ {+ b.Property<int>("Id")+ .ValueGeneratedOnAdd()+ .HasColumnType("INTEGER");++ b.Property<int>("DayOfWeek")+ .HasColumnType("INTEGER");++ b.Property<double>("EndHour")+ .HasColumnType("REAL");++ b.Property<double>("StartHour")+ .HasColumnType("REAL");++ b.Property<Guid>("UserId")+ .HasColumnType("TEXT");++ b.HasKey("Id");++ b.HasIndex("UserId");++ b.ToTable("AccessSchedules");++ b.HasAnnotation("Sqlite:UseSqlReturningClause", false);+ });++ modelBuilder.Entity("Jellyfin.Database.Implementations.Entities.ActivityLog", b =>+ {+ b.Property<int>("Id")+ .ValueGeneratedOnAdd()+ .HasColumnType("INTEGER");++ b.Property<DateTime>("DateCreated")+ .HasColumnType("TEXT");++ b.Property<string>("ItemId")+ .HasMaxLength(256)+ .HasColumnType("TEXT");++ b.Property<int>("LogSeverity")+ .HasColumnType("INTEGER");++ b.Property<string>("Name")+ .IsRequired()+ .HasMaxLength(512)+ .HasColumnType("TEXT");++ b.Property<string>("Overview")+ .HasMaxLength(512)+ .HasColumnType("TEXT");++ b.Property<uint>("RowVersion")+ .IsConcurrencyToken()+ .HasColumnType("INTEGER");++ b.Property<string>("ShortOverview")+ .HasMaxLength(512)+ .HasColumnType("TEXT");++ b.Property<string>("Type")+ .IsRequired()+ .HasMaxLength(256)+ .HasColumnType("TEXT");++ b.Property<Guid>("UserId")+ .HasColumnType("TEXT");++ b.HasKey("Id");++ b.HasIndex("DateCreated");++ b.ToTable("ActivityLogs");++ b.HasAnnotation("Sqlite:UseSqlReturningClause", false);+ });++ modelBuilder.Entity("Jellyfin.Database.Implementations.Entities.AncestorId", b =>+ {+ b.Property<Guid>("ItemId")+ .HasColumnType("TEXT");++ b.Property<Guid>("ParentItemId")+ .HasColumnType("TEXT");++ b.HasKey("ItemId", "ParentItemId");++ b.HasIndex("ParentItemId");++ b.ToTable("AncestorIds");++ b.HasAnnotation("Sqlite:UseSqlReturningClause", false);+ });++ modelBuilder.Entity("Jellyfin.Database.Implementations.Entities.AttachmentStreamInfo", b =>+ {+ b.Property<Guid>("ItemId")+ .HasColumnType("TEXT");++ b.Property<int>("Index")+ .HasColumnType("INTEGER");++ b.Property<string>("Codec")+ .HasColumnType("TEXT");++ b.Property<string>("CodecTag")+ .HasColumnType("TEXT");++ b.Property<string>("Comment")+ .HasColumnType("TEXT");++ b.Property<string>("Filename")+ .HasColumnType("TEXT");++ b.Property<string>("MimeType")+ .HasColumnType("TEXT");++ b.HasKey("ItemId", "Index");++ b.ToTable("AttachmentStreamInfos");++ b.HasAnnotation("Sqlite:UseSqlReturningClause", false);+ });++ modelBuilder.Entity("Jellyfin.Database.Implementations.Entities.BaseItemEntity", b =>+ {+ b.Property<Guid>("Id")+ .ValueGeneratedOnAdd()+ .HasColumnType("TEXT");++ b.Property<string>("Album")+ .HasColumnType("TEXT");++ b.Property<string>("AlbumArtists")+ .HasColumnType("TEXT");++ b.Property<string>("Artists")+ .HasColumnType("TEXT");++ b.Property<int?>("Audio")+ .HasColumnType("INTEGER");++ b.Property<Guid?>("ChannelId")+ .HasColumnType("TEXT");++ b.Property<string>("CleanName")+ .HasColumnType("TEXT");++ b.Property<float?>("CommunityRating")+ .HasColumnType("REAL");++ b.Property<float?>("CriticRating")+ .HasColumnType("REAL");++ b.Property<string>("CustomRating")+ .HasColumnType("TEXT");++ b.Property<string>("Data")+ .HasColumnType("TEXT");++ b.Property<DateTime?>("DateCreated")+ .HasColumnType("TEXT");++ b.Property<DateTime?>("DateLastMediaAdded")+ .HasColumnType("TEXT");++ b.Property<DateTime?>("DateLastRefreshed")+ .HasColumnType("TEXT");++ b.Property<DateTime?>("DateLastSaved")+ .HasColumnType("TEXT");++ b.Property<DateTime?>("DateModified")+ .HasColumnType("TEXT");++ b.Property<DateTime?>("EndDate")+ .HasColumnType("TEXT");++ b.Property<string>("EpisodeTitle")+ .HasColumnType("TEXT");++ b.Property<string>("ExternalId")+ .HasColumnType("TEXT");++ b.Property<string>("ExternalSeriesId")+ .HasColumnType("TEXT");++ b.Property<string>("ExternalServiceId")+ .HasColumnType("TEXT");++ b.Property<string>("ExtraIds")+ .HasColumnType("TEXT");++ b.Property<int?>("ExtraType")+ .HasColumnType("INTEGER");++ b.Property<string>("ForcedSortName")+ .HasColumnType("TEXT");++ b.Property<string>("Genres")+ .HasColumnType("TEXT");++ b.Property<int?>("Height")+ .HasColumnType("INTEGER");++ b.Property<int?>("IndexNumber")+ .HasColumnType("INTEGER");++ b.Property<int?>("InheritedParentalRatingSubValue")+ .HasColumnType("INTEGER");++ b.Property<int?>("InheritedParentalRatingValue")+ .HasColumnType("INTEGER");++ b.Property<bool>("IsFolder")+ .HasColumnType("INTEGER");++ b.Property<bool>("IsInMixedFolder")+ .HasColumnType("INTEGER");++ b.Property<bool>("IsLocked")+ .HasColumnType("INTEGER");++ b.Property<bool>("IsMovie")+ .HasColumnType("INTEGER");++ b.Property<bool>("IsRepeat")+ .HasColumnType("INTEGER");++ b.Property<bool>("IsSeries")+ .HasColumnType("INTEGER");++ b.Property<bool>("IsVirtualItem")+ .HasColumnType("INTEGER");++ b.Property<float?>("LUFS")+ .HasColumnType("REAL");++ b.Property<string>("MediaType")+ .HasColumnType("TEXT");++ b.Property<string>("Name")+ .HasColumnType("TEXT");++ b.Property<float?>("NormalizationGain")+ .HasColumnType("REAL");++ b.Property<string>("OfficialRating")+ .HasColumnType("TEXT");++ b.Property<string>("OriginalTitle")+ .HasColumnType("TEXT");++ b.Property<string>("Overview")+ .HasColumnType("TEXT");++ b.Property<string>("OwnerId")+ .HasColumnType("TEXT");++ b.Property<Guid?>("ParentId")+ .HasColumnType("TEXT");++ b.Property<int?>("ParentIndexNumber")+ .HasColumnType("INTEGER");++ b.Property<string>("Path")+ .HasColumnType("TEXT");++ b.Property<string>("PreferredMetadataCountryCode")+ .HasColumnType("TEXT");++ b.Property<string>("PreferredMetadataLanguage")+ .HasColumnType("TEXT");++ b.Property<DateTime?>("PremiereDate")+ .HasColumnType("TEXT");++ b.Property<string>("PresentationUniqueKey")+ .HasColumnType("TEXT");++ b.Property<string>("PrimaryVersionId")+ .HasColumnType("TEXT");++ b.Property<string>("ProductionLocations")+ .HasColumnType("TEXT");++ b.Property<int?>("ProductionYear")+ .HasColumnType("INTEGER");++ b.Property<long?>("RunTimeTicks")+ .HasColumnType("INTEGER");++ b.Property<Guid?>("SeasonId")+ .HasColumnType("TEXT");++ b.Property<string>("SeasonName")+ .HasColumnType("TEXT");++ b.Property<Guid?>("SeriesId")+ .HasColumnType("TEXT");++ b.Property<string>("SeriesName")+ .HasColumnType("TEXT");++ b.Property<string>("SeriesPresentationUniqueKey")+ .HasColumnType("TEXT");++ b.Property<string>("ShowId")+ .HasColumnType("TEXT");++ b.Property<long?>("Size")+ .HasColumnType("INTEGER");++ b.Property<string>("SortName")+ .HasColumnType("TEXT");++ b.Property<DateTime?>("StartDate")+ .HasColumnType("TEXT");++ b.Property<string>("Studios")+ .HasColumnType("TEXT");++ b.Property<string>("Tagline")+ .HasColumnType("TEXT");++ b.Property<string>("Tags")+ .HasColumnType("TEXT");++ b.Property<Guid?>("TopParentId")+ .HasColumnType("TEXT");++ b.Property<int?>("TotalBitrate")+ .HasColumnType("INTEGER");++ b.Property<string>("Type")+ .IsRequired()+ .HasColumnType("TEXT");++ b.Property<string>("UnratedType")+ .HasColumnType("TEXT");++ b.Property<int?>("Width")+ .HasColumnType("INTEGER");++ b.HasKey("Id");++ b.HasIndex("ParentId");++ b.HasIndex("Path");++ b.HasIndex("PresentationUniqueKey");++ b.HasIndex("TopParentId", "Id");++ b.HasIndex("Type", "TopParentId", "Id");++ b.HasIndex("Type", "TopParentId", "PresentationUniqueKey");++ b.HasIndex("Type", "TopParentId", "StartDate");++ b.HasIndex("Id", "Type", "IsFolder", "IsVirtualItem");++ b.HasIndex("MediaType", "TopParentId", "IsVirtualItem", "PresentationUniqueKey");++ b.HasIndex("Type", "SeriesPresentationUniqueKey", "IsFolder", "IsVirtualItem");++ b.HasIndex("Type", "SeriesPresentationUniqueKey", "PresentationUniqueKey", "SortName");++ b.HasIndex("IsFolder", "TopParentId", "IsVirtualItem", "PresentationUniqueKey", "DateCreated");++ b.HasIndex("Type", "TopParentId", "IsVirtualItem", "PresentationUniqueKey", "DateCreated");++ b.ToTable("BaseItems");++ b.HasAnnotation("Sqlite:UseSqlReturningClause", false);++ b.HasData(+ new+ {+ Id = new Guid("00000000-0000-0000-0000-000000000001"),+ IsFolder = false,+ IsInMixedFolder = false,+ IsLocked = false,+ IsMovie = false,+ IsRepeat = false,+ IsSeries = false,+ IsVirtualItem = false,+ Name = "This is a placeholder item for UserData that has been detacted from its original item",+ Type = "PLACEHOLDER"+ });+ });++ modelBuilder.Entity("Jellyfin.Database.Implementations.Entities.BaseItemImageInfo", b =>+ {+ b.Property<Guid>("Id")+ .ValueGeneratedOnAdd()+ .HasColumnType("TEXT");++ b.Property<byte[]>("Blurhash")+ .HasColumnType("BLOB");++ b.Property<DateTime?>("DateModified")+ .HasColumnType("TEXT");++ b.Property<int>("Height")+ .HasColumnType("INTEGER");++ b.Property<int>("ImageType")+ .HasColumnType("INTEGER");++ b.Property<Guid>("ItemId")+ .HasColumnType("TEXT");++ b.Property<string>("Path")+ .IsRequired()+ .HasColumnType("TEXT");++ b.Property<int>("Width")+ .HasColumnType("INTEGER");++ b.HasKey("Id");++ b.HasIndex("ItemId");++ b.ToTable("BaseItemImageInfos");++ b.HasAnnotation("Sqlite:UseSqlReturningClause", false);+ });++ modelBuilder.Entity("Jellyfin.Database.Implementations.Entities.BaseItemMetadataField", b =>+ {+ b.Property<int>("Id")+ .HasColumnType("INTEGER");++ b.Property<Guid>("ItemId")+ .HasColumnType("TEXT");++ b.HasKey("Id", "ItemId");++ b.HasIndex("ItemId");++ b.ToTable("BaseItemMetadataFields");++ b.HasAnnotation("Sqlite:UseSqlReturningClause", false);+ });++ modelBuilder.Entity("Jellyfin.Database.Implementations.Entities.BaseItemProvider", b =>+ {+ b.Property<Guid>("ItemId")+ .HasColumnType("TEXT");++ b.Property<string>("ProviderId")+ .HasColumnType("TEXT");++ b.Property<string>("ProviderValue")+ .IsRequired()+ .HasColumnType("TEXT");++ b.HasKey("ItemId", "ProviderId");++ b.HasIndex("ProviderId", "ProviderValue", "ItemId");++ b.ToTable("BaseItemProviders");++ b.HasAnnotation("Sqlite:UseSqlReturningClause", false);+ });++ modelBuilder.Entity("Jellyfin.Database.Implementations.Entities.BaseItemTrailerType", b =>+ {+ b.Property<int>("Id")+ .HasColumnType("INTEGER");++ b.Property<Guid>("ItemId")+ .HasColumnType("TEXT");++ b.HasKey("Id", "ItemId");++ b.HasIndex("ItemId");++ b.ToTable("BaseItemTrailerTypes");++ b.HasAnnotation("Sqlite:UseSqlReturningClause", false);+ });++ modelBuilder.Entity("Jellyfin.Database.Implementations.Entities.Chapter", b =>+ {+ b.Property<Guid>("ItemId")+ .HasColumnType("TEXT");++ b.Property<int>("ChapterIndex")+ .HasColumnType("INTEGER");++ b.Property<DateTime?>("ImageDateModified")+ .HasColumnType("TEXT");++ b.Property<string>("ImagePath")+ .HasColumnType("TEXT");++ b.Property<string>("Name")+ .HasColumnType("TEXT");++ b.Property<long>("StartPositionTicks")+ .HasColumnType("INTEGER");++ b.HasKey("ItemId", "ChapterIndex");++ b.ToTable("Chapters");++ b.HasAnnotation("Sqlite:UseSqlReturningClause", false);+ });++ modelBuilder.Entity("Jellyfin.Database.Implementations.Entities.CustomItemDisplayPreferences", b =>+ {+ b.Property<int>("Id")+ .ValueGeneratedOnAdd()+ .HasColumnType("INTEGER");++ b.Property<string>("Client")+ .IsRequired()+ .HasMaxLength(32)+ .HasColumnType("TEXT");++ b.Property<Guid>("ItemId")+ .HasColumnType("TEXT");++ b.Property<string>("Key")+ .IsRequired()+ .HasColumnType("TEXT");++ b.Property<Guid>("UserId")+ .HasColumnType("TEXT");++ b.Property<string>("Value")+ .HasColumnType("TEXT");++ b.HasKey("Id");++ b.HasIndex("UserId", "ItemId", "Client", "Key")+ .IsUnique();++ b.ToTable("CustomItemDisplayPreferences");++ b.HasAnnotation("Sqlite:UseSqlReturningClause", false);+ });++ modelBuilder.Entity("Jellyfin.Database.Implementations.Entities.DisplayPreferences", b =>+ {+ b.Property<int>("Id")+ .ValueGeneratedOnAdd()+ .HasColumnType("INTEGER");++ b.Property<int>("ChromecastVersion")+ .HasColumnType("INTEGER");++ b.Property<string>("Client")+ .IsRequired()+ .HasMaxLength(32)+ .HasColumnType("TEXT");++ b.Property<string>("DashboardTheme")+ .HasMaxLength(32)+ .HasColumnType("TEXT");++ b.Property<bool>("EnableNextVideoInfoOverlay")+ .HasColumnType("INTEGER");++ b.Property<int?>("IndexBy")+ .HasColumnType("INTEGER");++ b.Property<Guid>("ItemId")+ .HasColumnType("TEXT");++ b.Property<int>("ScrollDirection")+ .HasColumnType("INTEGER");++ b.Property<bool>("ShowBackdrop")+ .HasColumnType("INTEGER");++ b.Property<bool>("ShowSidebar")+ .HasColumnType("INTEGER");++ b.Property<int>("SkipBackwardLength")+ .HasColumnType("INTEGER");++ b.Property<int>("SkipForwardLength")+ .HasColumnType("INTEGER");++ b.Property<string>("TvHome")+ .HasMaxLength(32)+ .HasColumnType("TEXT");++ b.Property<Guid>("UserId")+ .HasColumnType("TEXT");++ b.HasKey("Id");++ b.HasIndex("UserId", "ItemId", "Client")+ .IsUnique();++ b.ToTable("DisplayPreferences");++ b.HasAnnotation("Sqlite:UseSqlReturningClause", false);+ });++ modelBuilder.Entity("Jellyfin.Database.Implementations.Entities.HomeSection", b =>+ {+ b.Property<int>("Id")+ .ValueGeneratedOnAdd()+ .HasColumnType("INTEGER");++ b.Property<int>("DisplayPreferencesId")+ .HasColumnType("INTEGER");++ b.Property<int>("Order")+ .HasColumnType("INTEGER");++ b.Property<int>("Type")+ .HasColumnType("INTEGER");++ b.HasKey("Id");++ b.HasIndex("DisplayPreferencesId");++ b.ToTable("HomeSection");++ b.HasAnnotation("Sqlite:UseSqlReturningClause", false);+ });++ modelBuilder.Entity("Jellyfin.Database.Implementations.Entities.ImageInfo", b =>+ {+ b.Property<int>("Id")+ .ValueGeneratedOnAdd()+ .HasColumnType("INTEGER");++ b.Property<DateTime>("LastModified")+ .HasColumnType("TEXT");++ b.Property<string>("Path")+ .IsRequired()+ .HasMaxLength(512)+ .HasColumnType("TEXT");++ b.Property<Guid?>("UserId")+ .HasColumnType("TEXT");++ b.HasKey("Id");++ b.HasIndex("UserId")+ .IsUnique();++ b.ToTable("ImageInfos");++ b.HasAnnotation("Sqlite:UseSqlReturningClause", false);+ });++ modelBuilder.Entity("Jellyfin.Database.Implementations.Entities.ItemDisplayPreferences", b =>+ {+ b.Property<int>("Id")+ .ValueGeneratedOnAdd()+ .HasColumnType("INTEGER");++ b.Property<string>("Client")+ .IsRequired()+ .HasMaxLength(32)+ .HasColumnType("TEXT");++ b.Property<int?>("IndexBy")+ .HasColumnType("INTEGER");++ b.Property<Guid>("ItemId")+ .HasColumnType("TEXT");++ b.Property<bool>("RememberIndexing")+ .HasColumnType("INTEGER");++ b.Property<bool>("RememberSorting")+ .HasColumnType("INTEGER");++ b.Property<string>("SortBy")+ .IsRequired()+ .HasMaxLength(64)+ .HasColumnType("TEXT");++ b.Property<int>("SortOrder")+ .HasColumnType("INTEGER");++ b.Property<Guid>("UserId")+ .HasColumnType("TEXT");++ b.Property<int>("ViewType")+ .HasColumnType("INTEGER");++ b.HasKey("Id");++ b.HasIndex("UserId");++ b.ToTable("ItemDisplayPreferences");++ b.HasAnnotation("Sqlite:UseSqlReturningClause", false);+ });++ modelBuilder.Entity("Jellyfin.Database.Implementations.Entities.ItemValue", b =>+ {+ b.Property<Guid>("ItemValueId")+ .ValueGeneratedOnAdd()+ .HasColumnType("TEXT");++ b.Property<string>("CleanValue")+ .IsRequired()+ .HasColumnType("TEXT");++ b.Property<int>("Type")+ .HasColumnType("INTEGER");++ b.Property<string>("Value")+ .IsRequired()+ .HasColumnType("TEXT");++ b.HasKey("ItemValueId");++ b.HasIndex("Type", "CleanValue");++ b.HasIndex("Type", "Value")+ .IsUnique();++ b.ToTable("ItemValues");++ b.HasAnnotation("Sqlite:UseSqlReturningClause", false);+ });++ modelBuilder.Entity("Jellyfin.Database.Implementations.Entities.ItemValueMap", b =>+ {+ b.Property<Guid>("ItemValueId")+ .HasColumnType("TEXT");++ b.Property<Guid>("ItemId")+ .HasColumnType("TEXT");++ b.HasKey("ItemValueId", "ItemId");++ b.HasIndex("ItemId");++ b.ToTable("ItemValuesMap");++ b.HasAnnotation("Sqlite:UseSqlReturningClause", false);+ });++ modelBuilder.Entity("Jellyfin.Database.Implementations.Entities.KeyframeData", b =>+ {+ b.Property<Guid>("ItemId")+ .HasColumnType("TEXT");++ b.PrimitiveCollection<string>("KeyframeTicks")+ .HasColumnType("TEXT");++ b.Property<long>("TotalDuration")+ .HasColumnType("INTEGER");++ b.HasKey("ItemId");++ b.ToTable("KeyframeData");++ b.HasAnnotation("Sqlite:UseSqlReturningClause", false);+ });++ modelBuilder.Entity("Jellyfin.Database.Implementations.Entities.MediaSegment", b =>+ {+ b.Property<Guid>("Id")+ .ValueGeneratedOnAdd()+ .HasColumnType("TEXT");++ b.Property<long>("EndTicks")+ .HasColumnType("INTEGER");++ b.Property<Guid>("ItemId")+ .HasColumnType("TEXT");++ b.Property<string>("SegmentProviderId")+ .IsRequired()+ .HasColumnType("TEXT");++ b.Property<long>("StartTicks")+ .HasColumnType("INTEGER");++ b.Property<int>("Type")+ .HasColumnType("INTEGER");++ b.HasKey("Id");++ b.ToTable("MediaSegments");++ b.HasAnnotation("Sqlite:UseSqlReturningClause", false);+ });++ modelBuilder.Entity("Jellyfin.Database.Implementations.Entities.MediaStreamInfo", b =>+ {+ b.Property<Guid>("ItemId")+ .HasColumnType("TEXT");++ b.Property<int>("StreamIndex")+ .HasColumnType("INTEGER");++ b.Property<string>("AspectRatio")+ .HasColumnType("TEXT");++ b.Property<float?>("AverageFrameRate")+ .HasColumnType("REAL");++ b.Property<int?>("BitDepth")+ .HasColumnType("INTEGER");++ b.Property<int?>("BitRate")+ .HasColumnType("INTEGER");++ b.Property<int?>("BlPresentFlag")+ .HasColumnType("INTEGER");++ b.Property<string>("ChannelLayout")+ .HasColumnType("TEXT");++ b.Property<int?>("Channels")+ .HasColumnType("INTEGER");++ b.Property<string>("Codec")+ .HasColumnType("TEXT");++ b.Property<string>("CodecTag")+ .HasColumnType("TEXT");++ b.Property<string>("CodecTimeBase")+ .HasColumnType("TEXT");++ b.Property<string>("ColorPrimaries")+ .HasColumnType("TEXT");++ b.Property<string>("ColorSpace")+ .HasColumnType("TEXT");++ b.Property<string>("ColorTransfer")+ .HasColumnType("TEXT");++ b.Property<string>("Comment")+ .HasColumnType("TEXT");++ b.Property<int?>("DvBlSignalCompatibilityId")+ .HasColumnType("INTEGER");++ b.Property<int?>("DvLevel")+ .HasColumnType("INTEGER");++ b.Property<int?>("DvProfile")+ .HasColumnType("INTEGER");++ b.Property<int?>("DvVersionMajor")+ .HasColumnType("INTEGER");++ b.Property<int?>("DvVersionMinor")+ .HasColumnType("INTEGER");++ b.Property<int?>("ElPresentFlag")+ .HasColumnType("INTEGER");++ b.Property<bool?>("Hdr10PlusPresentFlag")+ .HasColumnType("INTEGER");++ b.Property<int?>("Height")+ .HasColumnType("INTEGER");++ b.Property<bool?>("IsAnamorphic")+ .HasColumnType("INTEGER");++ b.Property<bool?>("IsAvc")+ .HasColumnType("INTEGER");++ b.Property<bool>("IsDefault")+ .HasColumnType("INTEGER");++ b.Property<bool>("IsExternal")+ .HasColumnType("INTEGER");++ b.Property<bool>("IsForced")+ .HasColumnType("INTEGER");++ b.Property<bool?>("IsHearingImpaired")+ .HasColumnType("INTEGER");++ b.Property<bool?>("IsInterlaced")+ .HasColumnType("INTEGER");++ b.Property<string>("KeyFrames")+ .HasColumnType("TEXT");++ b.Property<string>("Language")+ .HasColumnType("TEXT");++ b.Property<float?>("Level")+ .HasColumnType("REAL");++ b.Property<string>("NalLengthSize")+ .HasColumnType("TEXT");++ b.Property<string>("Path")+ .HasColumnType("TEXT");++ b.Property<string>("PixelFormat")+ .HasColumnType("TEXT");++ b.Property<string>("Profile")+ .HasColumnType("TEXT");++ b.Property<float?>("RealFrameRate")+ .HasColumnType("REAL");++ b.Property<int?>("RefFrames")+ .HasColumnType("INTEGER");++ b.Property<int?>("Rotation")+ .HasColumnType("INTEGER");++ b.Property<int?>("RpuPresentFlag")+ .HasColumnType("INTEGER");++ b.Property<int?>("SampleRate")+ .HasColumnType("INTEGER");++ b.Property<int>("StreamType")+ .HasColumnType("INTEGER");++ b.Property<string>("TimeBase")+ .HasColumnType("TEXT");++ b.Property<string>("Title")+ .HasColumnType("TEXT");++ b.Property<int?>("Width")+ .HasColumnType("INTEGER");++ b.HasKey("ItemId", "StreamIndex");++ b.HasIndex("StreamIndex");++ b.HasIndex("StreamType");++ b.HasIndex("StreamIndex", "StreamType");++ b.HasIndex("StreamIndex", "StreamType", "Language");++ b.ToTable("MediaStreamInfos");++ b.HasAnnotation("Sqlite:UseSqlReturningClause", false);+ });++ modelBuilder.Entity("Jellyfin.Database.Implementations.Entities.People", b =>+ {+ b.Property<Guid>("Id")+ .ValueGeneratedOnAdd()+ .HasColumnType("TEXT");++ b.Property<string>("Name")+ .IsRequired()+ .HasColumnType("TEXT");++ b.Property<string>("PersonType")+ .HasColumnType("TEXT");++ b.HasKey("Id");++ b.HasIndex("Name");++ b.ToTable("Peoples");++ b.HasAnnotation("Sqlite:UseSqlReturningClause", false);+ });++ modelBuilder.Entity("Jellyfin.Database.Implementations.Entities.PeopleBaseItemMap", b =>+ {+ b.Property<Guid>("ItemId")+ .HasColumnType("TEXT");++ b.Property<Guid>("PeopleId")+ .HasColumnType("TEXT");++ b.Property<int?>("ListOrder")+ .HasColumnType("INTEGER");++ b.Property<string>("Role")+ .HasColumnType("TEXT");++ b.Property<int?>("SortOrder")+ .HasColumnType("INTEGER");++ b.HasKey("ItemId", "PeopleId");++ b.HasIndex("PeopleId");++ b.HasIndex("ItemId", "ListOrder");++ b.HasIndex("ItemId", "SortOrder");++ b.ToTable("PeopleBaseItemMap");++ b.HasAnnotation("Sqlite:UseSqlReturningClause", false);+ });++ modelBuilder.Entity("Jellyfin.Database.Implementations.Entities.Permission", b =>+ {+ b.Property<int>("Id")+ .ValueGeneratedOnAdd()+ .HasColumnType("INTEGER");++ b.Property<int>("Kind")+ .HasColumnType("INTEGER");++ b.Property<Guid?>("Permission_Permissions_Guid")+ .HasColumnType("TEXT");++ b.Property<uint>("RowVersion")+ .IsConcurrencyToken()+ .HasColumnType("INTEGER");++ b.Property<Guid?>("UserId")+ .HasColumnType("TEXT");++ b.Property<bool>("Value")+ .HasColumnType("INTEGER");++ b.HasKey("Id");++ b.HasIndex("UserId", "Kind")+ .IsUnique()+ .HasFilter("[UserId] IS NOT NULL");++ b.ToTable("Permissions");++ b.HasAnnotation("Sqlite:UseSqlReturningClause", false);+ });++ modelBuilder.Entity("Jellyfin.Database.Implementations.Entities.Preference", b =>+ {+ b.Property<int>("Id")+ .ValueGeneratedOnAdd()+ .HasColumnType("INTEGER");++ b.Property<int>("Kind")+ .HasColumnType("INTEGER");++ b.Property<Guid?>("Preference_Preferences_Guid")+ .HasColumnType("TEXT");++ b.Property<uint>("RowVersion")+ .IsConcurrencyToken()+ .HasColumnType("INTEGER");++ b.Property<Guid?>("UserId")+ .HasColumnType("TEXT");++ b.Property<string>("Value")+ .IsRequired()+ .HasMaxLength(65535)+ .HasColumnType("TEXT");++ b.HasKey("Id");++ b.HasIndex("UserId", "Kind")+ .IsUnique()+ .HasFilter("[UserId] IS NOT NULL");++ b.ToTable("Preferences");++ b.HasAnnotation("Sqlite:UseSqlReturningClause", false);+ });++ modelBuilder.Entity("Jellyfin.Database.Implementations.Entities.Security.ApiKey", b =>+ {+ b.Property<int>("Id")+ .ValueGeneratedOnAdd()+ .HasColumnType("INTEGER");++ b.Property<string>("AccessToken")+ .IsRequired()+ .HasColumnType("TEXT");++ b.Property<DateTime>("DateCreated")+ .HasColumnType("TEXT");++ b.Property<DateTime>("DateLastActivity")+ .HasColumnType("TEXT");++ b.Property<string>("Name")+ .IsRequired()+ .HasMaxLength(64)+ .HasColumnType("TEXT");++ b.HasKey("Id");++ b.HasIndex("AccessToken")+ .IsUnique();++ b.ToTable("ApiKeys");++ b.HasAnnotation("Sqlite:UseSqlReturningClause", false);+ });++ modelBuilder.Entity("Jellyfin.Database.Implementations.Entities.Security.Device", b =>+ {+ b.Property<int>("Id")+ .ValueGeneratedOnAdd()+ .HasColumnType("INTEGER");++ b.Property<string>("AccessToken")+ .IsRequired()+ .HasColumnType("TEXT");++ b.Property<string>("AppName")+ .IsRequired()+ .HasMaxLength(64)+ .HasColumnType("TEXT");++ b.Property<string>("AppVersion")+ .IsRequired()+ .HasMaxLength(32)+ .HasColumnType("TEXT");++ b.Property<DateTime>("DateCreated")+ .HasColumnType("TEXT");++ b.Property<DateTime>("DateLastActivity")+ .HasColumnType("TEXT");++ b.Property<DateTime>("DateModified")+ .HasColumnType("TEXT");++ b.Property<string>("DeviceId")+ .IsRequired()+ .HasMaxLength(256)+ .HasColumnType("TEXT");++ b.Property<string>("DeviceName")+ .IsRequired()+ .HasMaxLength(64)+ .HasColumnType("TEXT");++ b.Property<bool>("IsActive")+ .HasColumnType("INTEGER");++ b.Property<Guid>("UserId")+ .HasColumnType("TEXT");++ b.HasKey("Id");++ b.HasIndex("DeviceId");++ b.HasIndex("AccessToken", "DateLastActivity");++ b.HasIndex("DeviceId", "DateLastActivity");++ b.HasIndex("UserId", "DeviceId");++ b.ToTable("Devices");++ b.HasAnnotation("Sqlite:UseSqlReturningClause", false);+ });++ modelBuilder.Entity("Jellyfin.Database.Implementations.Entities.Security.DeviceOptions", b =>+ {+ b.Property<int>("Id")+ .ValueGeneratedOnAdd()+ .HasColumnType("INTEGER");++ b.Property<string>("CustomName")+ .HasColumnType("TEXT");++ b.Property<string>("DeviceId")+ .IsRequired()+ .HasColumnType("TEXT");++ b.HasKey("Id");++ b.HasIndex("DeviceId")+ .IsUnique();++ b.ToTable("DeviceOptions");++ b.HasAnnotation("Sqlite:UseSqlReturningClause", false);+ });++ modelBuilder.Entity("Jellyfin.Database.Implementations.Entities.TrickplayInfo", b =>+ {+ b.Property<Guid>("ItemId")+ .HasColumnType("TEXT");++ b.Property<int>("Width")+ .HasColumnType("INTEGER");++ b.Property<int>("Bandwidth")+ .HasColumnType("INTEGER");++ b.Property<int>("Height")+ .HasColumnType("INTEGER");++ b.Property<int>("Interval")+ .HasColumnType("INTEGER");++ b.Property<int>("ThumbnailCount")+ .HasColumnType("INTEGER");++ b.Property<int>("TileHeight")+ .HasColumnType("INTEGER");++ b.Property<int>("TileWidth")+ .HasColumnType("INTEGER");++ b.HasKey("ItemId", "Width");++ b.ToTable("TrickplayInfos");++ b.HasAnnotation("Sqlite:UseSqlReturningClause", false);+ });++ modelBuilder.Entity("Jellyfin.Database.Implementations.Entities.User", b =>+ {+ b.Property<Guid>("Id")+ .ValueGeneratedOnAdd()+ .HasColumnType("TEXT");++ b.Property<string>("AudioLanguagePreference")+ .HasMaxLength(255)+ .HasColumnType("TEXT");++ b.Property<string>("AuthenticationProviderId")+ .IsRequired()+ .HasMaxLength(255)+ .HasColumnType("TEXT");++ b.Property<string>("CastReceiverId")+ .HasMaxLength(32)+ .HasColumnType("TEXT");++ b.Property<bool>("DisplayCollectionsView")+ .HasColumnType("INTEGER");++ b.Property<bool>("DisplayMissingEpisodes")+ .HasColumnType("INTEGER");++ b.Property<bool>("EnableAutoLogin")+ .HasColumnType("INTEGER");++ b.Property<bool>("EnableLocalPassword")+ .HasColumnType("INTEGER");++ b.Property<bool>("EnableNextEpisodeAutoPlay")+ .HasColumnType("INTEGER");++ b.Property<bool>("EnableUserPreferenceAccess")+ .HasColumnType("INTEGER");++ b.Property<bool>("HidePlayedInLatest")+ .HasColumnType("INTEGER");++ b.Property<long>("InternalId")+ .HasColumnType("INTEGER");++ b.Property<int>("InvalidLoginAttemptCount")+ .HasColumnType("INTEGER");++ b.Property<DateTime?>("LastActivityDate")+ .HasColumnType("TEXT");++ b.Property<DateTime?>("LastLoginDate")+ .HasColumnType("TEXT");++ b.Property<int?>("LoginAttemptsBeforeLockout")+ .HasColumnType("INTEGER");++ b.Property<int>("MaxActiveSessions")+ .HasColumnType("INTEGER");++ b.Property<int?>("MaxParentalRatingScore")+ .HasColumnType("INTEGER");++ b.Property<int?>("MaxParentalRatingSubScore")+ .HasColumnType("INTEGER");++ b.Property<bool>("MustUpdatePassword")+ .HasColumnType("INTEGER");++ b.Property<string>("Password")+ .HasMaxLength(65535)+ .HasColumnType("TEXT");++ b.Property<string>("PasswordResetProviderId")+ .IsRequired()+ .HasMaxLength(255)+ .HasColumnType("TEXT");++ b.Property<bool>("PlayDefaultAudioTrack")+ .HasColumnType("INTEGER");++ b.Property<bool>("RememberAudioSelections")+ .HasColumnType("INTEGER");++ b.Property<bool>("RememberSubtitleSelections")+ .HasColumnType("INTEGER");++ b.Property<int?>("RemoteClientBitrateLimit")+ .HasColumnType("INTEGER");++ b.Property<uint>("RowVersion")+ .IsConcurrencyToken()+ .HasColumnType("INTEGER");++ b.Property<string>("SubtitleLanguagePreference")+ .HasMaxLength(255)+ .HasColumnType("TEXT");++ b.Property<int>("SubtitleMode")+ .HasColumnType("INTEGER");++ b.Property<int>("SyncPlayAccess")+ .HasColumnType("INTEGER");++ b.Property<string>("Username")+ .IsRequired()+ .HasMaxLength(255)+ .HasColumnType("TEXT");++ b.HasKey("Id");++ b.HasIndex("Username")+ .IsUnique();++ b.ToTable("Users");++ b.HasAnnotation("Sqlite:UseSqlReturningClause", false);+ });++ modelBuilder.Entity("Jellyfin.Database.Implementations.Entities.UserData", b =>+ {+ b.Property<Guid>("ItemId")+ .HasColumnType("TEXT");++ b.Property<Guid>("UserId")+ .HasColumnType("TEXT");++ b.Property<string>("CustomDataKey")+ .HasColumnType("TEXT");++ b.Property<int?>("AudioStreamIndex")+ .HasColumnType("INTEGER");++ b.Property<bool>("IsFavorite")+ .HasColumnType("INTEGER");++ b.Property<DateTime?>("LastPlayedDate")+ .HasColumnType("TEXT");++ b.Property<bool?>("Likes")+ .HasColumnType("INTEGER");++ b.Property<int>("PlayCount")+ .HasColumnType("INTEGER");++ b.Property<long>("PlaybackPositionTicks")+ .HasColumnType("INTEGER");++ b.Property<bool>("Played")+ .HasColumnType("INTEGER");++ b.Property<double?>("Rating")+ .HasColumnType("REAL");++ b.Property<DateTime?>("RetentionDate")+ .HasColumnType("TEXT");++ b.Property<int?>("SubtitleStreamIndex")+ .HasColumnType("INTEGER");++ b.HasKey("ItemId", "UserId", "CustomDataKey");++ b.HasIndex("UserId");++ b.HasIndex("ItemId", "UserId", "IsFavorite");++ b.HasIndex("ItemId", "UserId", "LastPlayedDate");++ b.HasIndex("ItemId", "UserId", "PlaybackPositionTicks");++ b.HasIndex("ItemId", "UserId", "Played");++ b.ToTable("UserData");++ b.HasAnnotation("Sqlite:UseSqlReturningClause", false);+ });++ modelBuilder.Entity("Jellyfin.Database.Implementations.Entities.AccessSchedule", b =>+ {+ b.HasOne("Jellyfin.Database.Implementations.Entities.User", null)+ .WithMany("AccessSchedules")+ .HasForeignKey("UserId")+ .OnDelete(DeleteBehavior.Cascade)+ .IsRequired();+ });++ modelBuilder.Entity("Jellyfin.Database.Implementations.Entities.AncestorId", b =>+ {+ b.HasOne("Jellyfin.Database.Implementations.Entities.BaseItemEntity", "Item")+ .WithMany("Parents")+ .HasForeignKey("ItemId")+ .OnDelete(DeleteBehavior.Cascade)+ .IsRequired();++ b.HasOne("Jellyfin.Database.Implementations.Entities.BaseItemEntity", "ParentItem")+ .WithMany("Children")+ .HasForeignKey("ParentItemId")+ .OnDelete(DeleteBehavior.Cascade)+ .IsRequired();++ b.Navigation("Item");++ b.Navigation("ParentItem");+ });++ modelBuilder.Entity("Jellyfin.Database.Implementations.Entities.AttachmentStreamInfo", b =>+ {+ b.HasOne("Jellyfin.Database.Implementations.Entities.BaseItemEntity", "Item")+ .WithMany()+ .HasForeignKey("ItemId")+ .OnDelete(DeleteBehavior.Cascade)+ .IsRequired();++ b.Navigation("Item");+ });++ modelBuilder.Entity("Jellyfin.Database.Implementations.Entities.BaseItemImageInfo", b =>+ {+ b.HasOne("Jellyfin.Database.Implementations.Entities.BaseItemEntity", "Item")+ .WithMany("Images")+ .HasForeignKey("ItemId")+ .OnDelete(DeleteBehavior.Cascade)+ .IsRequired();++ b.Navigation("Item");+ });++ modelBuilder.Entity("Jellyfin.Database.Implementations.Entities.BaseItemMetadataField", b =>+ {+ b.HasOne("Jellyfin.Database.Implementations.Entities.BaseItemEntity", "Item")+ .WithMany("LockedFields")+ .HasForeignKey("ItemId")+ .OnDelete(DeleteBehavior.Cascade)+ .IsRequired();++ b.Navigation("Item");+ });++ modelBuilder.Entity("Jellyfin.Database.Implementations.Entities.BaseItemProvider", b =>+ {+ b.HasOne("Jellyfin.Database.Implementations.Entities.BaseItemEntity", "Item")+ .WithMany("Provider")+ .HasForeignKey("ItemId")+ .OnDelete(DeleteBehavior.Cascade)+ .IsRequired();++ b.Navigation("Item");+ });++ modelBuilder.Entity("Jellyfin.Database.Implementations.Entities.BaseItemTrailerType", b =>+ {+ b.HasOne("Jellyfin.Database.Implementations.Entities.BaseItemEntity", "Item")+ .WithMany("TrailerTypes")+ .HasForeignKey("ItemId")+ .OnDelete(DeleteBehavior.Cascade)+ .IsRequired();++ b.Navigation("Item");+ });++ modelBuilder.Entity("Jellyfin.Database.Implementations.Entities.Chapter", b =>+ {+ b.HasOne("Jellyfin.Database.Implementations.Entities.BaseItemEntity", "Item")+ .WithMany("Chapters")+ .HasForeignKey("ItemId")+ .OnDelete(DeleteBehavior.Cascade)+ .IsRequired();++ b.Navigation("Item");+ });++ modelBuilder.Entity("Jellyfin.Database.Implementations.Entities.DisplayPreferences", b =>+ {+ b.HasOne("Jellyfin.Database.Implementations.Entities.User", null)+ .WithMany("DisplayPreferences")+ .HasForeignKey("UserId")+ .OnDelete(DeleteBehavior.Cascade)+ .IsRequired();+ });++ modelBuilder.Entity("Jellyfin.Database.Implementations.Entities.HomeSection", b =>+ {+ b.HasOne("Jellyfin.Database.Implementations.Entities.DisplayPreferences", null)+ .WithMany("HomeSections")+ .HasForeignKey("DisplayPreferencesId")+ .OnDelete(DeleteBehavior.Cascade)+ .IsRequired();+ });++ modelBuilder.Entity("Jellyfin.Database.Implementations.Entities.ImageInfo", b =>+ {+ b.HasOne("Jellyfin.Database.Implementations.Entities.User", null)+ .WithOne("ProfileImage")+ .HasForeignKey("Jellyfin.Database.Implementations.Entities.ImageInfo", "UserId")+ .OnDelete(DeleteBehavior.Cascade);+ });++ modelBuilder.Entity("Jellyfin.Database.Implementations.Entities.ItemDisplayPreferences", b =>+ {+ b.HasOne("Jellyfin.Database.Implementations.Entities.User", null)+ .WithMany("ItemDisplayPreferences")+ .HasForeignKey("UserId")+ .OnDelete(DeleteBehavior.Cascade)+ .IsRequired();+ });++ modelBuilder.Entity("Jellyfin.Database.Implementations.Entities.ItemValueMap", b =>+ {+ b.HasOne("Jellyfin.Database.Implementations.Entities.BaseItemEntity", "Item")+ .WithMany("ItemValues")+ .HasForeignKey("ItemId")+ .OnDelete(DeleteBehavior.Cascade)+ .IsRequired();++ b.HasOne("Jellyfin.Database.Implementations.Entities.ItemValue", "ItemValue")+ .WithMany("BaseItemsMap")+ .HasForeignKey("ItemValueId")+ .OnDelete(DeleteBehavior.Cascade)+ .IsRequired();++ b.Navigation("Item");++ b.Navigation("ItemValue");+ });++ modelBuilder.Entity("Jellyfin.Database.Implementations.Entities.KeyframeData", b =>+ {+ b.HasOne("Jellyfin.Database.Implementations.Entities.BaseItemEntity", "Item")+ .WithMany()+ .HasForeignKey("ItemId")+ .OnDelete(DeleteBehavior.Cascade)+ .IsRequired();++ b.Navigation("Item");+ });++ modelBuilder.Entity("Jellyfin.Database.Implementations.Entities.MediaStreamInfo", b =>+ {+ b.HasOne("Jellyfin.Database.Implementations.Entities.BaseItemEntity", "Item")+ .WithMany("MediaStreams")+ .HasForeignKey("ItemId")+ .OnDelete(DeleteBehavior.Cascade)+ .IsRequired();++ b.Navigation("Item");+ });++ modelBuilder.Entity("Jellyfin.Database.Implementations.Entities.PeopleBaseItemMap", b =>+ {+ b.HasOne("Jellyfin.Database.Implementations.Entities.BaseItemEntity", "Item")+ .WithMany("Peoples")+ .HasForeignKey("ItemId")+ .OnDelete(DeleteBehavior.Cascade)+ .IsRequired();++ b.HasOne("Jellyfin.Database.Implementations.Entities.People", "People")+ .WithMany("BaseItems")+ .HasForeignKey("PeopleId")+ .OnDelete(DeleteBehavior.Cascade)+ .IsRequired();++ b.Navigation("Item");++ b.Navigation("People");+ });++ modelBuilder.Entity("Jellyfin.Database.Implementations.Entities.Permission", b =>+ {+ b.HasOne("Jellyfin.Database.Implementations.Entities.User", null)+ .WithMany("Permissions")+ .HasForeignKey("UserId")+ .OnDelete(DeleteBehavior.Cascade);+ });++ modelBuilder.Entity("Jellyfin.Database.Implementations.Entities.Preference", b =>+ {+ b.HasOne("Jellyfin.Database.Implementations.Entities.User", null)+ .WithMany("Preferences")+ .HasForeignKey("UserId")+ .OnDelete(DeleteBehavior.Cascade);+ });++ modelBuilder.Entity("Jellyfin.Database.Implementations.Entities.Security.Device", b =>+ {+ b.HasOne("Jellyfin.Database.Implementations.Entities.User", "User")+ .WithMany()+ .HasForeignKey("UserId")+ .OnDelete(DeleteBehavior.Cascade)+ .IsRequired();++ b.Navigation("User");+ });++ modelBuilder.Entity("Jellyfin.Database.Implementations.Entities.UserData", b =>+ {+ b.HasOne("Jellyfin.Database.Implementations.Entities.BaseItemEntity", "Item")+ .WithMany("UserData")+ .HasForeignKey("ItemId")+ .OnDelete(DeleteBehavior.Cascade)+ .IsRequired();++ b.HasOne("Jellyfin.Database.Implementations.Entities.User", "User")+ .WithMany()+ .HasForeignKey("UserId")+ .OnDelete(DeleteBehavior.Cascade)+ .IsRequired();++ b.Navigation("Item");++ b.Navigation("User");+ });++ modelBuilder.Entity("Jellyfin.Database.Implementations.Entities.BaseItemEntity", b =>+ {+ b.Navigation("Chapters");++ b.Navigation("Children");++ b.Navigation("Images");++ b.Navigation("ItemValues");++ b.Navigation("LockedFields");++ b.Navigation("MediaStreams");++ b.Navigation("Parents");++ b.Navigation("Peoples");++ b.Navigation("Provider");++ b.Navigation("TrailerTypes");++ b.Navigation("UserData");+ });++ modelBuilder.Entity("Jellyfin.Database.Implementations.Entities.DisplayPreferences", b =>+ {+ b.Navigation("HomeSections");+ });++ modelBuilder.Entity("Jellyfin.Database.Implementations.Entities.ItemValue", b =>+ {+ b.Navigation("BaseItemsMap");+ });++ modelBuilder.Entity("Jellyfin.Database.Implementations.Entities.People", b =>+ {+ b.Navigation("BaseItems");+ });++ modelBuilder.Entity("Jellyfin.Database.Implementations.Entities.User", b =>+ {+ b.Navigation("AccessSchedules");++ b.Navigation("DisplayPreferences");++ b.Navigation("ItemDisplayPreferences");++ b.Navigation("Permissions");++ b.Navigation("Preferences");++ b.Navigation("ProfileImage");+ });+#pragma warning restore 612, 618+ }+ }+}diff --git a/src/Jellyfin.Database/Jellyfin.Database.Providers.Sqlite/Migrations/20250622170802_BaseItemImageInfoDateModifiedNullable.cs b/src/Jellyfin.Database/Jellyfin.Database.Providers.Sqlite/Migrations/20250622170802_BaseItemImageInfoDateModifiedNullable.csnew file mode 100644index 0000000000..bce6029d5b--- /dev/null+++ b/src/Jellyfin.Database/Jellyfin.Database.Providers.Sqlite/Migrations/20250622170802_BaseItemImageInfoDateModifiedNullable.cs@@ -0,0 +1,37 @@+using System;+using Microsoft.EntityFrameworkCore.Migrations;++#nullable disable++namespace Jellyfin.Server.Implementations.Migrations+{+ /// <inheritdoc />+ public partial class BaseItemImageInfoDateModifiedNullable : Migration+ {+ /// <inheritdoc />+ protected override void Up(MigrationBuilder migrationBuilder)+ {+ migrationBuilder.AlterColumn<DateTime>(+ name: "DateModified",+ table: "BaseItemImageInfos",+ type: "TEXT",+ nullable: true,+ oldClrType: typeof(DateTime),+ oldType: "TEXT");+ }++ /// <inheritdoc />+ protected override void Down(MigrationBuilder migrationBuilder)+ {+ migrationBuilder.AlterColumn<DateTime>(+ name: "DateModified",+ table: "BaseItemImageInfos",+ type: "TEXT",+ nullable: false,+ defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),+ oldClrType: typeof(DateTime),+ oldType: "TEXT",+ oldNullable: true);+ }+ }+}diff --git a/src/Jellyfin.Database/Jellyfin.Database.Providers.Sqlite/Migrations/JellyfinDbModelSnapshot.cs b/src/Jellyfin.Database/Jellyfin.Database.Providers.Sqlite/Migrations/JellyfinDbModelSnapshot.csindex 706215eeff..fe7870ed37 100644--- a/src/Jellyfin.Database/Jellyfin.Database.Providers.Sqlite/Migrations/JellyfinDbModelSnapshot.cs+++ b/src/Jellyfin.Database/Jellyfin.Database.Providers.Sqlite/Migrations/JellyfinDbModelSnapshot.cs@@ -418,7 +418,7 @@ namespace Jellyfin.Server.Implementations.Migrationsb.Property<byte[]>("Blurhash").HasColumnType("BLOB");- b.Property<DateTime>("DateModified")+ b.Property<DateTime?>("DateModified").HasColumnType("TEXT");b.Property<int>("Height")diff --git a/src/Jellyfin.LiveTv/Channels/ChannelManager.cs b/src/Jellyfin.LiveTv/Channels/ChannelManager.csindex 74182171f5..8ee129a575 100644--- a/src/Jellyfin.LiveTv/Channels/ChannelManager.cs+++ b/src/Jellyfin.LiveTv/Channels/ChannelManager.cs@@ -1166,7 +1166,7 @@ namespace Jellyfin.LiveTv.Channels}}- if (isNew || forceUpdate || item.DateLastRefreshed == default)+ if (isNew || forceUpdate || item.DateLastRefreshed == DateTime.MinValue){_providerManager.QueueRefresh(item.Id, new MetadataRefreshOptions(new DirectoryService(_fileSystem)), RefreshPriority.Normal);}diff --git a/tests/Jellyfin.Providers.Tests/Manager/MetadataServiceTests.cs b/tests/Jellyfin.Providers.Tests/Manager/MetadataServiceTests.csindex b32ecf6ec4..b5585f4fd2 100644--- a/tests/Jellyfin.Providers.Tests/Manager/MetadataServiceTests.cs+++ b/tests/Jellyfin.Providers.Tests/Manager/MetadataServiceTests.cs@@ -22,7 +22,7 @@ namespace Jellyfin.Providers.Tests.Manager{var newLocked = new[] { MetadataField.Genres, MetadataField.Cast };var newString = "new";- var newDate = DateTime.Now;+ var newDate = DateTime.UtcNow;var oldLocked = new[] { MetadataField.Genres };var oldString = "old";@@ -39,6 +39,7 @@ namespace Jellyfin.Providers.Tests.ManagerDateCreated = newDate}};+if (defaultDate){source.Item.DateCreated = default;@@ -141,8 +142,8 @@ namespace Jellyfin.Providers.Tests.Manager{ "ProductionYear", 1, 2 },{ "CommunityRating", 1.0f, 2.0f },{ "CriticRating", 1.0f, 2.0f },- { "EndDate", DateTime.UnixEpoch, DateTime.Now },- { "PremiereDate", DateTime.UnixEpoch, DateTime.Now },+ { "EndDate", DateTime.UnixEpoch, DateTime.UtcNow },+ { "PremiereDate", DateTime.UnixEpoch, DateTime.UtcNow },{ "Video3DFormat", Video3DFormat.HalfSideBySide, Video3DFormat.FullSideBySide }};diff --git a/tests/Jellyfin.Server.Implementations.Tests/Plugins/PluginManagerTests.cs b/tests/Jellyfin.Server.Implementations.Tests/Plugins/PluginManagerTests.csindex b289c763b5..6964c920bc 100644--- a/tests/Jellyfin.Server.Implementations.Tests/Plugins/PluginManagerTests.cs+++ b/tests/Jellyfin.Server.Implementations.Tests/Plugins/PluginManagerTests.cs@@ -185,7 +185,7 @@ namespace Jellyfin.Server.Implementations.Tests.PluginsDescription = packageInfo.Description,Overview = packageInfo.Overview,TargetAbi = packageInfo.Versions[0].TargetAbi!,- Timestamp = DateTime.Parse(packageInfo.Versions[0].Timestamp!, CultureInfo.InvariantCulture),+ Timestamp = DateTimeOffset.Parse(packageInfo.Versions[0].Timestamp!, CultureInfo.InvariantCulture).UtcDateTime,Changelog = packageInfo.Versions[0].Changelog!,Version = new Version(1, 0).ToString(),ImagePath = string.Empty@@ -221,7 +221,7 @@ namespace Jellyfin.Server.Implementations.Tests.PluginsDescription = packageInfo.Description,Overview = packageInfo.Overview,TargetAbi = packageInfo.Versions[0].TargetAbi!,- Timestamp = DateTime.Parse(packageInfo.Versions[0].Timestamp!, CultureInfo.InvariantCulture),+ Timestamp = DateTimeOffset.Parse(packageInfo.Versions[0].Timestamp!, CultureInfo.InvariantCulture).UtcDateTime,Changelog = packageInfo.Versions[0].Changelog!,Version = packageInfo.Versions[0].Version,ImagePath = string.Empty