mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-01-15 15:48:03 +00:00
Fix modification checks and make sure to use UTC (#14347)
Some checks are pending
OpenAPI / OpenAPI - HEAD (push) Waiting to run
CodeQL / Analyze (csharp) (push) Waiting to run
OpenAPI / OpenAPI - BASE (push) Waiting to run
OpenAPI / OpenAPI - Difference (push) Blocked by required conditions
OpenAPI / OpenAPI - Publish Unstable Spec (push) Blocked by required conditions
OpenAPI / OpenAPI - Publish Stable Spec (push) Blocked by required conditions
Tests / run-tests (macos-latest) (push) Waiting to run
Tests / run-tests (ubuntu-latest) (push) Waiting to run
Tests / run-tests (windows-latest) (push) Waiting to run
Project Automation / Project board (push) Waiting to run
Merge Conflict Labeler / Labeling (push) Waiting to run
Some checks are pending
OpenAPI / OpenAPI - HEAD (push) Waiting to run
CodeQL / Analyze (csharp) (push) Waiting to run
OpenAPI / OpenAPI - BASE (push) Waiting to run
OpenAPI / OpenAPI - Difference (push) Blocked by required conditions
OpenAPI / OpenAPI - Publish Unstable Spec (push) Blocked by required conditions
OpenAPI / OpenAPI - Publish Stable Spec (push) Blocked by required conditions
Tests / run-tests (macos-latest) (push) Waiting to run
Tests / run-tests (ubuntu-latest) (push) Waiting to run
Tests / run-tests (windows-latest) (push) Waiting to run
Project Automation / Project board (push) Waiting to run
Merge Conflict Labeler / Labeling (push) Waiting to run
This commit is contained in:
@@ -73,11 +73,11 @@ namespace MediaBrowser.Providers.Manager
|
||||
|
||||
public 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.Manager
|
||||
var 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.Manager
|
||||
target.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;
|
||||
}
|
||||
|
||||
@@ -669,8 +669,13 @@ namespace MediaBrowser.Providers.Manager
|
||||
private 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>
|
||||
|
||||
Reference in New Issue
Block a user