本文整理汇总了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;
}
}
示例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;
}
}
示例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;
}
}
示例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);
}