diff options
Diffstat (limited to 'MediaBrowser.Controller')
| -rw-r--r-- | MediaBrowser.Controller/Connect/UserLinkResult.cs | 2 | ||||
| -rw-r--r-- | MediaBrowser.Controller/Entities/CollectionFolder.cs | 3 | ||||
| -rw-r--r-- | MediaBrowser.Controller/Entities/Folder.cs | 38 | ||||
| -rw-r--r-- | MediaBrowser.Controller/Library/ILibraryManager.cs | 30 | ||||
| -rw-r--r-- | MediaBrowser.Controller/Library/ItemResolveArgs.cs | 32 | ||||
| -rw-r--r-- | MediaBrowser.Controller/Library/TVUtils.cs | 2 | ||||
| -rw-r--r-- | MediaBrowser.Controller/Persistence/IItemRepository.cs | 11 | ||||
| -rw-r--r-- | MediaBrowser.Controller/Resolvers/EntityResolutionHelper.cs | 2 | ||||
| -rw-r--r-- | MediaBrowser.Controller/Session/SessionInfo.cs | 6 |
9 files changed, 75 insertions, 51 deletions
diff --git a/MediaBrowser.Controller/Connect/UserLinkResult.cs b/MediaBrowser.Controller/Connect/UserLinkResult.cs index 4ed57cfc2..16ebfc70a 100644 --- a/MediaBrowser.Controller/Connect/UserLinkResult.cs +++ b/MediaBrowser.Controller/Connect/UserLinkResult.cs @@ -4,5 +4,7 @@ namespace MediaBrowser.Controller.Connect public class UserLinkResult { public bool IsPending { get; set; } + public bool IsNewUserInvitation { get; set; } + public string GuestDisplayName { get; set; } } } diff --git a/MediaBrowser.Controller/Entities/CollectionFolder.cs b/MediaBrowser.Controller/Entities/CollectionFolder.cs index 4b90741c0..a10742f01 100644 --- a/MediaBrowser.Controller/Entities/CollectionFolder.cs +++ b/MediaBrowser.Controller/Entities/CollectionFolder.cs @@ -74,7 +74,8 @@ namespace MediaBrowser.Controller.Entities { FileInfo = new DirectoryInfo(path), Path = path, - Parent = Parent + Parent = Parent, + CollectionType = CollectionType }; // Gather child folder and files diff --git a/MediaBrowser.Controller/Entities/Folder.cs b/MediaBrowser.Controller/Entities/Folder.cs index 4614f2f8a..4abdde8dd 100644 --- a/MediaBrowser.Controller/Entities/Folder.cs +++ b/MediaBrowser.Controller/Entities/Folder.cs @@ -736,7 +736,9 @@ namespace MediaBrowser.Controller.Entities /// <returns>IEnumerable{BaseItem}.</returns> protected virtual IEnumerable<BaseItem> GetNonCachedChildren(IDirectoryService directoryService) { - return LibraryManager.ResolvePaths<BaseItem>(GetFileSystemChildren(directoryService), directoryService, this); + var collectionType = LibraryManager.FindCollectionType(this); + + return LibraryManager.ResolvePaths<BaseItem>(GetFileSystemChildren(directoryService), directoryService, this, collectionType); } /// <summary> @@ -745,7 +747,16 @@ namespace MediaBrowser.Controller.Entities /// <returns>IEnumerable{BaseItem}.</returns> protected IEnumerable<BaseItem> GetCachedChildren() { - return ItemRepository.GetChildren(Id).Select(RetrieveChild).Where(i => i != null); + var childrenItems = ItemRepository.GetChildrenItems(Id).Select(RetrieveChild).Where(i => i != null); + + //var children = ItemRepository.GetChildren(Id).Select(RetrieveChild).Where(i => i != null).ToList(); + + //if (children.Count != childrenItems.Count) + //{ + // var b = this; + //} + + return childrenItems; } /// <summary> @@ -770,6 +781,29 @@ namespace MediaBrowser.Controller.Entities return item; } + private BaseItem RetrieveChild(BaseItem child) + { + var item = LibraryManager.GetMemoryItemById(child.Id); + + if (item != null) + { + if (item is IByReferenceItem) + { + return LibraryManager.GetOrAddByReferenceItem(item); + } + + item.Parent = this; + } + else + { + child.Parent = this; + LibraryManager.RegisterItem(child); + item = child; + } + + return item; + } + public virtual Task<QueryResult<BaseItem>> GetItems(InternalItemsQuery query) { var user = query.User; diff --git a/MediaBrowser.Controller/Library/ILibraryManager.cs b/MediaBrowser.Controller/Library/ILibraryManager.cs index 951513962..f93564882 100644 --- a/MediaBrowser.Controller/Library/ILibraryManager.cs +++ b/MediaBrowser.Controller/Library/ILibraryManager.cs @@ -18,29 +18,13 @@ namespace MediaBrowser.Controller.Library public interface ILibraryManager { /// <summary> - /// Resolves the item. - /// </summary> - /// <param name="args">The args.</param> - /// <returns>BaseItem.</returns> - BaseItem ResolveItem(ItemResolveArgs args); - - /// <summary> - /// Resolves a path into a BaseItem - /// </summary> - /// <param name="fileInfo">The file info.</param> - /// <param name="directoryService">The directory service.</param> - /// <param name="parent">The parent.</param> - /// <returns>BaseItem.</returns> - /// <exception cref="System.ArgumentNullException"></exception> - BaseItem ResolvePath(FileSystemInfo fileInfo, IDirectoryService directoryService, Folder parent = null); - - /// <summary> /// Resolves the path. /// </summary> /// <param name="fileInfo">The file information.</param> /// <param name="parent">The parent.</param> + /// <param name="collectionType">Type of the collection.</param> /// <returns>BaseItem.</returns> - BaseItem ResolvePath(FileSystemInfo fileInfo, Folder parent = null); + BaseItem ResolvePath(FileSystemInfo fileInfo, Folder parent = null, string collectionType = null); /// <summary> /// Resolves a set of files into a list of BaseItem @@ -49,8 +33,9 @@ namespace MediaBrowser.Controller.Library /// <param name="files">The files.</param> /// <param name="directoryService">The directory service.</param> /// <param name="parent">The parent.</param> + /// <param name="collectionType">Type of the collection.</param> /// <returns>List{``0}.</returns> - List<T> ResolvePaths<T>(IEnumerable<FileSystemInfo> files, IDirectoryService directoryService, Folder parent) + List<T> ResolvePaths<T>(IEnumerable<FileSystemInfo> files, IDirectoryService directoryService, Folder parent, string collectionType = null) where T : BaseItem; /// <summary> @@ -152,6 +137,13 @@ namespace MediaBrowser.Controller.Library BaseItem GetItemById(Guid id); /// <summary> + /// Gets the memory item by identifier. + /// </summary> + /// <param name="id">The identifier.</param> + /// <returns>BaseItem.</returns> + BaseItem GetMemoryItemById(Guid id); + + /// <summary> /// Gets the intros. /// </summary> /// <param name="item">The item.</param> diff --git a/MediaBrowser.Controller/Library/ItemResolveArgs.cs b/MediaBrowser.Controller/Library/ItemResolveArgs.cs index c1fcdc9fe..d1692aabf 100644 --- a/MediaBrowser.Controller/Library/ItemResolveArgs.cs +++ b/MediaBrowser.Controller/Library/ItemResolveArgs.cs @@ -230,29 +230,18 @@ namespace MediaBrowser.Controller.Library } /// <summary> - /// Gets the name of the meta file by. + /// Determines whether [contains meta file by name] [the specified name]. /// </summary> /// <param name="name">The name.</param> - /// <returns>FileSystemInfo.</returns> - /// <exception cref="System.ArgumentNullException"></exception> - public FileSystemInfo GetMetaFileByName(string name) + /// <returns><c>true</c> if [contains meta file by name] [the specified name]; otherwise, <c>false</c>.</returns> + public bool ContainsMetaFileByName(string name) { if (string.IsNullOrEmpty(name)) { throw new ArgumentNullException(); } - return GetFileSystemEntryByName(name); - } - - /// <summary> - /// Determines whether [contains meta file by name] [the specified name]. - /// </summary> - /// <param name="name">The name.</param> - /// <returns><c>true</c> if [contains meta file by name] [the specified name]; otherwise, <c>false</c>.</returns> - public bool ContainsMetaFileByName(string name) - { - return GetMetaFileByName(name) != null; + return GetFileSystemEntryByName(name) != null; } /// <summary> @@ -265,20 +254,13 @@ namespace MediaBrowser.Controller.Library return GetFileSystemEntryByName(name) != null; } - private bool _collectionTypeDiscovered; - private string _collectionType; - public string GetCollectionType() { - if (!_collectionTypeDiscovered) - { - _collectionType = Parent == null ? null : _libraryManager.FindCollectionType(Parent); - _collectionTypeDiscovered = true; - } - - return _collectionType; + return CollectionType; } + public string CollectionType { get; set; } + #region Equality Overrides /// <summary> diff --git a/MediaBrowser.Controller/Library/TVUtils.cs b/MediaBrowser.Controller/Library/TVUtils.cs index 34486182b..c85a8f335 100644 --- a/MediaBrowser.Controller/Library/TVUtils.cs +++ b/MediaBrowser.Controller/Library/TVUtils.cs @@ -284,7 +284,7 @@ namespace MediaBrowser.Controller.Library { if (IsSeasonFolder(child.FullName, directoryService, fileSystem)) { - logger.Debug("{0} is a series because of season folder {1}.", path, child.FullName); + //logger.Debug("{0} is a series because of season folder {1}.", path, child.FullName); return true; } diff --git a/MediaBrowser.Controller/Persistence/IItemRepository.cs b/MediaBrowser.Controller/Persistence/IItemRepository.cs index 02bca739f..edaa15c9d 100644 --- a/MediaBrowser.Controller/Persistence/IItemRepository.cs +++ b/MediaBrowser.Controller/Persistence/IItemRepository.cs @@ -33,7 +33,7 @@ namespace MediaBrowser.Controller.Persistence /// <param name="cancellationToken">The cancellation token.</param> /// <returns>Task.</returns> Task DeleteItem(Guid id, CancellationToken cancellationToken); - + /// <summary> /// Gets the critic reviews. /// </summary> @@ -42,6 +42,13 @@ namespace MediaBrowser.Controller.Persistence IEnumerable<ItemReview> GetCriticReviews(Guid itemId); /// <summary> + /// Gets the children items. + /// </summary> + /// <param name="parentId">The parent identifier.</param> + /// <returns>IEnumerable<BaseItem>.</returns> + IEnumerable<BaseItem> GetChildrenItems(Guid parentId); + + /// <summary> /// Saves the critic reviews. /// </summary> /// <param name="itemId">The item id.</param> @@ -101,7 +108,7 @@ namespace MediaBrowser.Controller.Persistence /// <param name="type">The type.</param> /// <returns>IEnumerable{Guid}.</returns> IEnumerable<BaseItem> GetItemsOfType(Type type); - + /// <summary> /// Saves the children. /// </summary> diff --git a/MediaBrowser.Controller/Resolvers/EntityResolutionHelper.cs b/MediaBrowser.Controller/Resolvers/EntityResolutionHelper.cs index 7d9c9d876..5b4007322 100644 --- a/MediaBrowser.Controller/Resolvers/EntityResolutionHelper.cs +++ b/MediaBrowser.Controller/Resolvers/EntityResolutionHelper.cs @@ -246,7 +246,7 @@ namespace MediaBrowser.Controller.Resolvers if (config.UseFileCreationTimeForDateAdded) { - item.DateModified = fileSystem.GetCreationTimeUtc(info); + item.DateCreated = fileSystem.GetCreationTimeUtc(info); } else { diff --git a/MediaBrowser.Controller/Session/SessionInfo.cs b/MediaBrowser.Controller/Session/SessionInfo.cs index 53a8d5a7c..d8a2464d6 100644 --- a/MediaBrowser.Controller/Session/SessionInfo.cs +++ b/MediaBrowser.Controller/Session/SessionInfo.cs @@ -81,6 +81,12 @@ namespace MediaBrowser.Controller.Session public DateTime LastActivityDate { get; set; } /// <summary> + /// Gets or sets the last playback check in. + /// </summary> + /// <value>The last playback check in.</value> + public DateTime LastPlaybackCheckIn { get; set; } + + /// <summary> /// Gets or sets the name of the device. /// </summary> /// <value>The name of the device.</value> |
