mirror of https://github.com/jellyfin/jellyfin.git
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
|
||||
EntityResolutionHelper.EnsureDates(this, args);
|
||||
EntityResolutionHelper.EnsureDates(this, args, false);
|
||||
|
||||
IsOffline = false;
|
||||
|
||||
|
|
|
@ -681,7 +681,7 @@ namespace MediaBrowser.Controller.Entities
|
|||
//existing item - check if it has changed
|
||||
if (currentChild.HasChanged(child))
|
||||
{
|
||||
EntityResolutionHelper.EnsureDates(currentChild, child.ResolveArgs);
|
||||
EntityResolutionHelper.EnsureDates(currentChild, child.ResolveArgs, false);
|
||||
|
||||
validChildren.Add(new Tuple<BaseItem, bool>(currentChild, true));
|
||||
}
|
||||
|
|
|
@ -127,7 +127,8 @@ namespace MediaBrowser.Controller.Resolvers
|
|||
/// </summary>
|
||||
/// <param name="item">The item.</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))
|
||||
{
|
||||
|
@ -141,7 +142,11 @@ namespace MediaBrowser.Controller.Resolvers
|
|||
|
||||
if (childData != null)
|
||||
{
|
||||
item.DateCreated = childData.CreationTimeUtc;
|
||||
if (includeCreationTime)
|
||||
{
|
||||
item.DateCreated = childData.CreationTimeUtc;
|
||||
}
|
||||
|
||||
item.DateModified = childData.LastWriteTimeUtc;
|
||||
}
|
||||
else
|
||||
|
@ -150,14 +155,20 @@ namespace MediaBrowser.Controller.Resolvers
|
|||
|
||||
if (fileData.Exists)
|
||||
{
|
||||
item.DateCreated = fileData.CreationTimeUtc;
|
||||
if (includeCreationTime)
|
||||
{
|
||||
item.DateCreated = fileData.CreationTimeUtc;
|
||||
}
|
||||
item.DateModified = fileData.LastWriteTimeUtc;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
item.DateCreated = args.FileInfo.CreationTimeUtc;
|
||||
if (includeCreationTime)
|
||||
{
|
||||
item.DateCreated = args.FileInfo.CreationTimeUtc;
|
||||
}
|
||||
item.DateModified = args.FileInfo.LastWriteTimeUtc;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -48,7 +48,7 @@ namespace MediaBrowser.Server.Implementations.Library
|
|||
item.DontFetchMeta = item.Path.IndexOf("[dontfetchmeta]", StringComparison.OrdinalIgnoreCase) != -1;
|
||||
|
||||
// Make sure DateCreated and DateModified have values
|
||||
EntityResolutionHelper.EnsureDates(item, args);
|
||||
EntityResolutionHelper.EnsureDates(item, args, true);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
Loading…
Reference in New Issue