示例#1
0
        /// <summary>
        /// Gets indexed folders based on a list of index names and folder id's
        /// </summary>
        /// <param name="values">The values.</param>
        /// <param name="parentFolder">The parent folder.</param>
        /// <param name="user">The user.</param>
        /// <returns>BaseItem.</returns>
        private static BaseItem GetIndexFolder(List<string> values, Folder parentFolder, User user)
        {
            // The index name is first
            var indexBy = values[0];

            // The index folder id is next
            var indexFolderId = new Guid(values[1]);

            // Remove them from the lst
            values.RemoveRange(0, 2);

            // Get the IndexFolder
            var indexFolder = parentFolder.GetChildren(user, false, indexBy).FirstOrDefault(i => i.Id == indexFolderId) as Folder;

            // Nested index folder
            if (values.Count > 0)
            {
                return GetIndexFolder(values, indexFolder, user);
            }

            return indexFolder;
        }
示例#2
0
        private IEnumerable<BaseItem> GetChildrenSorted(Folder folder, User user, SortCriteria sort)
        {
            var items = folder.GetChildren(user, true);

            items = FilterUnsupportedContent(items);

            if (folder is Series || folder is Season || folder is BoxSet)
            {
                return items;
            }

            return SortItems(items, user, sort);
        }
示例#3
0
 private int GetChildCount(Folder folder, User user)
 {
     return folder.GetChildren(user, true)
         .Count();
 }
示例#4
0
        private IEnumerable<BaseItem> GetPlainFolderChildrenSorted(Folder folder, User user, SortCriteria sort)
        {
            var items = folder.GetChildren(user, true);

            items = FilterUnsupportedContent(items);

            if (folder.IsPreSorted)
            {
                return items;
            }

            return SortItems(items, user, sort);
        }