mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-09-06 13:57:14 -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))
|
||||||
{
|
{
|
||||||
@ -141,7 +142,11 @@ namespace MediaBrowser.Controller.Resolvers
|
|||||||
|
|
||||||
if (childData != null)
|
if (childData != null)
|
||||||
{
|
{
|
||||||
item.DateCreated = childData.CreationTimeUtc;
|
if (includeCreationTime)
|
||||||
|
{
|
||||||
|
item.DateCreated = childData.CreationTimeUtc;
|
||||||
|
}
|
||||||
|
|
||||||
item.DateModified = childData.LastWriteTimeUtc;
|
item.DateModified = childData.LastWriteTimeUtc;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -150,14 +155,20 @@ namespace MediaBrowser.Controller.Resolvers
|
|||||||
|
|
||||||
if (fileData.Exists)
|
if (fileData.Exists)
|
||||||
{
|
{
|
||||||
item.DateCreated = fileData.CreationTimeUtc;
|
if (includeCreationTime)
|
||||||
|
{
|
||||||
|
item.DateCreated = fileData.CreationTimeUtc;
|
||||||
|
}
|
||||||
item.DateModified = fileData.LastWriteTimeUtc;
|
item.DateModified = fileData.LastWriteTimeUtc;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
item.DateCreated = args.FileInfo.CreationTimeUtc;
|
if (includeCreationTime)
|
||||||
|
{
|
||||||
|
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…
Reference in New Issue
Block a user