diff options
Diffstat (limited to 'MediaBrowser.Controller/Entities')
| -rw-r--r-- | MediaBrowser.Controller/Entities/BaseItem.cs | 17 | ||||
| -rw-r--r-- | MediaBrowser.Controller/Entities/Folder.cs | 2 | ||||
| -rw-r--r-- | MediaBrowser.Controller/Entities/TV/Episode.cs | 2 | ||||
| -rw-r--r-- | MediaBrowser.Controller/Entities/User.cs | 2 |
4 files changed, 16 insertions, 7 deletions
diff --git a/MediaBrowser.Controller/Entities/BaseItem.cs b/MediaBrowser.Controller/Entities/BaseItem.cs index 67221a9ac..839fe34ff 100644 --- a/MediaBrowser.Controller/Entities/BaseItem.cs +++ b/MediaBrowser.Controller/Entities/BaseItem.cs @@ -1,4 +1,5 @@ using MediaBrowser.Common.Extensions; +using MediaBrowser.Common.IO; using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Entities.TV; using MediaBrowser.Controller.IO; @@ -212,6 +213,7 @@ namespace MediaBrowser.Controller.Entities public static IProviderManager ProviderManager { get; set; } public static ILocalizationManager LocalizationManager { get; set; } public static IItemRepository ItemRepository { get; set; } + public static IFileSystem FileSystem { get; set; } /// <summary> /// Returns a <see cref="System.String" /> that represents this instance. @@ -395,7 +397,7 @@ namespace MediaBrowser.Controller.Entities // When resolving the root, we need it's grandchildren (children of user views) var flattenFolderDepth = isPhysicalRoot ? 2 : 0; - args.FileSystemDictionary = FileData.GetFilteredFileSystemEntries(args.Path, Logger, args, flattenFolderDepth: flattenFolderDepth, resolveShortcuts: isPhysicalRoot || args.IsVf); + args.FileSystemDictionary = FileData.GetFilteredFileSystemEntries(args.Path, FileSystem, Logger, args, flattenFolderDepth: flattenFolderDepth, resolveShortcuts: isPhysicalRoot || args.IsVf); // Need to remove subpaths that may have been resolved from shortcuts // Example: if \\server\movies exists, then strip out \\server\movies\action @@ -413,7 +415,7 @@ namespace MediaBrowser.Controller.Entities } //update our dates - EntityResolutionHelper.EnsureDates(this, args, false); + EntityResolutionHelper.EnsureDates(FileSystem, this, args, false); IsOffline = false; @@ -1337,6 +1339,13 @@ namespace MediaBrowser.Controller.Entities var data = userManager.GetUserData(user.Id, key); + if (datePlayed.HasValue) + { + // Incremenet + data.PlayCount++; + } + + // Ensure it's at least one data.PlayCount = Math.Max(data.PlayCount, 1); data.LastPlayedDate = datePlayed ?? data.LastPlayedDate; @@ -1729,7 +1738,7 @@ namespace MediaBrowser.Controller.Entities if (locationType == LocationType.Remote || locationType == LocationType.Virtual) { - return File.GetLastWriteTimeUtc(imagePath); + return FileSystem.GetLastWriteTimeUtc(imagePath); } var metaFileEntry = ResolveArgs.GetMetaFileByPath(imagePath); @@ -1746,7 +1755,7 @@ namespace MediaBrowser.Controller.Entities } // See if we can avoid a file system lookup by looking for the file in ResolveArgs - return metaFileEntry == null ? File.GetLastWriteTimeUtc(imagePath) : metaFileEntry.LastWriteTimeUtc; + return metaFileEntry == null ? FileSystem.GetLastWriteTimeUtc(imagePath) : FileSystem.GetLastWriteTimeUtc(metaFileEntry); } } } diff --git a/MediaBrowser.Controller/Entities/Folder.cs b/MediaBrowser.Controller/Entities/Folder.cs index c54b81242..a4ba14616 100644 --- a/MediaBrowser.Controller/Entities/Folder.cs +++ b/MediaBrowser.Controller/Entities/Folder.cs @@ -693,7 +693,7 @@ namespace MediaBrowser.Controller.Entities //existing item - check if it has changed if (currentChild.HasChanged(child)) { - EntityResolutionHelper.EnsureDates(currentChild, child.ResolveArgs, false); + EntityResolutionHelper.EnsureDates(FileSystem, currentChild, child.ResolveArgs, false); validChildren.Add(new Tuple<BaseItem, bool>(currentChild, true)); } diff --git a/MediaBrowser.Controller/Entities/TV/Episode.cs b/MediaBrowser.Controller/Entities/TV/Episode.cs index 1176fca52..96b120b8f 100644 --- a/MediaBrowser.Controller/Entities/TV/Episode.cs +++ b/MediaBrowser.Controller/Entities/TV/Episode.cs @@ -203,7 +203,7 @@ namespace MediaBrowser.Controller.Entities.TV public bool IsUnaired { - get { return PremiereDate.HasValue && PremiereDate.Value >= DateTime.UtcNow; } + get { return PremiereDate.HasValue && PremiereDate.Value.ToLocalTime().Date >= DateTime.Now.Date; } } public bool IsVirtualUnaired diff --git a/MediaBrowser.Controller/Entities/User.cs b/MediaBrowser.Controller/Entities/User.cs index 9d8539906..06f50e552 100644 --- a/MediaBrowser.Controller/Entities/User.cs +++ b/MediaBrowser.Controller/Entities/User.cs @@ -165,7 +165,7 @@ namespace MediaBrowser.Controller.Entities // Ensure it's been lazy loaded var config = Configuration; - return File.GetLastWriteTimeUtc(ConfigurationFilePath); + return FileSystem.GetLastWriteTimeUtc(ConfigurationFilePath); } } |
