From 4e04d31c7d13c2cec4f633ceab57acd8dae7ddc5 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Fri, 29 May 2015 19:51:33 -0400 Subject: [PATCH] consolidate slideout panels --- MediaBrowser.Api/BaseApiService.cs | 12 ++++---- MediaBrowser.Api/DisplayPreferencesService.cs | 4 +-- MediaBrowser.Api/GamesService.cs | 6 ++-- MediaBrowser.Api/Library/LibraryService.cs | 28 +++++++++---------- MediaBrowser.Api/Movies/CollectionService.cs | 16 +++++------ MediaBrowser.Api/Movies/MoviesService.cs | 8 +++--- MediaBrowser.Api/Movies/TrailersService.cs | 4 +-- MediaBrowser.Api/Music/InstantMixService.cs | 14 +++++----- MediaBrowser.Api/PluginService.cs | 12 ++++---- MediaBrowser.Api/Reports/ReportRequests.cs | 9 +++--- MediaBrowser.Api/Reports/ReportsService.cs | 2 +- MediaBrowser.Api/Session/SessionsService.cs | 12 ++++---- MediaBrowser.Api/SimilarItemsHelper.cs | 6 ++-- MediaBrowser.Api/TvShowsService.cs | 10 +++---- .../UserLibrary/ArtistsService.cs | 6 ++-- .../UserLibrary/BaseItemsByNameService.cs | 8 +++--- .../UserLibrary/GameGenresService.cs | 6 ++-- MediaBrowser.Api/UserLibrary/GenresService.cs | 6 ++-- MediaBrowser.Api/UserLibrary/ItemsService.cs | 4 +-- .../UserLibrary/MusicGenresService.cs | 6 ++-- .../UserLibrary/PersonsService.cs | 6 ++-- .../UserLibrary/PlaystateService.cs | 10 +++---- .../UserLibrary/StudiosService.cs | 6 ++-- .../UserLibrary/UserLibraryService.cs | 24 ++++++++-------- MediaBrowser.Api/UserLibrary/YearsService.cs | 6 ++-- MediaBrowser.Api/VideosService.cs | 6 ++-- .../Library/IUserDataManager.cs | 8 ++++++ .../IDisplayPreferencesRepository.cs | 6 ++-- .../Session/ISessionManager.cs | 4 +-- .../Library/UserDataManager.cs | 8 ++++-- .../Localization/JavaScript/javascript.json | 7 +++-- .../SqliteDisplayPreferencesRepository.cs | 10 +++++++ .../Session/SessionManager.cs | 14 +++++----- .../MediaBrowser.WebDashboard.csproj | 12 ++++++++ 34 files changed, 171 insertions(+), 135 deletions(-) diff --git a/MediaBrowser.Api/BaseApiService.cs b/MediaBrowser.Api/BaseApiService.cs index 66b2a314e..d4b5be584 100644 --- a/MediaBrowser.Api/BaseApiService.cs +++ b/MediaBrowser.Api/BaseApiService.cs @@ -198,15 +198,15 @@ namespace MediaBrowser.Api return libraryManager.GetPerson(DeSlugPersonName(name, libraryManager)); } - protected IList GetAllLibraryItems(Guid? userId, IUserManager userManager, ILibraryManager libraryManager, string parentId, Func filter) + protected IList GetAllLibraryItems(string userId, IUserManager userManager, ILibraryManager libraryManager, string parentId, Func filter) { if (!string.IsNullOrEmpty(parentId)) { var folder = (Folder)libraryManager.GetItemById(new Guid(parentId)); - if (userId.HasValue) + if (!string.IsNullOrWhiteSpace(userId)) { - var user = userManager.GetUserById(userId.Value); + var user = userManager.GetUserById(userId); if (user == null) { @@ -221,9 +221,9 @@ namespace MediaBrowser.Api return folder .GetRecursiveChildren(filter); } - if (userId.HasValue) + if (!string.IsNullOrWhiteSpace(userId)) { - var user = userManager.GetUserById(userId.Value); + var user = userManager.GetUserById(userId); if (user == null) { @@ -231,7 +231,7 @@ namespace MediaBrowser.Api } return userManager - .GetUserById(userId.Value) + .GetUserById(userId) .RootFolder .GetRecursiveChildren(user, filter) .ToList(); diff --git a/MediaBrowser.Api/DisplayPreferencesService.cs b/MediaBrowser.Api/DisplayPreferencesService.cs index 72b12020d..df04de79e 100644 --- a/MediaBrowser.Api/DisplayPreferencesService.cs +++ b/MediaBrowser.Api/DisplayPreferencesService.cs @@ -23,7 +23,7 @@ namespace MediaBrowser.Api public string DisplayPreferencesId { get; set; } [ApiMember(Name = "UserId", Description = "User Id", IsRequired = true, DataType = "string", ParameterType = "query", Verb = "POST")] - public Guid UserId { get; set; } + public string UserId { get; set; } } [Route("/DisplayPreferences/{Id}", "GET", Summary = "Gets a user's display preferences for an item")] @@ -37,7 +37,7 @@ namespace MediaBrowser.Api public string Id { get; set; } [ApiMember(Name = "UserId", Description = "User Id", IsRequired = true, DataType = "string", ParameterType = "query", Verb = "GET")] - public Guid UserId { get; set; } + public string UserId { get; set; } [ApiMember(Name = "Client", Description = "Client", IsRequired = true, DataType = "string", ParameterType = "query", Verb = "GET")] public string Client { get; set; } diff --git a/MediaBrowser.Api/GamesService.cs b/MediaBrowser.Api/GamesService.cs index c18c32920..93cc01079 100644 --- a/MediaBrowser.Api/GamesService.cs +++ b/MediaBrowser.Api/GamesService.cs @@ -32,7 +32,7 @@ namespace MediaBrowser.Api /// /// The user id. [ApiMember(Name = "UserId", Description = "Optional. Filter by user id", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")] - public Guid? UserId { get; set; } + public string UserId { get; set; } } /// @@ -46,7 +46,7 @@ namespace MediaBrowser.Api /// /// The user id. [ApiMember(Name = "UserId", Description = "Optional. Filter by user id", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")] - public Guid? UserId { get; set; } + public string UserId { get; set; } } /// @@ -106,7 +106,7 @@ namespace MediaBrowser.Api .Cast() .ToList(); - var user = request.UserId == null ? null : _userManager.GetUserById(request.UserId.Value); + var user = request.UserId == null ? null : _userManager.GetUserById(request.UserId); var result = gameSystems .Select(i => GetSummary(i, user)) diff --git a/MediaBrowser.Api/Library/LibraryService.cs b/MediaBrowser.Api/Library/LibraryService.cs index 269f4cb20..e8340a1cb 100644 --- a/MediaBrowser.Api/Library/LibraryService.cs +++ b/MediaBrowser.Api/Library/LibraryService.cs @@ -77,7 +77,7 @@ namespace MediaBrowser.Api.Library /// /// The user id. [ApiMember(Name = "UserId", Description = "Optional. Filter by user id, and attach user data", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")] - public Guid? UserId { get; set; } + public string UserId { get; set; } /// /// Gets or sets the id. @@ -102,7 +102,7 @@ namespace MediaBrowser.Api.Library /// /// The user id. [ApiMember(Name = "UserId", Description = "Optional. Filter by user id, and attach user data", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")] - public Guid? UserId { get; set; } + public string UserId { get; set; } /// /// Gets or sets the id. @@ -127,7 +127,7 @@ namespace MediaBrowser.Api.Library /// /// The user id. [ApiMember(Name = "UserId", Description = "Optional. Filter by user id, and attach user data", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")] - public Guid? UserId { get; set; } + public string UserId { get; set; } /// /// Gets or sets the id. @@ -159,7 +159,7 @@ namespace MediaBrowser.Api.Library public class GetItemCounts : IReturn { [ApiMember(Name = "UserId", Description = "Optional. Get counts from a specific user's library.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")] - public Guid? UserId { get; set; } + public string UserId { get; set; } [ApiMember(Name = "IsFavorite", Description = "Optional. Get counts of favorite items", IsRequired = false, DataType = "bool", ParameterType = "query", Verb = "GET")] public bool? IsFavorite { get; set; } @@ -174,7 +174,7 @@ namespace MediaBrowser.Api.Library /// /// The user id. [ApiMember(Name = "UserId", Description = "Optional. Filter by user id, and attach user data", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")] - public Guid? UserId { get; set; } + public string UserId { get; set; } /// /// Gets or sets the id. @@ -193,7 +193,7 @@ namespace MediaBrowser.Api.Library /// /// The user id. [ApiMember(Name = "UserId", Description = "Optional. Filter by user id, and attach user data", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")] - public Guid? UserId { get; set; } + public string UserId { get; set; } [ApiMember(Name = "IncludeItemTypes", Description = "Optional. If specified, results will be filtered based on item type. This allows multiple, comma delimeted.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET", AllowMultiple = true)] public string IncludeItemTypes { get; set; } @@ -412,7 +412,7 @@ namespace MediaBrowser.Api.Library var baseItemDtos = new List(); - var user = request.UserId.HasValue ? _userManager.GetUserById(request.UserId.Value) : null; + var user = !string.IsNullOrWhiteSpace(request.UserId) ? _userManager.GetUserById(request.UserId) : null; var dtoOptions = GetDtoOptions(request); @@ -483,15 +483,15 @@ namespace MediaBrowser.Api.Library return ToOptimizedSerializedResultUsingCache(counts); } - private bool FilterItem(BaseItem item, GetItemCounts request, Guid? userId) + private bool FilterItem(BaseItem item, GetItemCounts request, string userId) { - if (userId.HasValue) + if (!string.IsNullOrWhiteSpace(userId)) { if (request.IsFavorite.HasValue) { var val = request.IsFavorite.Value; - if (_userDataManager.GetUserData(userId.Value, item.GetUserDataKey()).IsFavorite != val) + if (_userDataManager.GetUserData(userId, item.GetUserDataKey()).IsFavorite != val) { return false; } @@ -609,10 +609,10 @@ namespace MediaBrowser.Api.Library private ThemeMediaResult GetThemeSongs(GetThemeSongs request) { - var user = request.UserId.HasValue ? _userManager.GetUserById(request.UserId.Value) : null; + var user = !string.IsNullOrWhiteSpace(request.UserId) ? _userManager.GetUserById(request.UserId) : null; var item = string.IsNullOrEmpty(request.Id) - ? (request.UserId.HasValue + ? (!string.IsNullOrWhiteSpace(request.UserId) ? user.RootFolder : (Folder)_libraryManager.RootFolder) : _libraryManager.GetItemById(request.Id); @@ -652,10 +652,10 @@ namespace MediaBrowser.Api.Library public ThemeMediaResult GetThemeVideos(GetThemeVideos request) { - var user = request.UserId.HasValue ? _userManager.GetUserById(request.UserId.Value) : null; + var user = !string.IsNullOrWhiteSpace(request.UserId) ? _userManager.GetUserById(request.UserId) : null; var item = string.IsNullOrEmpty(request.Id) - ? (request.UserId.HasValue + ? (!string.IsNullOrWhiteSpace(request.UserId) ? user.RootFolder : (Folder)_libraryManager.RootFolder) : _libraryManager.GetItemById(request.Id); diff --git a/MediaBrowser.Api/Movies/CollectionService.cs b/MediaBrowser.Api/Movies/CollectionService.cs index ec3265b56..e8c33abc6 100644 --- a/MediaBrowser.Api/Movies/CollectionService.cs +++ b/MediaBrowser.Api/Movies/CollectionService.cs @@ -2,8 +2,6 @@ using MediaBrowser.Controller.Dto; using MediaBrowser.Controller.Net; using MediaBrowser.Model.Collections; -using MediaBrowser.Model.Dto; -using MediaBrowser.Model.Querying; using ServiceStack; using System; using System.Collections.Generic; @@ -22,7 +20,7 @@ namespace MediaBrowser.Api.Movies public string Name { get; set; } [ApiMember(Name = "ParentId", Description = "Optional - create the collection within a specific folder", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "POST")] - public Guid? ParentId { get; set; } + public string ParentId { get; set; } [ApiMember(Name = "Ids", Description = "Item Ids to add to the collection", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "POST", AllowMultiple = true)] public string Ids { get; set; } @@ -35,7 +33,7 @@ namespace MediaBrowser.Api.Movies public string Ids { get; set; } [ApiMember(Name = "Id", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "POST")] - public Guid Id { get; set; } + public string Id { get; set; } } [Route("/Collections/{Id}/Items", "DELETE", Summary = "Removes items from a collection")] @@ -45,7 +43,7 @@ namespace MediaBrowser.Api.Movies public string Ids { get; set; } [ApiMember(Name = "Id", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "DELETE")] - public Guid Id { get; set; } + public string Id { get; set; } } [Authenticated] @@ -64,11 +62,13 @@ namespace MediaBrowser.Api.Movies { var userId = AuthorizationContext.GetAuthorizationInfo(Request).UserId; + var parentId = string.IsNullOrWhiteSpace(request.ParentId) ? (Guid?)null : new Guid(request.ParentId); + var item = await _collectionManager.CreateCollection(new CollectionCreationOptions { IsLocked = request.IsLocked, Name = request.Name, - ParentId = request.ParentId, + ParentId = parentId, ItemIdList = (request.Ids ?? string.Empty).Split(',').Where(i => !string.IsNullOrWhiteSpace(i)).Select(i => new Guid(i)).ToList(), UserIds = new List { new Guid(userId) } @@ -86,14 +86,14 @@ namespace MediaBrowser.Api.Movies public void Post(AddToCollection request) { - var task = _collectionManager.AddToCollection(request.Id, request.Ids.Split(',').Select(i => new Guid(i))); + var task = _collectionManager.AddToCollection(new Guid(request.Id), request.Ids.Split(',').Select(i => new Guid(i))); Task.WaitAll(task); } public void Delete(RemoveFromCollection request) { - var task = _collectionManager.RemoveFromCollection(request.Id, request.Ids.Split(',').Select(i => new Guid(i))); + var task = _collectionManager.RemoveFromCollection(new Guid(request.Id), request.Ids.Split(',').Select(i => new Guid(i))); Task.WaitAll(task); } diff --git a/MediaBrowser.Api/Movies/MoviesService.cs b/MediaBrowser.Api/Movies/MoviesService.cs index 1a7f6d8f4..513bde871 100644 --- a/MediaBrowser.Api/Movies/MoviesService.cs +++ b/MediaBrowser.Api/Movies/MoviesService.cs @@ -42,7 +42,7 @@ namespace MediaBrowser.Api.Movies /// /// The user id. [ApiMember(Name = "UserId", Description = "Optional. Filter by user id, and attach user data", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")] - public Guid? UserId { get; set; } + public string UserId { get; set; } /// /// Specify this to localize the search to a specific item or folder. Omit to use the root. @@ -119,7 +119,7 @@ namespace MediaBrowser.Api.Movies public async Task Get(GetMovieRecommendations request) { - var user = _userManager.GetUserById(request.UserId.Value); + var user = _userManager.GetUserById(request.UserId); IEnumerable movies = GetAllLibraryItems(request.UserId, _userManager, _libraryManager, request.ParentId, i => i is Movie); @@ -167,10 +167,10 @@ namespace MediaBrowser.Api.Movies private async Task GetSimilarItemsResult(BaseGetSimilarItemsFromItem request, Func includeInSearch, Func getSimilarityScore) { - var user = request.UserId.HasValue ? _userManager.GetUserById(request.UserId.Value) : null; + var user = !string.IsNullOrWhiteSpace(request.UserId) ? _userManager.GetUserById(request.UserId) : null; var item = string.IsNullOrEmpty(request.Id) ? - (request.UserId.HasValue ? user.RootFolder : + (!string.IsNullOrWhiteSpace(request.UserId) ? user.RootFolder : _libraryManager.RootFolder) : _libraryManager.GetItemById(request.Id); Func filter = i => i.Id != item.Id && includeInSearch(i); diff --git a/MediaBrowser.Api/Movies/TrailersService.cs b/MediaBrowser.Api/Movies/TrailersService.cs index 3bee59a86..c807bfde6 100644 --- a/MediaBrowser.Api/Movies/TrailersService.cs +++ b/MediaBrowser.Api/Movies/TrailersService.cs @@ -34,7 +34,7 @@ namespace MediaBrowser.Api.Movies /// /// The user id. [ApiMember(Name = "UserId", Description = "User Id", IsRequired = false, DataType = "string", ParameterType = "path", Verb = "GET")] - public Guid? UserId { get; set; } + public string UserId { get; set; } } /// @@ -103,7 +103,7 @@ namespace MediaBrowser.Api.Movies public async Task Get(Getrailers request) { - var user = request.UserId.HasValue ? _userManager.GetUserById(request.UserId.Value) : null; + var user = !string.IsNullOrWhiteSpace(request.UserId) ? _userManager.GetUserById(request.UserId) : null; var result = await GetAllTrailers(user).ConfigureAwait(false); IEnumerable items = result.Items; diff --git a/MediaBrowser.Api/Music/InstantMixService.cs b/MediaBrowser.Api/Music/InstantMixService.cs index 46034dc61..506b7bc3a 100644 --- a/MediaBrowser.Api/Music/InstantMixService.cs +++ b/MediaBrowser.Api/Music/InstantMixService.cs @@ -75,7 +75,7 @@ namespace MediaBrowser.Api.Music { var item = _libraryManager.GetItemById(request.Id); - var user = _userManager.GetUserById(request.UserId.Value); + var user = _userManager.GetUserById(request.UserId); var items = _musicManager.GetInstantMixFromItem(item, user); @@ -86,7 +86,7 @@ namespace MediaBrowser.Api.Music { var item = _libraryManager.GetItemById(request.Id); - var user = _userManager.GetUserById(request.UserId.Value); + var user = _userManager.GetUserById(request.UserId); var items = _musicManager.GetInstantMixFromItem(item, user); @@ -97,7 +97,7 @@ namespace MediaBrowser.Api.Music { var item = _libraryManager.GetItemById(request.Id); - var user = _userManager.GetUserById(request.UserId.Value); + var user = _userManager.GetUserById(request.UserId); var items = _musicManager.GetInstantMixFromItem(item, user); @@ -108,7 +108,7 @@ namespace MediaBrowser.Api.Music { var album = _libraryManager.GetItemById(request.Id); - var user = _userManager.GetUserById(request.UserId.Value); + var user = _userManager.GetUserById(request.UserId); var items = _musicManager.GetInstantMixFromItem(album, user); @@ -119,7 +119,7 @@ namespace MediaBrowser.Api.Music { var playlist = (Playlist)_libraryManager.GetItemById(request.Id); - var user = _userManager.GetUserById(request.UserId.Value); + var user = _userManager.GetUserById(request.UserId); var items = _musicManager.GetInstantMixFromItem(playlist, user); @@ -128,7 +128,7 @@ namespace MediaBrowser.Api.Music public object Get(GetInstantMixFromMusicGenre request) { - var user = _userManager.GetUserById(request.UserId.Value); + var user = _userManager.GetUserById(request.UserId); var items = _musicManager.GetInstantMixFromGenres(new[] { request.Name }, user); @@ -137,7 +137,7 @@ namespace MediaBrowser.Api.Music public object Get(GetInstantMixFromArtist request) { - var user = _userManager.GetUserById(request.UserId.Value); + var user = _userManager.GetUserById(request.UserId); var items = _musicManager.GetInstantMixFromArtist(request.Name, user); diff --git a/MediaBrowser.Api/PluginService.cs b/MediaBrowser.Api/PluginService.cs index 4af9bfe58..eb49914eb 100644 --- a/MediaBrowser.Api/PluginService.cs +++ b/MediaBrowser.Api/PluginService.cs @@ -42,7 +42,7 @@ namespace MediaBrowser.Api /// /// The id. [ApiMember(Name = "Id", Description = "Plugin Id", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "DELETE")] - public Guid Id { get; set; } + public string Id { get; set; } } /// @@ -57,7 +57,7 @@ namespace MediaBrowser.Api /// /// The id. [ApiMember(Name = "Id", Description = "Plugin Id", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "GET")] - public Guid Id { get; set; } + public string Id { get; set; } } /// @@ -72,7 +72,7 @@ namespace MediaBrowser.Api /// /// The id. [ApiMember(Name = "Id", Description = "Plugin Id", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "POST")] - public Guid Id { get; set; } + public string Id { get; set; } /// /// The raw Http Request Input Stream @@ -239,7 +239,8 @@ namespace MediaBrowser.Api /// System.Object. public object Get(GetPluginConfiguration request) { - var plugin = _appHost.Plugins.First(p => p.Id == request.Id); + var guid = new Guid(request.Id); + var plugin = _appHost.Plugins.First(p => p.Id == guid); var dateModified = plugin.ConfigurationDateLastModified; @@ -298,7 +299,8 @@ namespace MediaBrowser.Api /// The request. public void Delete(UninstallPlugin request) { - var plugin = _appHost.Plugins.First(p => p.Id == request.Id); + var guid = new Guid(request.Id); + var plugin = _appHost.Plugins.First(p => p.Id == guid); _installationManager.UninstallPlugin(plugin); } diff --git a/MediaBrowser.Api/Reports/ReportRequests.cs b/MediaBrowser.Api/Reports/ReportRequests.cs index 939b49282..7fe0bfba1 100644 --- a/MediaBrowser.Api/Reports/ReportRequests.cs +++ b/MediaBrowser.Api/Reports/ReportRequests.cs @@ -1,10 +1,9 @@ -using System; -using System.Linq; -using MediaBrowser.Api.UserLibrary; -using MediaBrowser.Controller.Net; +using MediaBrowser.Api.UserLibrary; using MediaBrowser.Model.Entities; using ServiceStack; +using System; using System.Collections.Generic; +using System.Linq; namespace MediaBrowser.Api.Reports { @@ -15,7 +14,7 @@ namespace MediaBrowser.Api.Reports /// /// The user id. [ApiMember(Name = "UserId", Description = "User Id", IsRequired = false, DataType = "string", ParameterType = "path", Verb = "GET")] - public Guid? UserId { get; set; } + public string UserId { get; set; } /// /// Limit results to items containing a specific person diff --git a/MediaBrowser.Api/Reports/ReportsService.cs b/MediaBrowser.Api/Reports/ReportsService.cs index b13e5628c..4438876f7 100644 --- a/MediaBrowser.Api/Reports/ReportsService.cs +++ b/MediaBrowser.Api/Reports/ReportsService.cs @@ -175,7 +175,7 @@ namespace MediaBrowser.Api.Reports { // Placeholder in case needed later request.Recursive = true; - var user = request.UserId.HasValue ? _userManager.GetUserById(request.UserId.Value) : null; + var user = !string.IsNullOrWhiteSpace(request.UserId) ? _userManager.GetUserById(request.UserId) : null; request.Fields = "MediaSources,DateCreated,Settings,Studios,SyncInfo,ItemCounts"; var parentItem = string.IsNullOrEmpty(request.ParentId) ? diff --git a/MediaBrowser.Api/Session/SessionsService.cs b/MediaBrowser.Api/Session/SessionsService.cs index d4ea6a0eb..1160f685c 100644 --- a/MediaBrowser.Api/Session/SessionsService.cs +++ b/MediaBrowser.Api/Session/SessionsService.cs @@ -21,7 +21,7 @@ namespace MediaBrowser.Api.Session public class GetSessions : IReturn> { [ApiMember(Name = "ControllableByUserId", Description = "Optional. Filter by sessions that a given user is allowed to remote control.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")] - public Guid? ControllableByUserId { get; set; } + public string ControllableByUserId { get; set; } [ApiMember(Name = "DeviceId", Description = "Optional. Filter by device id.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")] public string DeviceId { get; set; } @@ -200,7 +200,7 @@ namespace MediaBrowser.Api.Session public string Id { get; set; } [ApiMember(Name = "UserId", Description = "UserId Id", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "POST")] - public Guid UserId { get; set; } + public string UserId { get; set; } } [Route("/Sessions/{Id}/Users/{UserId}", "DELETE", Summary = "Removes an additional user from a session")] @@ -211,7 +211,7 @@ namespace MediaBrowser.Api.Session public string Id { get; set; } [ApiMember(Name = "UserId", Description = "UserId Id", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "POST")] - public Guid UserId { get; set; } + public string UserId { get; set; } } [Route("/Sessions/Capabilities", "POST", Summary = "Updates capabilities for a device")] @@ -375,15 +375,15 @@ namespace MediaBrowser.Api.Session result = result.Where(i => string.Equals(i.DeviceId, request.DeviceId, StringComparison.OrdinalIgnoreCase)); } - if (request.ControllableByUserId.HasValue) + if (!string.IsNullOrWhiteSpace(request.ControllableByUserId)) { result = result.Where(i => i.SupportsMediaControl); - var user = _userManager.GetUserById(request.ControllableByUserId.Value); + var user = _userManager.GetUserById(request.ControllableByUserId); if (!user.Policy.EnableRemoteControlOfOtherUsers) { - result = result.Where(i => !i.UserId.HasValue || i.ContainsUser(request.ControllableByUserId.Value)); + result = result.Where(i => !i.UserId.HasValue || i.ContainsUser(request.ControllableByUserId)); } if (!user.Policy.EnableSharedDeviceControl) diff --git a/MediaBrowser.Api/SimilarItemsHelper.cs b/MediaBrowser.Api/SimilarItemsHelper.cs index fb04dd030..91e749778 100644 --- a/MediaBrowser.Api/SimilarItemsHelper.cs +++ b/MediaBrowser.Api/SimilarItemsHelper.cs @@ -32,7 +32,7 @@ namespace MediaBrowser.Api /// /// The user id. [ApiMember(Name = "UserId", Description = "Optional. Filter by user id, and attach user data", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")] - public Guid? UserId { get; set; } + public string UserId { get; set; } /// /// The maximum number of items to return @@ -70,10 +70,10 @@ namespace MediaBrowser.Api /// ItemsResult. internal static ItemsResult GetSimilarItemsResult(DtoOptions dtoOptions, IUserManager userManager, IItemRepository itemRepository, ILibraryManager libraryManager, IUserDataManager userDataRepository, IDtoService dtoService, ILogger logger, BaseGetSimilarItemsFromItem request, Func includeInSearch, Func getSimilarityScore) { - var user = request.UserId.HasValue ? userManager.GetUserById(request.UserId.Value) : null; + var user = !string.IsNullOrWhiteSpace(request.UserId) ? userManager.GetUserById(request.UserId) : null; var item = string.IsNullOrEmpty(request.Id) ? - (request.UserId.HasValue ? user.RootFolder : + (!string.IsNullOrWhiteSpace(request.UserId) ? user.RootFolder : libraryManager.RootFolder) : libraryManager.GetItemById(request.Id); Func filter = i => i.Id != item.Id && includeInSearch(i); diff --git a/MediaBrowser.Api/TvShowsService.cs b/MediaBrowser.Api/TvShowsService.cs index 9c9feead5..29a4a8bb5 100644 --- a/MediaBrowser.Api/TvShowsService.cs +++ b/MediaBrowser.Api/TvShowsService.cs @@ -77,7 +77,7 @@ namespace MediaBrowser.Api /// /// The user id. [ApiMember(Name = "UserId", Description = "User Id", IsRequired = true, DataType = "string", ParameterType = "query", Verb = "GET")] - public Guid UserId { get; set; } + public string UserId { get; set; } /// /// Skips over a given number of items within the results. Use for paging. @@ -130,7 +130,7 @@ namespace MediaBrowser.Api /// /// The user id. [ApiMember(Name = "UserId", Description = "User Id", IsRequired = true, DataType = "string", ParameterType = "query", Verb = "GET")] - public Guid UserId { get; set; } + public string UserId { get; set; } /// /// Fields to return within the items, in addition to basic information @@ -140,7 +140,7 @@ namespace MediaBrowser.Api public string Fields { get; set; } [ApiMember(Name = "Id", Description = "The series id", IsRequired = true, DataType = "string", ParameterType = "query", Verb = "GET")] - public Guid Id { get; set; } + public string Id { get; set; } [ApiMember(Name = "Season", Description = "Optional filter by season number.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")] public int? Season { get; set; } @@ -183,7 +183,7 @@ namespace MediaBrowser.Api /// /// The user id. [ApiMember(Name = "UserId", Description = "User Id", IsRequired = true, DataType = "string", ParameterType = "query", Verb = "GET")] - public Guid UserId { get; set; } + public string UserId { get; set; } /// /// Fields to return within the items, in addition to basic information @@ -193,7 +193,7 @@ namespace MediaBrowser.Api public string Fields { get; set; } [ApiMember(Name = "Id", Description = "The series id", IsRequired = true, DataType = "string", ParameterType = "query", Verb = "GET")] - public Guid Id { get; set; } + public string Id { get; set; } [ApiMember(Name = "IsSpecialSeason", Description = "Optional. Filter by special season.", IsRequired = false, DataType = "bool", ParameterType = "query", Verb = "GET")] public bool? IsSpecialSeason { get; set; } diff --git a/MediaBrowser.Api/UserLibrary/ArtistsService.cs b/MediaBrowser.Api/UserLibrary/ArtistsService.cs index 9f3f17465..2393d0533 100644 --- a/MediaBrowser.Api/UserLibrary/ArtistsService.cs +++ b/MediaBrowser.Api/UserLibrary/ArtistsService.cs @@ -40,7 +40,7 @@ namespace MediaBrowser.Api.UserLibrary /// /// The user id. [ApiMember(Name = "UserId", Description = "Optional. Filter by user id, and attach user data", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")] - public Guid? UserId { get; set; } + public string UserId { get; set; } } /// @@ -84,9 +84,9 @@ namespace MediaBrowser.Api.UserLibrary var dtoOptions = GetDtoOptions(request); - if (request.UserId.HasValue) + if (!string.IsNullOrWhiteSpace(request.UserId)) { - var user = UserManager.GetUserById(request.UserId.Value); + var user = UserManager.GetUserById(request.UserId); return DtoService.GetBaseItemDto(item, dtoOptions, user); } diff --git a/MediaBrowser.Api/UserLibrary/BaseItemsByNameService.cs b/MediaBrowser.Api/UserLibrary/BaseItemsByNameService.cs index b2364ce3c..8084fd083 100644 --- a/MediaBrowser.Api/UserLibrary/BaseItemsByNameService.cs +++ b/MediaBrowser.Api/UserLibrary/BaseItemsByNameService.cs @@ -61,9 +61,9 @@ namespace MediaBrowser.Api.UserLibrary BaseItem parentItem; List libraryItems = null; - if (request.UserId.HasValue) + if (!string.IsNullOrWhiteSpace(request.UserId)) { - user = UserManager.GetUserById(request.UserId.Value); + user = UserManager.GetUserById(request.UserId); parentItem = string.IsNullOrEmpty(request.ParentId) ? user.RootFolder : LibraryManager.GetItemById(request.ParentId); if (RequiresLibraryItems(request, dtoOptions)) @@ -92,7 +92,7 @@ namespace MediaBrowser.Api.UserLibrary { var folder = (Folder)parentItem; - if (request.UserId.HasValue) + if (!string.IsNullOrWhiteSpace(request.UserId)) { items = request.Recursive ? folder.GetRecursiveChildren(user, filter) : @@ -388,7 +388,7 @@ namespace MediaBrowser.Api.UserLibrary /// /// The user id. [ApiMember(Name = "UserId", Description = "Optional. Filter by user id, and attach user data", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")] - public Guid? UserId { get; set; } + public string UserId { get; set; } [ApiMember(Name = "NameStartsWithOrGreater", Description = "Optional filter by items whose name is sorted equally or greater than a given input string.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")] public string NameStartsWithOrGreater { get; set; } diff --git a/MediaBrowser.Api/UserLibrary/GameGenresService.cs b/MediaBrowser.Api/UserLibrary/GameGenresService.cs index 2f7430d33..f9d0f0d0f 100644 --- a/MediaBrowser.Api/UserLibrary/GameGenresService.cs +++ b/MediaBrowser.Api/UserLibrary/GameGenresService.cs @@ -37,7 +37,7 @@ namespace MediaBrowser.Api.UserLibrary /// /// The user id. [ApiMember(Name = "UserId", Description = "Optional. Filter by user id, and attach user data", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")] - public Guid? UserId { get; set; } + public string UserId { get; set; } } [Authenticated] @@ -71,9 +71,9 @@ namespace MediaBrowser.Api.UserLibrary var dtoOptions = GetDtoOptions(request); - if (request.UserId.HasValue) + if (!string.IsNullOrWhiteSpace(request.UserId)) { - var user = UserManager.GetUserById(request.UserId.Value); + var user = UserManager.GetUserById(request.UserId); return DtoService.GetBaseItemDto(item, dtoOptions, user); } diff --git a/MediaBrowser.Api/UserLibrary/GenresService.cs b/MediaBrowser.Api/UserLibrary/GenresService.cs index 63c0575bf..070246886 100644 --- a/MediaBrowser.Api/UserLibrary/GenresService.cs +++ b/MediaBrowser.Api/UserLibrary/GenresService.cs @@ -39,7 +39,7 @@ namespace MediaBrowser.Api.UserLibrary /// /// The user id. [ApiMember(Name = "UserId", Description = "Optional. Filter by user id, and attach user data", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")] - public Guid? UserId { get; set; } + public string UserId { get; set; } } /// @@ -76,9 +76,9 @@ namespace MediaBrowser.Api.UserLibrary var dtoOptions = GetDtoOptions(request); - if (request.UserId.HasValue) + if (!string.IsNullOrWhiteSpace(request.UserId)) { - var user = UserManager.GetUserById(request.UserId.Value); + var user = UserManager.GetUserById(request.UserId); return DtoService.GetBaseItemDto(item, dtoOptions, user); } diff --git a/MediaBrowser.Api/UserLibrary/ItemsService.cs b/MediaBrowser.Api/UserLibrary/ItemsService.cs index 51f88d574..bc2e4699c 100644 --- a/MediaBrowser.Api/UserLibrary/ItemsService.cs +++ b/MediaBrowser.Api/UserLibrary/ItemsService.cs @@ -30,7 +30,7 @@ namespace MediaBrowser.Api.UserLibrary /// /// The user id. [ApiMember(Name = "UserId", Description = "User Id", IsRequired = false, DataType = "string", ParameterType = "path", Verb = "GET")] - public Guid? UserId { get; set; } + public string UserId { get; set; } /// /// Limit results to items containing a specific person @@ -325,7 +325,7 @@ namespace MediaBrowser.Api.UserLibrary private async Task GetItems(GetItems request) { var parentItem = string.IsNullOrEmpty(request.ParentId) ? null : _libraryManager.GetItemById(request.ParentId); - var user = request.UserId.HasValue ? _userManager.GetUserById(request.UserId.Value) : null; + var user = !string.IsNullOrWhiteSpace(request.UserId) ? _userManager.GetUserById(request.UserId) : null; var result = await GetItemsToSerialize(request, user, parentItem).ConfigureAwait(false); diff --git a/MediaBrowser.Api/UserLibrary/MusicGenresService.cs b/MediaBrowser.Api/UserLibrary/MusicGenresService.cs index 1fe9dfaaa..e63d6c0f4 100644 --- a/MediaBrowser.Api/UserLibrary/MusicGenresService.cs +++ b/MediaBrowser.Api/UserLibrary/MusicGenresService.cs @@ -37,7 +37,7 @@ namespace MediaBrowser.Api.UserLibrary /// /// The user id. [ApiMember(Name = "UserId", Description = "Optional. Filter by user id, and attach user data", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")] - public Guid? UserId { get; set; } + public string UserId { get; set; } } [Authenticated] @@ -71,9 +71,9 @@ namespace MediaBrowser.Api.UserLibrary var dtoOptions = GetDtoOptions(request); - if (request.UserId.HasValue) + if (!string.IsNullOrWhiteSpace(request.UserId)) { - var user = UserManager.GetUserById(request.UserId.Value); + var user = UserManager.GetUserById(request.UserId); return DtoService.GetBaseItemDto(item, dtoOptions, user); } diff --git a/MediaBrowser.Api/UserLibrary/PersonsService.cs b/MediaBrowser.Api/UserLibrary/PersonsService.cs index 08ee6e462..b7fb4f542 100644 --- a/MediaBrowser.Api/UserLibrary/PersonsService.cs +++ b/MediaBrowser.Api/UserLibrary/PersonsService.cs @@ -43,7 +43,7 @@ namespace MediaBrowser.Api.UserLibrary /// /// The user id. [ApiMember(Name = "UserId", Description = "Optional. Filter by user id, and attach user data", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")] - public Guid? UserId { get; set; } + public string UserId { get; set; } } /// @@ -87,9 +87,9 @@ namespace MediaBrowser.Api.UserLibrary var dtoOptions = GetDtoOptions(request); - if (request.UserId.HasValue) + if (!string.IsNullOrWhiteSpace(request.UserId)) { - var user = UserManager.GetUserById(request.UserId.Value); + var user = UserManager.GetUserById(request.UserId); return DtoService.GetBaseItemDto(item, dtoOptions, user); } diff --git a/MediaBrowser.Api/UserLibrary/PlaystateService.cs b/MediaBrowser.Api/UserLibrary/PlaystateService.cs index f66f307db..5f32725d8 100644 --- a/MediaBrowser.Api/UserLibrary/PlaystateService.cs +++ b/MediaBrowser.Api/UserLibrary/PlaystateService.cs @@ -23,7 +23,7 @@ namespace MediaBrowser.Api.UserLibrary /// /// The user id. [ApiMember(Name = "UserId", Description = "User Id", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "POST")] - public Guid UserId { get; set; } + public string UserId { get; set; } [ApiMember(Name = "DatePlayed", Description = "The date the item was played (if any). Format = yyyyMMddHHmmss", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "POST")] public string DatePlayed { get; set; } @@ -47,7 +47,7 @@ namespace MediaBrowser.Api.UserLibrary /// /// The user id. [ApiMember(Name = "UserId", Description = "User Id", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "DELETE")] - public Guid UserId { get; set; } + public string UserId { get; set; } /// /// Gets or sets the id. @@ -90,7 +90,7 @@ namespace MediaBrowser.Api.UserLibrary /// /// The user id. [ApiMember(Name = "UserId", Description = "User Id", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "POST")] - public Guid UserId { get; set; } + public string UserId { get; set; } /// /// Gets or sets the id. @@ -143,7 +143,7 @@ namespace MediaBrowser.Api.UserLibrary /// /// The user id. [ApiMember(Name = "UserId", Description = "User Id", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "POST")] - public Guid UserId { get; set; } + public string UserId { get; set; } /// /// Gets or sets the id. @@ -198,7 +198,7 @@ namespace MediaBrowser.Api.UserLibrary /// /// The user id. [ApiMember(Name = "UserId", Description = "User Id", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "DELETE")] - public Guid UserId { get; set; } + public string UserId { get; set; } /// /// Gets or sets the id. diff --git a/MediaBrowser.Api/UserLibrary/StudiosService.cs b/MediaBrowser.Api/UserLibrary/StudiosService.cs index ae1da0346..d6a7db14f 100644 --- a/MediaBrowser.Api/UserLibrary/StudiosService.cs +++ b/MediaBrowser.Api/UserLibrary/StudiosService.cs @@ -38,7 +38,7 @@ namespace MediaBrowser.Api.UserLibrary /// /// The user id. [ApiMember(Name = "UserId", Description = "Optional. Filter by user id, and attach user data", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")] - public Guid? UserId { get; set; } + public string UserId { get; set; } } /// @@ -75,9 +75,9 @@ namespace MediaBrowser.Api.UserLibrary var dtoOptions = GetDtoOptions(request); - if (request.UserId.HasValue) + if (!string.IsNullOrWhiteSpace(request.UserId)) { - var user = UserManager.GetUserById(request.UserId.Value); + var user = UserManager.GetUserById(request.UserId); return DtoService.GetBaseItemDto(item, dtoOptions, user); } diff --git a/MediaBrowser.Api/UserLibrary/UserLibraryService.cs b/MediaBrowser.Api/UserLibrary/UserLibraryService.cs index aa6e227d8..c2c481cb6 100644 --- a/MediaBrowser.Api/UserLibrary/UserLibraryService.cs +++ b/MediaBrowser.Api/UserLibrary/UserLibraryService.cs @@ -5,9 +5,7 @@ using MediaBrowser.Controller.Library; using MediaBrowser.Controller.Net; using MediaBrowser.Model.Dto; using MediaBrowser.Model.Entities; -using MediaBrowser.Model.Library; using MediaBrowser.Model.Querying; -using MoreLinq; using ServiceStack; using System; using System.Collections.Generic; @@ -28,7 +26,7 @@ namespace MediaBrowser.Api.UserLibrary /// /// The user id. [ApiMember(Name = "UserId", Description = "User Id", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "GET")] - public Guid UserId { get; set; } + public string UserId { get; set; } /// /// Gets or sets the id. @@ -49,7 +47,7 @@ namespace MediaBrowser.Api.UserLibrary /// /// The user id. [ApiMember(Name = "UserId", Description = "User Id", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "GET")] - public Guid UserId { get; set; } + public string UserId { get; set; } } /// @@ -63,7 +61,7 @@ namespace MediaBrowser.Api.UserLibrary /// /// The user id. [ApiMember(Name = "UserId", Description = "User Id", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "GET")] - public Guid UserId { get; set; } + public string UserId { get; set; } /// /// Gets or sets the item id. @@ -84,7 +82,7 @@ namespace MediaBrowser.Api.UserLibrary /// /// The user id. [ApiMember(Name = "UserId", Description = "User Id", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "POST")] - public Guid UserId { get; set; } + public string UserId { get; set; } /// /// Gets or sets the id. @@ -105,7 +103,7 @@ namespace MediaBrowser.Api.UserLibrary /// /// The user id. [ApiMember(Name = "UserId", Description = "User Id", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "DELETE")] - public Guid UserId { get; set; } + public string UserId { get; set; } /// /// Gets or sets the id. @@ -126,7 +124,7 @@ namespace MediaBrowser.Api.UserLibrary /// /// The user id. [ApiMember(Name = "UserId", Description = "User Id", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "DELETE")] - public Guid UserId { get; set; } + public string UserId { get; set; } /// /// Gets or sets the id. @@ -147,7 +145,7 @@ namespace MediaBrowser.Api.UserLibrary /// /// The user id. [ApiMember(Name = "UserId", Description = "User Id", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "POST")] - public Guid UserId { get; set; } + public string UserId { get; set; } /// /// Gets or sets the id. @@ -175,7 +173,7 @@ namespace MediaBrowser.Api.UserLibrary /// /// The user id. [ApiMember(Name = "UserId", Description = "User Id", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "GET")] - public Guid UserId { get; set; } + public string UserId { get; set; } /// /// Gets or sets the id. @@ -196,7 +194,7 @@ namespace MediaBrowser.Api.UserLibrary /// /// The user id. [ApiMember(Name = "UserId", Description = "User Id", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "GET")] - public Guid UserId { get; set; } + public string UserId { get; set; } /// /// Gets or sets the id. @@ -515,7 +513,7 @@ namespace MediaBrowser.Api.UserLibrary /// The item id. /// if set to true [is favorite]. /// Task{UserItemDataDto}. - private async Task MarkFavorite(Guid userId, string itemId, bool isFavorite) + private async Task MarkFavorite(string userId, string itemId, bool isFavorite) { var user = _userManager.GetUserById(userId); @@ -563,7 +561,7 @@ namespace MediaBrowser.Api.UserLibrary /// The item id. /// if set to true [likes]. /// Task{UserItemDataDto}. - private async Task UpdateUserItemRating(Guid userId, string itemId, bool? likes) + private async Task UpdateUserItemRating(string userId, string itemId, bool? likes) { var user = _userManager.GetUserById(userId); diff --git a/MediaBrowser.Api/UserLibrary/YearsService.cs b/MediaBrowser.Api/UserLibrary/YearsService.cs index d95496333..859b9f959 100644 --- a/MediaBrowser.Api/UserLibrary/YearsService.cs +++ b/MediaBrowser.Api/UserLibrary/YearsService.cs @@ -38,7 +38,7 @@ namespace MediaBrowser.Api.UserLibrary /// /// The user id. [ApiMember(Name = "UserId", Description = "Optional. Filter by user id, and attach user data", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")] - public Guid? UserId { get; set; } + public string UserId { get; set; } } /// @@ -75,9 +75,9 @@ namespace MediaBrowser.Api.UserLibrary var dtoOptions = GetDtoOptions(request); - if (request.UserId.HasValue) + if (!string.IsNullOrWhiteSpace(request.UserId)) { - var user = UserManager.GetUserById(request.UserId.Value); + var user = UserManager.GetUserById(request.UserId); return DtoService.GetBaseItemDto(item, dtoOptions, user); } diff --git a/MediaBrowser.Api/VideosService.cs b/MediaBrowser.Api/VideosService.cs index d1b0eb05f..a65bee7ef 100644 --- a/MediaBrowser.Api/VideosService.cs +++ b/MediaBrowser.Api/VideosService.cs @@ -19,7 +19,7 @@ namespace MediaBrowser.Api public class GetAdditionalParts : IReturn { [ApiMember(Name = "UserId", Description = "Optional. Filter by user id, and attach user data", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")] - public Guid? UserId { get; set; } + public string UserId { get; set; } /// /// Gets or sets the id. @@ -71,10 +71,10 @@ namespace MediaBrowser.Api /// System.Object. public object Get(GetAdditionalParts request) { - var user = request.UserId.HasValue ? _userManager.GetUserById(request.UserId.Value) : null; + var user = !string.IsNullOrWhiteSpace(request.UserId) ? _userManager.GetUserById(request.UserId) : null; var item = string.IsNullOrEmpty(request.Id) - ? (request.UserId.HasValue + ? (!string.IsNullOrWhiteSpace(request.UserId) ? user.RootFolder : _libraryManager.RootFolder) : _libraryManager.GetItemById(request.Id); diff --git a/MediaBrowser.Controller/Library/IUserDataManager.cs b/MediaBrowser.Controller/Library/IUserDataManager.cs index f230f1472..56ac14e9d 100644 --- a/MediaBrowser.Controller/Library/IUserDataManager.cs +++ b/MediaBrowser.Controller/Library/IUserDataManager.cs @@ -29,6 +29,14 @@ namespace MediaBrowser.Controller.Library /// Task. Task SaveUserData(Guid userId, IHasUserData item, UserItemData userData, UserDataSaveReason reason, CancellationToken cancellationToken); + /// + /// Gets the user data. + /// + /// The user id. + /// The key. + /// Task{UserItemData}. + UserItemData GetUserData(string userId, string key); + /// /// Gets the user data. /// diff --git a/MediaBrowser.Controller/Persistence/IDisplayPreferencesRepository.cs b/MediaBrowser.Controller/Persistence/IDisplayPreferencesRepository.cs index 66fac3462..17de730cb 100644 --- a/MediaBrowser.Controller/Persistence/IDisplayPreferencesRepository.cs +++ b/MediaBrowser.Controller/Persistence/IDisplayPreferencesRepository.cs @@ -25,9 +25,9 @@ namespace MediaBrowser.Controller.Persistence /// The client. /// The cancellation token. /// Task. - Task SaveDisplayPreferences(DisplayPreferences displayPreferences, Guid userId, string client, + Task SaveDisplayPreferences(DisplayPreferences displayPreferences, string userId, string client, CancellationToken cancellationToken); - + /// /// Saves all display preferences for a user /// @@ -44,7 +44,7 @@ namespace MediaBrowser.Controller.Persistence /// The user id. /// The client. /// Task{DisplayPreferences}. - DisplayPreferences GetDisplayPreferences(string displayPreferencesId, Guid userId, string client); + DisplayPreferences GetDisplayPreferences(string displayPreferencesId, string userId, string client); /// /// Gets all display preferences for the given user. diff --git a/MediaBrowser.Controller/Session/ISessionManager.cs b/MediaBrowser.Controller/Session/ISessionManager.cs index 80025171d..dc9612c84 100644 --- a/MediaBrowser.Controller/Session/ISessionManager.cs +++ b/MediaBrowser.Controller/Session/ISessionManager.cs @@ -220,14 +220,14 @@ namespace MediaBrowser.Controller.Session /// /// The session identifier. /// The user identifier. - void AddAdditionalUser(string sessionId, Guid userId); + void AddAdditionalUser(string sessionId, string userId); /// /// Removes the additional user. /// /// The session identifier. /// The user identifier. - void RemoveAdditionalUser(string sessionId, Guid userId); + void RemoveAdditionalUser(string sessionId, string userId); /// /// Reports the now viewing item. diff --git a/MediaBrowser.Server.Implementations/Library/UserDataManager.cs b/MediaBrowser.Server.Implementations/Library/UserDataManager.cs index 8cbb2eb1a..ae737d244 100644 --- a/MediaBrowser.Server.Implementations/Library/UserDataManager.cs +++ b/MediaBrowser.Server.Implementations/Library/UserDataManager.cs @@ -1,5 +1,4 @@ -using System.Collections.Generic; -using MediaBrowser.Common.Events; +using MediaBrowser.Common.Events; using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Entities.Audio; @@ -10,6 +9,7 @@ using MediaBrowser.Model.Entities; using MediaBrowser.Model.Logging; using System; using System.Collections.Concurrent; +using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; @@ -262,5 +262,9 @@ namespace MediaBrowser.Server.Implementations.Library return playedToCompletion; } + public UserItemData GetUserData(string userId, string key) + { + return GetUserData(new Guid(userId), key); + } } } diff --git a/MediaBrowser.Server.Implementations/Localization/JavaScript/javascript.json b/MediaBrowser.Server.Implementations/Localization/JavaScript/javascript.json index 0c52d21c9..c48de8797 100644 --- a/MediaBrowser.Server.Implementations/Localization/JavaScript/javascript.json +++ b/MediaBrowser.Server.Implementations/Localization/JavaScript/javascript.json @@ -723,7 +723,7 @@ "MessageInvitationSentToNewUser": "An email has been sent to {0} inviting them to sign up with Emby.", "HeaderConnectionFailure": "Connection Failure", "MessageUnableToConnectToServer": "We're unable to connect to the selected server right now. Please ensure it is running and try again.", - "ButtonSelectServer": "Select server", + "ButtonSelectServer": "Select Server", "MessagePluginConfigurationRequiresLocalAccess": "To configure this plugin please sign in to your local server directly.", "MessageLoggedOutParentalControl": "Access is currently restricted. Please try again later.", "DefaultErrorMessage": "There was an error processing the request. Please try again later.", @@ -787,5 +787,8 @@ "MessagePleaseSignInLocalNetwork": "Before proceeding, please ensure that you're connected to your local network using a Wifi or LAN connection.", "ButtonUnlockWithPurchase": "Unlock with Purchase", "MessageLiveTvGuideRequiresUnlock": "The Live TV Guide is currently limited to {0} channels. Click the unlock button to learn how to enjoy the full experience.", - "OptionEnableFullscreen": "Enable Fullscreen" + "OptionEnableFullscreen": "Enable Fullscreen", + "ButtonServer": "Server", + "HeaderAdmin": "Admin", + "HeaderLibrary": "Library" } diff --git a/MediaBrowser.Server.Implementations/Persistence/SqliteDisplayPreferencesRepository.cs b/MediaBrowser.Server.Implementations/Persistence/SqliteDisplayPreferencesRepository.cs index c9ab43e63..45e0304c1 100644 --- a/MediaBrowser.Server.Implementations/Persistence/SqliteDisplayPreferencesRepository.cs +++ b/MediaBrowser.Server.Implementations/Persistence/SqliteDisplayPreferencesRepository.cs @@ -309,5 +309,15 @@ namespace MediaBrowser.Server.Implementations.Persistence _connection = null; } } + + public Task SaveDisplayPreferences(DisplayPreferences displayPreferences, string userId, string client, CancellationToken cancellationToken) + { + return SaveDisplayPreferences(displayPreferences, new Guid(userId), client, cancellationToken); + } + + public DisplayPreferences GetDisplayPreferences(string displayPreferencesId, string userId, string client) + { + return GetDisplayPreferences(displayPreferencesId, new Guid(userId), client); + } } } \ No newline at end of file diff --git a/MediaBrowser.Server.Implementations/Session/SessionManager.cs b/MediaBrowser.Server.Implementations/Session/SessionManager.cs index 757e6938a..1baaa952a 100644 --- a/MediaBrowser.Server.Implementations/Session/SessionManager.cs +++ b/MediaBrowser.Server.Implementations/Session/SessionManager.cs @@ -1203,22 +1203,22 @@ namespace MediaBrowser.Server.Implementations.Session /// The user identifier. /// Cannot modify additional users without authenticating first. /// The requested user is already the primary user of the session. - public void AddAdditionalUser(string sessionId, Guid userId) + public void AddAdditionalUser(string sessionId, string userId) { var session = GetSession(sessionId); - if (session.UserId.HasValue && session.UserId.Value == userId) + if (session.UserId.HasValue && session.UserId.Value == new Guid(userId)) { throw new ArgumentException("The requested user is already the primary user of the session."); } - if (session.AdditionalUsers.All(i => new Guid(i.UserId) != userId)) + if (session.AdditionalUsers.All(i => new Guid(i.UserId) != new Guid(userId))) { var user = _userManager.GetUserById(userId); session.AdditionalUsers.Add(new SessionUserInfo { - UserId = userId.ToString("N"), + UserId = userId, UserName = user.Name }); } @@ -1231,16 +1231,16 @@ namespace MediaBrowser.Server.Implementations.Session /// The user identifier. /// Cannot modify additional users without authenticating first. /// The requested user is already the primary user of the session. - public void RemoveAdditionalUser(string sessionId, Guid userId) + public void RemoveAdditionalUser(string sessionId, string userId) { var session = GetSession(sessionId); - if (session.UserId.HasValue && session.UserId.Value == userId) + if (session.UserId.HasValue && session.UserId.Value == new Guid(userId)) { throw new ArgumentException("The requested user is already the primary user of the session."); } - var user = session.AdditionalUsers.FirstOrDefault(i => new Guid(i.UserId) == userId); + var user = session.AdditionalUsers.FirstOrDefault(i => new Guid(i.UserId) == new Guid(userId)); if (user != null) { diff --git a/MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csproj b/MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csproj index 121ee2e71..0d2595b11 100644 --- a/MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csproj +++ b/MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csproj @@ -234,9 +234,15 @@ PreserveNewest + + PreserveNewest + PreserveNewest + + PreserveNewest + PreserveNewest @@ -247,6 +253,9 @@ PreserveNewest + + PreserveNewest + PreserveNewest @@ -1040,6 +1049,9 @@ PreserveNewest + + PreserveNewest + PreserveNewest