本文整理汇总了C#中MediaBrowser.Controller.Entities.User类的典型用法代码示例。如果您正苦于以下问题:C# User类的具体用法?C# User怎么用?C# User使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
User类属于MediaBrowser.Controller.Entities命名空间,在下文中一共展示了User类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetNextUpEpisodes
public IEnumerable<Episode> GetNextUpEpisodes(NextUpQuery request, User user, IEnumerable<Series> series)
{
// Avoid implicitly captured closure
var currentUser = user;
return FilterSeries(request, series)
.AsParallel()
.Select(i => GetNextUp(i, currentUser))
.Where(i => i.Item1 != null)
.OrderByDescending(i =>
{
var episode = i.Item1;
var seriesUserData = _userDataManager.GetUserData(user.Id, episode.Series.GetUserDataKey());
if (seriesUserData.IsFavorite)
{
return 2;
}
if (seriesUserData.Likes.HasValue)
{
return seriesUserData.Likes.Value ? 1 : -1;
}
return 0;
})
.ThenByDescending(i => i.Item2)
.ThenByDescending(i => i.Item1.PremiereDate ?? DateTime.MinValue)
.Select(i => i.Item1);
}
示例2: RenameVirtualFolder
/// <summary>
/// Renames the virtual folder.
/// </summary>
/// <param name="name">The name.</param>
/// <param name="newName">The new name.</param>
/// <param name="user">The user.</param>
/// <param name="appPaths">The app paths.</param>
/// <exception cref="System.IO.DirectoryNotFoundException">The media collection does not exist</exception>
/// <exception cref="System.ArgumentException">There is already a media collection with the name + newPath + .</exception>
public static void RenameVirtualFolder(string name, string newName, User user, IServerApplicationPaths appPaths)
{
var rootFolderPath = user != null ? user.RootFolderPath : appPaths.DefaultUserViewsPath;
var currentPath = Path.Combine(rootFolderPath, name);
var newPath = Path.Combine(rootFolderPath, newName);
if (!Directory.Exists(currentPath))
{
throw new DirectoryNotFoundException("The media collection does not exist");
}
if (!string.Equals(currentPath, newPath, StringComparison.OrdinalIgnoreCase) && Directory.Exists(newPath))
{
throw new ArgumentException("There is already a media collection with the name " + newPath + ".");
}
//Only make a two-phase move when changing capitalization
if (string.Equals(currentPath, newPath, StringComparison.OrdinalIgnoreCase))
{
//Create an unique name
var temporaryName = Guid.NewGuid().ToString();
var temporaryPath = Path.Combine(rootFolderPath, temporaryName);
Directory.Move(currentPath,temporaryPath);
currentPath = temporaryPath;
}
Directory.Move(currentPath, newPath);
}
示例3: OpenDashboardPage
/// <summary>
/// Opens the dashboard page.
/// </summary>
/// <param name="page">The page.</param>
/// <param name="loggedInUser">The logged in user.</param>
/// <param name="configurationManager">The configuration manager.</param>
/// <param name="appHost">The app host.</param>
/// <param name="logger">The logger.</param>
public static void OpenDashboardPage(string page, User loggedInUser, IServerConfigurationManager configurationManager, IServerApplicationHost appHost, ILogger logger)
{
var url = "http://localhost:" + configurationManager.Configuration.HttpServerPortNumber + "/" +
appHost.WebApplicationName + "/dashboard/" + page;
OpenUrl(url, logger);
}
示例4: GetCollections
public IEnumerable<BoxSet> GetCollections(User user)
{
var folder = GetCollectionsFolder(user.Id.ToString("N"));
return folder == null ?
new List<BoxSet>() :
folder.GetChildren(user, true).OfType<BoxSet>();
}
示例5: AddMediaPath
/// <summary>
/// Adds an additional mediaPath to an existing virtual folder, within either the default view or a user view
/// </summary>
/// <param name="fileSystem">The file system.</param>
/// <param name="virtualFolderName">Name of the virtual folder.</param>
/// <param name="path">The path.</param>
/// <param name="user">The user.</param>
/// <param name="appPaths">The app paths.</param>
/// <exception cref="System.ArgumentException">The path is not valid.</exception>
/// <exception cref="System.IO.DirectoryNotFoundException">The path does not exist.</exception>
public static void AddMediaPath(IFileSystem fileSystem, string virtualFolderName, string path, User user, IServerApplicationPaths appPaths)
{
if (!Directory.Exists(path))
{
throw new DirectoryNotFoundException("The path does not exist.");
}
// Strip off trailing slash, but not on drives
path = path.TrimEnd(Path.DirectorySeparatorChar);
if (path.EndsWith(":", StringComparison.OrdinalIgnoreCase))
{
path += Path.DirectorySeparatorChar;
}
var rootFolderPath = user != null ? user.RootFolderPath : appPaths.DefaultUserViewsPath;
var virtualFolderPath = Path.Combine(rootFolderPath, virtualFolderName);
ValidateNewMediaPath(fileSystem, rootFolderPath, path, appPaths);
var shortcutFilename = Path.GetFileNameWithoutExtension(path);
var lnk = Path.Combine(virtualFolderPath, shortcutFilename + ShortcutFileExtension);
while (File.Exists(lnk))
{
shortcutFilename += "1";
lnk = Path.Combine(virtualFolderPath, shortcutFilename + ShortcutFileExtension);
}
fileSystem.CreateShortcut(lnk, path);
}
示例6: GetNextUpEpisodes
public IEnumerable<Episode> GetNextUpEpisodes(NextUpQuery request, User user, IEnumerable<Series> series)
{
// Avoid implicitly captured closure
var currentUser = user;
return FilterSeries(request, series)
.AsParallel()
.Select(i => GetNextUp(i, currentUser))
// Include if an episode was found, and either the series is not unwatched or the specific series was requested
.Where(i => i.Item1 != null && (!i.Item3 || !string.IsNullOrWhiteSpace(request.SeriesId)))
.OrderByDescending(i =>
{
var episode = i.Item1;
var seriesUserData = _userDataManager.GetUserData(user.Id, episode.Series.GetUserDataKey());
if (seriesUserData.IsFavorite)
{
return 2;
}
if (seriesUserData.Likes.HasValue)
{
return seriesUserData.Likes.Value ? 1 : -1;
}
return 0;
})
.ThenByDescending(i => i.Item2)
.ThenByDescending(i => i.Item1.PremiereDate ?? DateTime.MinValue)
.Select(i => i.Item1);
}
示例7: DidlBuilder
public DidlBuilder(DeviceProfile profile, User user, IImageProcessor imageProcessor, string serverAddress)
{
_profile = profile;
_imageProcessor = imageProcessor;
_serverAddress = serverAddress;
_user = user;
}
示例8: GetEligibleChildrenForRecursiveChildren
protected override IEnumerable<BaseItem> GetEligibleChildrenForRecursiveChildren(User user)
{
var list = base.GetEligibleChildrenForRecursiveChildren(user).ToList();
list.AddRange(LibraryManager.RootFolder.VirtualChildren);
return list;
}
示例9: GetPlaylistItems
public static IEnumerable<BaseItem> GetPlaylistItems(string playlistMediaType, IEnumerable<BaseItem> inputItems, User user)
{
return inputItems.SelectMany(i =>
{
var folder = i as Folder;
if (folder != null)
{
var items = user == null
? folder.GetRecursiveChildren()
: folder.GetRecursiveChildren(user, true);
items = items
.Where(m => !m.IsFolder);
if (!folder.IsPreSorted)
{
items = LibraryManager.Sort(items, user, new[] { ItemSortBy.SortName }, SortOrder.Ascending);
}
return items;
}
return new[] { i };
}).Where(m => string.Equals(m.MediaType, playlistMediaType, StringComparison.OrdinalIgnoreCase));
}
示例10: GetInstantMixFromGenres
public IEnumerable<Audio> GetInstantMixFromGenres(IEnumerable<string> genres, User user)
{
var genreList = genres.ToList();
var inputItems = _libraryManager.GetItems(new InternalItemsQuery
{
IncludeItemTypes = new[] { typeof(Audio).Name },
Genres = genreList.ToArray(),
User = user
}).Items;
var genresDictionary = genreList.ToDictionary(i => i, StringComparer.OrdinalIgnoreCase);
return inputItems
.Cast<Audio>()
.Select(i => new Tuple<Audio, int>(i, i.Genres.Count(genresDictionary.ContainsKey)))
.Where(i => i.Item2 > 0)
.OrderByDescending(i => i.Item2)
.ThenBy(i => Guid.NewGuid())
.Select(i => i.Item1)
.Take(100)
.OrderBy(i => Guid.NewGuid());
}
示例11: GetUserDistinctValue
public static string GetUserDistinctValue(User user)
{
var channels = user.Policy.EnabledChannels
.OrderBy(i => i)
.ToList();
return string.Join("|", channels.ToArray());
}
示例12: IsVisible
public override bool IsVisible(User user)
{
if (!user.Policy.EnableAllFolders && !user.Policy.EnabledFolders.Contains(Id.ToString("N"), StringComparer.OrdinalIgnoreCase))
{
return false;
}
return base.IsVisible(user) && HasChildren();
}
示例13: GetViewType
public static string GetViewType(this ICollectionFolder folder, User user)
{
if (user.Configuration.PlainFolderViews.Contains(folder.Id.ToString("N"), StringComparer.OrdinalIgnoreCase))
{
return null;
}
return folder.CollectionType;
}
示例14: GetMediaFolders
private IEnumerable<Folder> GetMediaFolders(User user)
{
var excludeFolderIds = user.Configuration.ExcludeFoldersFromGrouping.Select(i => new Guid(i)).ToList();
return user.RootFolder
.GetChildren(user, true, true)
.OfType<Folder>()
.Where(i => !excludeFolderIds.Contains(i.Id) && !IsExcludedFromGrouping(i));
}
示例15: IsVisible
public override bool IsVisible(User user)
{
if (user.Configuration.BlockedChannels.Contains(Id.ToString("N"), StringComparer.OrdinalIgnoreCase))
{
return false;
}
return base.IsVisible(user);
}