mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-07-09 03:04:24 -04:00
only set creation date at resolve time
This commit is contained in:
parent
9b167174ad
commit
f064d6c9c7
@ -354,7 +354,7 @@ namespace MediaBrowser.Controller.Entities
|
|||||||
}
|
}
|
||||||
|
|
||||||
//update our dates
|
//update our dates
|
||||||
EntityResolutionHelper.EnsureDates(this, args);
|
EntityResolutionHelper.EnsureDates(this, args, false);
|
||||||
|
|
||||||
IsOffline = false;
|
IsOffline = false;
|
||||||
|
|
||||||
|
@ -681,7 +681,7 @@ namespace MediaBrowser.Controller.Entities
|
|||||||
//existing item - check if it has changed
|
//existing item - check if it has changed
|
||||||
if (currentChild.HasChanged(child))
|
if (currentChild.HasChanged(child))
|
||||||
{
|
{
|
||||||
EntityResolutionHelper.EnsureDates(currentChild, child.ResolveArgs);
|
EntityResolutionHelper.EnsureDates(currentChild, child.ResolveArgs, false);
|
||||||
|
|
||||||
validChildren.Add(new Tuple<BaseItem, bool>(currentChild, true));
|
validChildren.Add(new Tuple<BaseItem, bool>(currentChild, true));
|
||||||
}
|
}
|
||||||
|
@ -127,7 +127,8 @@ namespace MediaBrowser.Controller.Resolvers
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="item">The item.</param>
|
/// <param name="item">The item.</param>
|
||||||
/// <param name="args">The args.</param>
|
/// <param name="args">The args.</param>
|
||||||
public static void EnsureDates(BaseItem item, ItemResolveArgs args)
|
/// <param name="includeCreationTime">if set to <c>true</c> [include creation time].</param>
|
||||||
|
public static void EnsureDates(BaseItem item, ItemResolveArgs args, bool includeCreationTime)
|
||||||
{
|
{
|
||||||
if (!Path.IsPathRooted(item.Path))
|
if (!Path.IsPathRooted(item.Path))
|
||||||
{
|
{
|
||||||
@ -140,8 +141,12 @@ namespace MediaBrowser.Controller.Resolvers
|
|||||||
var childData = args.IsDirectory ? args.GetFileSystemEntryByPath(item.Path) : null;
|
var childData = args.IsDirectory ? args.GetFileSystemEntryByPath(item.Path) : null;
|
||||||
|
|
||||||
if (childData != null)
|
if (childData != null)
|
||||||
|
{
|
||||||
|
if (includeCreationTime)
|
||||||
{
|
{
|
||||||
item.DateCreated = childData.CreationTimeUtc;
|
item.DateCreated = childData.CreationTimeUtc;
|
||||||
|
}
|
||||||
|
|
||||||
item.DateModified = childData.LastWriteTimeUtc;
|
item.DateModified = childData.LastWriteTimeUtc;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -149,15 +154,21 @@ namespace MediaBrowser.Controller.Resolvers
|
|||||||
var fileData = FileSystem.GetFileSystemInfo(item.Path);
|
var fileData = FileSystem.GetFileSystemInfo(item.Path);
|
||||||
|
|
||||||
if (fileData.Exists)
|
if (fileData.Exists)
|
||||||
|
{
|
||||||
|
if (includeCreationTime)
|
||||||
{
|
{
|
||||||
item.DateCreated = fileData.CreationTimeUtc;
|
item.DateCreated = fileData.CreationTimeUtc;
|
||||||
|
}
|
||||||
item.DateModified = fileData.LastWriteTimeUtc;
|
item.DateModified = fileData.LastWriteTimeUtc;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
if (includeCreationTime)
|
||||||
{
|
{
|
||||||
item.DateCreated = args.FileInfo.CreationTimeUtc;
|
item.DateCreated = args.FileInfo.CreationTimeUtc;
|
||||||
|
}
|
||||||
item.DateModified = args.FileInfo.LastWriteTimeUtc;
|
item.DateModified = args.FileInfo.LastWriteTimeUtc;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -48,7 +48,7 @@ namespace MediaBrowser.Server.Implementations.Library
|
|||||||
item.DontFetchMeta = item.Path.IndexOf("[dontfetchmeta]", StringComparison.OrdinalIgnoreCase) != -1;
|
item.DontFetchMeta = item.Path.IndexOf("[dontfetchmeta]", StringComparison.OrdinalIgnoreCase) != -1;
|
||||||
|
|
||||||
// Make sure DateCreated and DateModified have values
|
// Make sure DateCreated and DateModified have values
|
||||||
EntityResolutionHelper.EnsureDates(item, args);
|
EntityResolutionHelper.EnsureDates(item, args, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user