当前位置: 首页>>代码示例>>C#>>正文


C# BaseItem.GetPlayAccess方法代码示例

本文整理汇总了C#中BaseItem.GetPlayAccess方法的典型用法代码示例。如果您正苦于以下问题:C# BaseItem.GetPlayAccess方法的具体用法?C# BaseItem.GetPlayAccess怎么用?C# BaseItem.GetPlayAccess使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在BaseItem的用法示例。


在下文中一共展示了BaseItem.GetPlayAccess方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: AttachUserSpecificInfo

        /// <summary>
        /// Attaches the user specific info.
        /// </summary>
        /// <param name="dto">The dto.</param>
        /// <param name="item">The item.</param>
        /// <param name="user">The user.</param>
        /// <param name="fields">The fields.</param>
        /// <param name="syncProgress">The synchronize progress.</param>
        private void AttachUserSpecificInfo(BaseItemDto dto, BaseItem item, User user, List<ItemFields> fields, Dictionary<string, SyncedItemProgress> syncProgress)
        {
            if (item.IsFolder)
            {
                var userData = _userDataRepository.GetUserData(user.Id, item.GetUserDataKey());

                // Skip the user data manager because we've already looped through the recursive tree and don't want to do it twice
                // TODO: Improve in future
                dto.UserData = GetUserItemDataDto(userData);

                var folder = (Folder)item;

                dto.ChildCount = GetChildCount(folder, user);

                // These are just far too slow. 
                // TODO: Disable for CollectionFolder
                if (!(folder is UserRootFolder) && !(folder is UserView))
                {
                    SetSpecialCounts(folder, user, dto, fields, syncProgress);
                }

                dto.UserData.Played = dto.UserData.PlayedPercentage.HasValue && dto.UserData.PlayedPercentage.Value >= 100;
            }

            else
            {
                dto.UserData = _userDataRepository.GetUserDataDto(item, user);
            }

            dto.PlayAccess = item.GetPlayAccess(user);

            if (fields.Contains(ItemFields.SeasonUserData))
            {
                var episode = item as Episode;

                if (episode != null)
                {
                    var season = episode.Season;

                    if (season != null)
                    {
                        dto.SeasonUserData = _userDataRepository.GetUserDataDto(season, user);
                    }
                }
            }

            var userView = item as UserView;
            if (userView != null)
            {
                dto.HasDynamicCategories = userView.ContainsDynamicCategories(user);
            }

            var collectionFolder = item as ICollectionFolder;
            if (collectionFolder != null)
            {
                dto.HasDynamicCategories = false;
            }
        }
开发者ID:loose-wardrobe,项目名称:Emby,代码行数:66,代码来源:DtoService.cs

示例2: AttachUserSpecificInfo

        /// <summary>
        /// Attaches the user specific info.
        /// </summary>
        private async Task AttachUserSpecificInfo(BaseItemDto dto, BaseItem item, User user, DtoOptions dtoOptions)
        {
            var fields = dtoOptions.Fields;

            if (item.IsFolder)
            {
                var folder = (Folder)item;

                if (dtoOptions.EnableUserData)
                {
                    dto.UserData = await _userDataRepository.GetUserDataDto(item, dto, user).ConfigureAwait(false);
                }

                if (!dto.ChildCount.HasValue && item.SourceType == SourceType.Library)
                {
                    dto.ChildCount = GetChildCount(folder, user);
                }

                if (fields.Contains(ItemFields.CumulativeRunTimeTicks))
                {
                    dto.CumulativeRunTimeTicks = item.RunTimeTicks;
                }

                if (fields.Contains(ItemFields.DateLastMediaAdded))
                {
                    dto.DateLastMediaAdded = folder.DateLastMediaAdded;
                }
            }

            else
            {
                if (dtoOptions.EnableUserData)
                {
                    dto.UserData = _userDataRepository.GetUserDataDto(item, user).Result;
                }
            }

            dto.PlayAccess = item.GetPlayAccess(user);

            if (fields.Contains(ItemFields.BasicSyncInfo) || fields.Contains(ItemFields.SyncInfo))
            {
                var userCanSync = user != null && user.Policy.EnableSync;
                if (userCanSync && _syncManager.SupportsSync(item))
                {
                    dto.SupportsSync = true;
                }
            }

            if (fields.Contains(ItemFields.SeasonUserData))
            {
                var episode = item as Episode;

                if (episode != null)
                {
                    var season = episode.Season;

                    if (season != null)
                    {
                        dto.SeasonUserData = await _userDataRepository.GetUserDataDto(season, user).ConfigureAwait(false);
                    }
                }
            }

            var userView = item as UserView;
            if (userView != null)
            {
                dto.HasDynamicCategories = userView.ContainsDynamicCategories(user);
            }

            var collectionFolder = item as ICollectionFolder;
            if (collectionFolder != null)
            {
                dto.HasDynamicCategories = false;
            }
        }
开发者ID:t-andre,项目名称:Emby,代码行数:78,代码来源:DtoService.cs

示例3: AttachUserSpecificInfo

        /// <summary>
        /// Attaches the user specific info.
        /// </summary>
        /// <param name="dto">The dto.</param>
        /// <param name="item">The item.</param>
        /// <param name="user">The user.</param>
        /// <param name="fields">The fields.</param>
        /// <param name="syncProgress">The synchronize progress.</param>
        private void AttachUserSpecificInfo(BaseItemDto dto, BaseItem item, User user, List<ItemFields> fields, Dictionary<string, SyncedItemProgress> syncProgress)
        {
            if (item.IsFolder)
            {
                var userData = _userDataRepository.GetUserData(user, item);

                // Skip the user data manager because we've already looped through the recursive tree and don't want to do it twice
                // TODO: Improve in future
                dto.UserData = GetUserItemDataDto(userData);

                var folder = (Folder)item;

                if (item.SourceType == SourceType.Library)
                {
                    dto.ChildCount = GetChildCount(folder, user);

                    if (folder.SupportsUserDataFromChildren)
                    {
                        SetSpecialCounts(folder, user, dto, fields, syncProgress);
                    }
                }

                if (fields.Contains(ItemFields.CumulativeRunTimeTicks))
                {
                    dto.CumulativeRunTimeTicks = item.RunTimeTicks;
                }

                if (fields.Contains(ItemFields.DateLastMediaAdded))
                {
                    dto.DateLastMediaAdded = folder.DateLastMediaAdded;
                }

                dto.UserData.Played = dto.UserData.PlayedPercentage.HasValue && dto.UserData.PlayedPercentage.Value >= 100;
            }

            else
            {
                dto.UserData = _userDataRepository.GetUserDataDto(item, user);
            }

            dto.PlayAccess = item.GetPlayAccess(user);

            if (fields.Contains(ItemFields.SeasonUserData))
            {
                var episode = item as Episode;

                if (episode != null)
                {
                    var season = episode.Season;

                    if (season != null)
                    {
                        dto.SeasonUserData = _userDataRepository.GetUserDataDto(season, user);
                    }
                }
            }

            var userView = item as UserView;
            if (userView != null)
            {
                dto.HasDynamicCategories = userView.ContainsDynamicCategories(user);
            }

            var collectionFolder = item as ICollectionFolder;
            if (collectionFolder != null)
            {
                dto.HasDynamicCategories = false;
            }
        }
开发者ID:paul-777,项目名称:Emby,代码行数:77,代码来源:DtoService.cs

示例4: AttachUserSpecificInfo

        /// <summary>
        /// Attaches the user specific info.
        /// </summary>
        /// <param name="dto">The dto.</param>
        /// <param name="item">The item.</param>
        /// <param name="user">The user.</param>
        /// <param name="fields">The fields.</param>
        private void AttachUserSpecificInfo(BaseItemDto dto, BaseItem item, User user, List<ItemFields> fields)
        {
            if (item.IsFolder)
            {
                var folder = (Folder)item;

                dto.ChildCount = GetChildCount(folder, user);

                if (!(folder is UserRootFolder))
                {
                    SetSpecialCounts(folder, user, dto, fields);
                }
            }

            var userData = _userDataRepository.GetUserData(user.Id, item.GetUserDataKey());

            dto.UserData = GetUserItemDataDto(userData);

            if (item.IsFolder)
            {
                dto.UserData.Played = dto.PlayedPercentage.HasValue && dto.PlayedPercentage.Value >= 100;
            }

            dto.PlayAccess = item.GetPlayAccess(user);
        }
开发者ID:Tensre,项目名称:MediaBrowser,代码行数:32,代码来源:DtoService.cs


注:本文中的BaseItem.GetPlayAccess方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。