aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Pulverenti <luke.pulverenti@gmail.com>2014-09-04 23:48:53 -0400
committerLuke Pulverenti <luke.pulverenti@gmail.com>2014-09-04 23:48:53 -0400
commit91ffff7771cb4ae9f89dbc2cb7a5cec70a3301c2 (patch)
tree4c14c426a7de3469d281ad22110959958c9412a9
parentdd2798a3d6a03c73067e93b398108d4e8678e8f5 (diff)
added dlna music folders
-rw-r--r--MediaBrowser.Api/Dlna/DlnaServerService.cs1
-rw-r--r--MediaBrowser.Api/Playback/BaseStreamingService.cs2
-rw-r--r--MediaBrowser.Api/Playback/Hls/VideoHlsService.cs8
-rw-r--r--MediaBrowser.Common.Implementations/Configuration/BaseConfigurationManager.cs2
-rw-r--r--MediaBrowser.Common.Implementations/Devices/DeviceId.cs99
-rw-r--r--MediaBrowser.Common.Implementations/MediaBrowser.Common.Implementations.csproj1
-rw-r--r--MediaBrowser.Controller/Entities/Audio/IHasAlbumArtist.cs2
-rw-r--r--MediaBrowser.Controller/Entities/MusicVideo.cs17
-rw-r--r--MediaBrowser.Controller/Entities/UserViewBuilder.cs131
-rw-r--r--MediaBrowser.Controller/Library/ILibraryManager.cs11
-rw-r--r--MediaBrowser.Controller/Library/IUserViewManager.cs2
-rw-r--r--MediaBrowser.Model/Configuration/ServerConfiguration.cs16
-rw-r--r--MediaBrowser.Model/Entities/CollectionType.cs6
-rw-r--r--MediaBrowser.Server.Implementations/HttpServer/Security/AuthService.cs6
-rw-r--r--MediaBrowser.Server.Implementations/HttpServer/Security/AuthorizationContext.cs18
-rw-r--r--MediaBrowser.Server.Implementations/Library/LibraryManager.cs19
-rw-r--r--MediaBrowser.Server.Implementations/Library/UserViewManager.cs39
-rw-r--r--MediaBrowser.Server.Implementations/Localization/Server/server.json11
-rw-r--r--MediaBrowser.ServerApplication/ApplicationHost.cs14
19 files changed, 314 insertions, 91 deletions
diff --git a/MediaBrowser.Api/Dlna/DlnaServerService.cs b/MediaBrowser.Api/Dlna/DlnaServerService.cs
index c6066f064..9981d506e 100644
--- a/MediaBrowser.Api/Dlna/DlnaServerService.cs
+++ b/MediaBrowser.Api/Dlna/DlnaServerService.cs
@@ -1,6 +1,5 @@
using MediaBrowser.Common.Configuration;
using MediaBrowser.Controller.Dlna;
-using MediaBrowser.Model.Configuration;
using ServiceStack;
using ServiceStack.Text.Controller;
using ServiceStack.Web;
diff --git a/MediaBrowser.Api/Playback/BaseStreamingService.cs b/MediaBrowser.Api/Playback/BaseStreamingService.cs
index 5cae6b010..e20c4c115 100644
--- a/MediaBrowser.Api/Playback/BaseStreamingService.cs
+++ b/MediaBrowser.Api/Playback/BaseStreamingService.cs
@@ -788,7 +788,7 @@ namespace MediaBrowser.Api.Playback
/// <returns>System.String.</returns>
protected string GetInputArgument(string transcodingJobId, StreamState state)
{
- if (state.InputProtocol == MediaProtocol.File &&
+ if (SupportsThrottling && state.InputProtocol == MediaProtocol.File &&
state.RunTimeTicks.HasValue &&
state.VideoType == VideoType.VideoFile &&
!string.Equals(state.OutputVideoCodec, "copy", StringComparison.OrdinalIgnoreCase))
diff --git a/MediaBrowser.Api/Playback/Hls/VideoHlsService.cs b/MediaBrowser.Api/Playback/Hls/VideoHlsService.cs
index 3581b9e17..9f85f64e1 100644
--- a/MediaBrowser.Api/Playback/Hls/VideoHlsService.cs
+++ b/MediaBrowser.Api/Playback/Hls/VideoHlsService.cs
@@ -62,14 +62,6 @@ namespace MediaBrowser.Api.Playback.Hls
{
}
- protected override bool SupportsThrottling
- {
- get
- {
- return false;
- }
- }
-
/// <summary>
/// Gets the specified request.
/// </summary>
diff --git a/MediaBrowser.Common.Implementations/Configuration/BaseConfigurationManager.cs b/MediaBrowser.Common.Implementations/Configuration/BaseConfigurationManager.cs
index cb6121c9f..4a70697fa 100644
--- a/MediaBrowser.Common.Implementations/Configuration/BaseConfigurationManager.cs
+++ b/MediaBrowser.Common.Implementations/Configuration/BaseConfigurationManager.cs
@@ -88,7 +88,7 @@ namespace MediaBrowser.Common.Implementations.Configuration
}
private ConfigurationStore[] _configurationStores = {};
- private IConfigurationFactory[] _configurationFactories;
+ private IConfigurationFactory[] _configurationFactories = {};
/// <summary>
/// Initializes a new instance of the <see cref="BaseConfigurationManager" /> class.
diff --git a/MediaBrowser.Common.Implementations/Devices/DeviceId.cs b/MediaBrowser.Common.Implementations/Devices/DeviceId.cs
new file mode 100644
index 000000000..ce69843fb
--- /dev/null
+++ b/MediaBrowser.Common.Implementations/Devices/DeviceId.cs
@@ -0,0 +1,99 @@
+using MediaBrowser.Common.Configuration;
+using MediaBrowser.Model.Logging;
+using System;
+using System.IO;
+using System.Text;
+
+namespace MediaBrowser.Common.Implementations.Devices
+{
+ public class DeviceId
+ {
+ private readonly IApplicationPaths _appPaths;
+ private readonly ILogger _logger;
+
+ private readonly object _syncLock = new object();
+
+ private string CachePath
+ {
+ get { return Path.Combine(_appPaths.DataPath, "device.txt"); }
+ }
+
+ private string GetCachedId()
+ {
+ try
+ {
+ lock (_syncLock)
+ {
+ var value = File.ReadAllText(CachePath, Encoding.UTF8);
+
+ Guid guid;
+ if (Guid.TryParse(value, out guid))
+ {
+ return value;
+ }
+
+ _logger.Error("Invalid value found in device id file");
+ }
+ }
+ catch (FileNotFoundException ex)
+ {
+ }
+ catch (Exception ex)
+ {
+ _logger.ErrorException("Error reading file", ex);
+ }
+
+ return null;
+ }
+
+ private void SaveId(string id)
+ {
+ try
+ {
+ var path = CachePath;
+
+ Directory.CreateDirectory(Path.GetDirectoryName(path));
+
+ lock (_syncLock)
+ {
+ File.WriteAllText(path, id, Encoding.UTF8);
+ }
+ }
+ catch (Exception ex)
+ {
+ _logger.ErrorException("Error writing to file", ex);
+ }
+ }
+
+ private string GetNewId()
+ {
+ return Guid.NewGuid().ToString("N");
+ }
+
+ private string GetDeviceId()
+ {
+ var id = GetCachedId();
+
+ if (string.IsNullOrWhiteSpace(id))
+ {
+ id = GetNewId();
+ SaveId(id);
+ }
+
+ return id;
+ }
+
+ private string _id;
+
+ public DeviceId(IApplicationPaths appPaths, ILogger logger)
+ {
+ _appPaths = appPaths;
+ _logger = logger;
+ }
+
+ public string Value
+ {
+ get { return _id ?? (_id = GetDeviceId()); }
+ }
+ }
+}
diff --git a/MediaBrowser.Common.Implementations/MediaBrowser.Common.Implementations.csproj b/MediaBrowser.Common.Implementations/MediaBrowser.Common.Implementations.csproj
index 4b0c95616..294e368ef 100644
--- a/MediaBrowser.Common.Implementations/MediaBrowser.Common.Implementations.csproj
+++ b/MediaBrowser.Common.Implementations/MediaBrowser.Common.Implementations.csproj
@@ -82,6 +82,7 @@
<Compile Include="BaseApplicationHost.cs" />
<Compile Include="BaseApplicationPaths.cs" />
<Compile Include="Configuration\BaseConfigurationManager.cs" />
+ <Compile Include="Devices\DeviceId.cs" />
<Compile Include="HttpClientManager\HttpClientInfo.cs" />
<Compile Include="HttpClientManager\HttpClientManager.cs" />
<Compile Include="IO\CommonFileSystem.cs" />
diff --git a/MediaBrowser.Controller/Entities/Audio/IHasAlbumArtist.cs b/MediaBrowser.Controller/Entities/Audio/IHasAlbumArtist.cs
index ca079c3bf..a20f05323 100644
--- a/MediaBrowser.Controller/Entities/Audio/IHasAlbumArtist.cs
+++ b/MediaBrowser.Controller/Entities/Audio/IHasAlbumArtist.cs
@@ -12,5 +12,7 @@ namespace MediaBrowser.Controller.Entities.Audio
bool HasArtist(string name);
List<string> AllArtists { get; }
+
+ List<string> Artists { get; }
}
}
diff --git a/MediaBrowser.Controller/Entities/MusicVideo.cs b/MediaBrowser.Controller/Entities/MusicVideo.cs
index bbb2bc875..d36bfd7c4 100644
--- a/MediaBrowser.Controller/Entities/MusicVideo.cs
+++ b/MediaBrowser.Controller/Entities/MusicVideo.cs
@@ -42,6 +42,23 @@ namespace MediaBrowser.Controller.Entities
}
[IgnoreDataMember]
+ public List<string> Artists
+ {
+ get
+ {
+ var list = new List<string>();
+
+ if (!string.IsNullOrEmpty(Artist))
+ {
+ list.Add(Artist);
+ }
+
+ return list;
+
+ }
+ }
+
+ [IgnoreDataMember]
public List<string> AllArtists
{
get
diff --git a/MediaBrowser.Controller/Entities/UserViewBuilder.cs b/MediaBrowser.Controller/Entities/UserViewBuilder.cs
index bc97a43b7..d8da31196 100644
--- a/MediaBrowser.Controller/Entities/UserViewBuilder.cs
+++ b/MediaBrowser.Controller/Entities/UserViewBuilder.cs
@@ -171,6 +171,18 @@ namespace MediaBrowser.Controller.Entities
case CollectionType.MovieCollections:
return GetMovieCollections(parent, user, query);
+ case CollectionType.MusicLatest:
+ return GetMusicLatest(parent, user, query);
+
+ case CollectionType.MusicAlbums:
+ return GetMusicAlbums(parent, user, query);
+
+ case CollectionType.MusicAlbumArtists:
+ return GetMusicAlbumArtists(parent, user, query);
+
+ case CollectionType.MusicArtists:
+ return GetMusicArtists(parent, user, query);
+
default:
return GetResult(GetMediaFolders(user).SelectMany(i => i.GetChildren(user, true)), query);
}
@@ -188,7 +200,78 @@ namespace MediaBrowser.Controller.Entities
return GetResult(GetRecursiveChildren(parent, user, new[] { CollectionType.Music }), query);
}
- return GetResult(GetRecursiveChildren(parent, user, new[] { CollectionType.Music }).OfType<MusicArtist>(), query);
+ var list = new List<BaseItem>();
+
+ var category = "music";
+
+ list.Add(await GetUserView(category, CollectionType.MusicLatest, user, "0", parent).ConfigureAwait(false));
+ list.Add(await GetUserView(category, CollectionType.MusicAlbums, user, "1", parent).ConfigureAwait(false));
+ list.Add(await GetUserView(category, CollectionType.MusicAlbumArtists, user, "2", parent).ConfigureAwait(false));
+ //list.Add(await GetUserView(CollectionType.MusicArtists, user, "3", parent).ConfigureAwait(false));
+ //list.Add(await GetUserView(CollectionType.MusicGenres, user, "5", parent).ConfigureAwait(false));
+
+ return GetResult(list, query);
+ }
+
+ private QueryResult<BaseItem> GetMusicAlbumArtists(Folder parent, User user, UserItemsQuery query)
+ {
+ var artists = GetRecursiveChildren(parent, user, new[] { CollectionType.Music })
+ .Where(i => !i.IsFolder)
+ .OfType<IHasAlbumArtist>()
+ .SelectMany(i => i.AlbumArtists)
+ .Distinct(StringComparer.OrdinalIgnoreCase)
+ .Select(i =>
+ {
+ try
+ {
+ return _libraryManager.GetArtist(i);
+ }
+ catch
+ {
+ // Already logged at lower levels
+ return null;
+ }
+ })
+ .Where(i => i != null);
+
+ return GetResult(artists, query);
+ }
+
+ private QueryResult<BaseItem> GetMusicArtists(Folder parent, User user, UserItemsQuery query)
+ {
+ var artists = GetRecursiveChildren(parent, user, new[] { CollectionType.Music })
+ .Where(i => !i.IsFolder)
+ .OfType<IHasArtist>()
+ .SelectMany(i => i.Artists)
+ .Distinct(StringComparer.OrdinalIgnoreCase)
+ .Select(i =>
+ {
+ try
+ {
+ return _libraryManager.GetArtist(i);
+ }
+ catch
+ {
+ // Already logged at lower levels
+ return null;
+ }
+ })
+ .Where(i => i != null);
+
+ return GetResult(artists, query);
+ }
+
+ private QueryResult<BaseItem> GetMusicAlbums(Folder parent, User user, UserItemsQuery query)
+ {
+ return GetResult(GetRecursiveChildren(parent, user, new[] { CollectionType.Music }).Where(i => i is MusicAlbum), query);
+ }
+
+ private QueryResult<BaseItem> GetMusicLatest(Folder parent, User user, UserItemsQuery query)
+ {
+ query.SortBy = new[] { ItemSortBy.DateCreated, ItemSortBy.SortName };
+ query.SortOrder = SortOrder.Descending;
+
+ return GetResult(GetRecursiveChildren(parent, user, new[] { CollectionType.Music }).Where(i => i is MusicVideo || i is Audio.Audio), GetSpecialItemsLimit(), query);
}
private async Task<QueryResult<BaseItem>> GetMovieFolders(Folder parent, User user, UserItemsQuery query)
@@ -200,11 +283,13 @@ namespace MediaBrowser.Controller.Entities
var list = new List<BaseItem>();
- list.Add(await GetUserView(CollectionType.MovieResume, user, "0", parent).ConfigureAwait(false));
- list.Add(await GetUserView(CollectionType.MovieLatest, user, "1", parent).ConfigureAwait(false));
- list.Add(await GetUserView(CollectionType.MovieMovies, user, "2", parent).ConfigureAwait(false));
- list.Add(await GetUserView(CollectionType.MovieCollections, user, "3", parent).ConfigureAwait(false));
- list.Add(await GetUserView(CollectionType.MovieFavorites, user, "4", parent).ConfigureAwait(false));
+ var category = "movies";
+
+ list.Add(await GetUserView(category, CollectionType.MovieResume, user, "0", parent).ConfigureAwait(false));
+ list.Add(await GetUserView(category, CollectionType.MovieLatest, user, "1", parent).ConfigureAwait(false));
+ list.Add(await GetUserView(category, CollectionType.MovieMovies, user, "2", parent).ConfigureAwait(false));
+ list.Add(await GetUserView(category, CollectionType.MovieCollections, user, "3", parent).ConfigureAwait(false));
+ list.Add(await GetUserView(category, CollectionType.MovieFavorites, user, "4", parent).ConfigureAwait(false));
//list.Add(await GetUserView(CollectionType.MovieGenres, user, "5", parent).ConfigureAwait(false));
return GetResult(list, query);
@@ -243,7 +328,7 @@ namespace MediaBrowser.Controller.Entities
return GetResult(GetRecursiveChildren(parent, user, new[] { CollectionType.Movies, CollectionType.BoxSets, string.Empty }).Where(i => i is Movie), GetSpecialItemsLimit(), query);
}
-
+
private QueryResult<BaseItem> GetMovieGenres(Folder parent, User user, UserItemsQuery query)
{
var genres = GetRecursiveChildren(parent, user, new[] { CollectionType.Movies, CollectionType.BoxSets, string.Empty })
@@ -278,10 +363,12 @@ namespace MediaBrowser.Controller.Entities
var list = new List<BaseItem>();
- list.Add(await GetUserView(CollectionType.TvResume, user, "0", parent).ConfigureAwait(false));
- list.Add(await GetUserView(CollectionType.TvNextUp, user, "1", parent).ConfigureAwait(false));
- list.Add(await GetUserView(CollectionType.TvLatest, user, "2", parent).ConfigureAwait(false));
- list.Add(await GetUserView(CollectionType.TvSeries, user, "3", parent).ConfigureAwait(false));
+ var category = "tv";
+
+ list.Add(await GetUserView(category, CollectionType.TvResume, user, "0", parent).ConfigureAwait(false));
+ list.Add(await GetUserView(category, CollectionType.TvNextUp, user, "1", parent).ConfigureAwait(false));
+ list.Add(await GetUserView(category, CollectionType.TvLatest, user, "2", parent).ConfigureAwait(false));
+ list.Add(await GetUserView(category, CollectionType.TvSeries, user, "3", parent).ConfigureAwait(false));
//list.Add(await GetUserView(CollectionType.TvFavorites, user, "4", parent).ConfigureAwait(false));
//list.Add(await GetUserView(CollectionType.TvGenres, user, "5", parent).ConfigureAwait(false));
@@ -297,10 +384,12 @@ namespace MediaBrowser.Controller.Entities
var list = new List<BaseItem>();
- list.Add(await GetUserView(CollectionType.LatestGames, user, "0", parent).ConfigureAwait(false));
- list.Add(await GetUserView(CollectionType.RecentlyPlayedGames, user, "1", parent).ConfigureAwait(false));
- list.Add(await GetUserView(CollectionType.GameFavorites, user, "2", parent).ConfigureAwait(false));
- list.Add(await GetUserView(CollectionType.GameSystems, user, "3", parent).ConfigureAwait(false));
+ var category = "games";
+
+ list.Add(await GetUserView(category, CollectionType.LatestGames, user, "0", parent).ConfigureAwait(false));
+ list.Add(await GetUserView(category, CollectionType.RecentlyPlayedGames, user, "1", parent).ConfigureAwait(false));
+ list.Add(await GetUserView(category, CollectionType.GameFavorites, user, "2", parent).ConfigureAwait(false));
+ list.Add(await GetUserView(category, CollectionType.GameSystems, user, "3", parent).ConfigureAwait(false));
//list.Add(await GetUserView(CollectionType.GameGenres, user, "4", parent).ConfigureAwait(false));
return GetResult(list, query);
@@ -341,7 +430,7 @@ namespace MediaBrowser.Controller.Entities
private QueryResult<BaseItem> GetTvNextUp(Folder parent, UserItemsQuery query)
{
var parentFolders = GetMediaFolders(parent, query.User, new[] { CollectionType.TvShows, string.Empty });
-
+
var result = _tvSeriesManager.GetNextUp(new NextUpQuery
{
Limit = query.Limit,
@@ -589,16 +678,16 @@ namespace MediaBrowser.Controller.Entities
{
var list = new List<BaseItem>();
- list.Add(await _userViewManager.GetUserView(CollectionType.LiveTvNowPlaying, user, "0", CancellationToken.None).ConfigureAwait(false));
- list.Add(await _userViewManager.GetUserView(CollectionType.LiveTvChannels, user, string.Empty, CancellationToken.None).ConfigureAwait(false));
- list.Add(await _userViewManager.GetUserView(CollectionType.LiveTvRecordingGroups, user, string.Empty, CancellationToken.None).ConfigureAwait(false));
+ list.Add(await _userViewManager.GetUserView("livetv", CollectionType.LiveTvNowPlaying, user, "0", CancellationToken.None).ConfigureAwait(false));
+ list.Add(await _userViewManager.GetUserView("livetv", CollectionType.LiveTvChannels, user, string.Empty, CancellationToken.None).ConfigureAwait(false));
+ list.Add(await _userViewManager.GetUserView("livetv", CollectionType.LiveTvRecordingGroups, user, string.Empty, CancellationToken.None).ConfigureAwait(false));
return list;
}
- private async Task<UserView> GetUserView(string type, User user, string sortName, Folder parent)
+ private async Task<UserView> GetUserView(string category, string type, User user, string sortName, Folder parent)
{
- var view = await _userViewManager.GetUserView(type, user, sortName, CancellationToken.None)
+ var view = await _userViewManager.GetUserView(category, type, user, sortName, CancellationToken.None)
.ConfigureAwait(false);
if (parent.Id != view.ParentId)
diff --git a/MediaBrowser.Controller/Library/ILibraryManager.cs b/MediaBrowser.Controller/Library/ILibraryManager.cs
index 5f88e0e58..8aaa08fdd 100644
--- a/MediaBrowser.Controller/Library/ILibraryManager.cs
+++ b/MediaBrowser.Controller/Library/ILibraryManager.cs
@@ -336,10 +336,21 @@ namespace MediaBrowser.Controller.Library
/// Gets the named folder.
/// </summary>
/// <param name="name">The name.</param>
+ /// <param name="category">The category.</param>
/// <param name="viewType">Type of the view.</param>
/// <param name="sortName">Name of the sort.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>Task{Folder}.</returns>
+ Task<UserView> GetNamedView(string name, string category, string viewType, string sortName, CancellationToken cancellationToken);
+
+ /// <summary>
+ /// Gets the named view.
+ /// </summary>
+ /// <param name="name">The name.</param>
+ /// <param name="viewType">Type of the view.</param>
+ /// <param name="sortName">Name of the sort.</param>
+ /// <param name="cancellationToken">The cancellation token.</param>
+ /// <returns>Task&lt;UserView&gt;.</returns>
Task<UserView> GetNamedView(string name, string viewType, string sortName, CancellationToken cancellationToken);
}
} \ No newline at end of file
diff --git a/MediaBrowser.Controller/Library/IUserViewManager.cs b/MediaBrowser.Controller/Library/IUserViewManager.cs
index 908525a2f..5b6189837 100644
--- a/MediaBrowser.Controller/Library/IUserViewManager.cs
+++ b/MediaBrowser.Controller/Library/IUserViewManager.cs
@@ -11,5 +11,7 @@ namespace MediaBrowser.Controller.Library
Task<IEnumerable<Folder>> GetUserViews(UserViewQuery query, CancellationToken cancellationToken);
Task<UserView> GetUserView(string type, User user, string sortName, CancellationToken cancellationToken);
+
+ Task<UserView> GetUserView(string category, string type, User user, string sortName, CancellationToken cancellationToken);
}
}
diff --git a/MediaBrowser.Model/Configuration/ServerConfiguration.cs b/MediaBrowser.Model/Configuration/ServerConfiguration.cs
index 1572c50dc..0807951a7 100644
--- a/MediaBrowser.Model/Configuration/ServerConfiguration.cs
+++ b/MediaBrowser.Model/Configuration/ServerConfiguration.cs
@@ -1,8 +1,6 @@
using MediaBrowser.Model.Entities;
using MediaBrowser.Model.FileOrganization;
using MediaBrowser.Model.LiveTv;
-using MediaBrowser.Model.Notifications;
-using MediaBrowser.Model.Providers;
namespace MediaBrowser.Model.Configuration
{
@@ -178,9 +176,10 @@ namespace MediaBrowser.Model.Configuration
public bool DefaultMetadataSettingsApplied { get; set; }
- public bool EnableTokenAuthentication { get; set; }
public PeopleMetadataOptions PeopleMetadataOptions { get; set; }
+ public string[] SecureApps { get; set; }
+
/// <summary>
/// Initializes a new instance of the <see cref="ServerConfiguration" /> class.
/// </summary>
@@ -225,6 +224,17 @@ namespace MediaBrowser.Model.Configuration
PeopleMetadataOptions = new PeopleMetadataOptions();
+ SecureApps = new[]
+ {
+ "Dashboard",
+ "Chrome Companion",
+ "MBKinect",
+ "NuVue",
+ "Media Browser Theater",
+
+ //"MB-Classic"
+ };
+
MetadataOptions = new[]
{
new MetadataOptions(1, 1280) {ItemType = "Book"},
diff --git a/MediaBrowser.Model/Entities/CollectionType.cs b/MediaBrowser.Model/Entities/CollectionType.cs
index 76af08e0c..a8e32ac69 100644
--- a/MediaBrowser.Model/Entities/CollectionType.cs
+++ b/MediaBrowser.Model/Entities/CollectionType.cs
@@ -49,5 +49,11 @@
public const string GameSystems = "GameSystems";
public const string GameGenres = "GameGenres";
public const string GameFavorites = "GameFavorites";
+
+ public const string MusicArtists = "MusicArtists";
+ public const string MusicAlbumArtists = "MusicAlbumArtists";
+ public const string MusicAlbums = "MusicAlbums";
+ public const string MusicGenres = "MusicGenres";
+ public const string MusicLatest = "MusicLatest";
}
}
diff --git a/MediaBrowser.Server.Implementations/HttpServer/Security/AuthService.cs b/MediaBrowser.Server.Implementations/HttpServer/Security/AuthService.cs
index 2b9ae7d09..855b26034 100644
--- a/MediaBrowser.Server.Implementations/HttpServer/Security/AuthService.cs
+++ b/MediaBrowser.Server.Implementations/HttpServer/Security/AuthService.cs
@@ -53,17 +53,13 @@ namespace MediaBrowser.Server.Implementations.HttpServer.Security
ValidateUser(req, allowLocal);
}
- // TODO: Remove this when all clients have supported the new sescurity
- private readonly List<string> _updatedClients = new List<string>() { "Dashboard", "Chromecast" };
-
private void ValidateUser(IRequest req, bool allowLocal)
{
//This code is executed before the service
var auth = AuthorizationContext.GetAuthorizationInfo(req);
if (!string.IsNullOrWhiteSpace(auth.Token)
- || _config.Configuration.EnableTokenAuthentication
- || _updatedClients.Contains(auth.Client ?? string.Empty, StringComparer.OrdinalIgnoreCase))
+ || _config.Configuration.SecureApps.Contains(auth.Client ?? string.Empty, StringComparer.OrdinalIgnoreCase))
{
if (!allowLocal || !req.IsLocal)
{
diff --git a/MediaBrowser.Server.Implementations/HttpServer/Security/AuthorizationContext.cs b/MediaBrowser.Server.Implementations/HttpServer/Security/AuthorizationContext.cs
index 94be37e95..925eb6a86 100644
--- a/MediaBrowser.Server.Implementations/HttpServer/Security/AuthorizationContext.cs
+++ b/MediaBrowser.Server.Implementations/HttpServer/Security/AuthorizationContext.cs
@@ -17,7 +17,7 @@ namespace MediaBrowser.Server.Implementations.HttpServer.Security
/// </summary>
/// <param name="httpReq">The HTTP req.</param>
/// <returns>Dictionary{System.StringSystem.String}.</returns>
- private static AuthorizationInfo GetAuthorization(IRequest httpReq)
+ private AuthorizationInfo GetAuthorization(IRequest httpReq)
{
var auth = GetAuthorizationDictionary(httpReq);
@@ -59,7 +59,7 @@ namespace MediaBrowser.Server.Implementations.HttpServer.Security
/// </summary>
/// <param name="httpReq">The HTTP req.</param>
/// <returns>Dictionary{System.StringSystem.String}.</returns>
- private static Dictionary<string, string> GetAuthorizationDictionary(IRequest httpReq)
+ private Dictionary<string, string> GetAuthorizationDictionary(IRequest httpReq)
{
var auth = httpReq.Headers["Authorization"];
@@ -71,14 +71,14 @@ namespace MediaBrowser.Server.Implementations.HttpServer.Security
/// </summary>
/// <param name="authorizationHeader">The authorization header.</param>
/// <returns>Dictionary{System.StringSystem.String}.</returns>
- private static Dictionary<string, string> GetAuthorization(string authorizationHeader)
+ private Dictionary<string, string> GetAuthorization(string authorizationHeader)
{
if (authorizationHeader == null) return null;
- var parts = authorizationHeader.Split(' ');
+ var parts = authorizationHeader.Split(new[] { ' ' }, 2);
// There should be at least to parts
- if (parts.Length < 2) return null;
+ if (parts.Length != 2) return null;
// It has to be a digest request
if (!string.Equals(parts[0], "MediaBrowser", StringComparison.OrdinalIgnoreCase))
@@ -87,7 +87,7 @@ namespace MediaBrowser.Server.Implementations.HttpServer.Security
}
// Remove uptil the first space
- authorizationHeader = authorizationHeader.Substring(authorizationHeader.IndexOf(' '));
+ authorizationHeader = parts[1];
parts = authorizationHeader.Split(',');
var result = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
@@ -95,7 +95,11 @@ namespace MediaBrowser.Server.Implementations.HttpServer.Security
foreach (var item in parts)
{
var param = item.Trim().Split(new[] { '=' }, 2);
- result.Add(param[0], param[1].Trim(new[] { '"' }));
+
+ if (param.Length == 2)
+ {
+ result.Add(param[0], param[1].Trim(new[] { '"' }));
+ }
}
return result;
diff --git a/MediaBrowser.Server.Implementations/Library/LibraryManager.cs b/MediaBrowser.Server.Implementations/Library/LibraryManager.cs
index 297d5e032..a3e86c667 100644
--- a/MediaBrowser.Server.Implementations/Library/LibraryManager.cs
+++ b/MediaBrowser.Server.Implementations/Library/LibraryManager.cs
@@ -1484,16 +1484,27 @@ namespace MediaBrowser.Server.Implementations.Library
.Distinct(StringComparer.OrdinalIgnoreCase);
}
- public async Task<UserView> GetNamedView(string name, string type, string sortName, CancellationToken cancellationToken)
+ public Task<UserView> GetNamedView(string name, string type, string sortName, CancellationToken cancellationToken)
+ {
+ return GetNamedView(name, null, type, sortName, cancellationToken);
+ }
+
+ public async Task<UserView> GetNamedView(string name, string category, string type, string sortName, CancellationToken cancellationToken)
{
var path = Path.Combine(ConfigurationManager.ApplicationPaths.ItemsByNamePath,
- "views",
- _fileSystem.GetValidFilename(type));
+ "views");
+
+ if (!string.IsNullOrWhiteSpace(category))
+ {
+ path = Path.Combine(path, _fileSystem.GetValidFilename(category));
+ }
+
+ path = Path.Combine(path, _fileSystem.GetValidFilename(type));
var id = (path + "_namedview_" + name).GetMBId(typeof(UserView));
var item = GetItemById(id) as UserView;
-
+
if (item == null)
{
Directory.CreateDirectory(Path.GetDirectoryName(path));
diff --git a/MediaBrowser.Server.Implementations/Library/UserViewManager.cs b/MediaBrowser.Server.Implementations/Library/UserViewManager.cs
index 63aa3764c..61283505b 100644
--- a/MediaBrowser.Server.Implementations/Library/UserViewManager.cs
+++ b/MediaBrowser.Server.Implementations/Library/UserViewManager.cs
@@ -1,5 +1,4 @@
-using MediaBrowser.Common.Extensions;
-using MediaBrowser.Common.IO;
+using MediaBrowser.Common.IO;
using MediaBrowser.Controller;
using MediaBrowser.Controller.Channels;
using MediaBrowser.Controller.Entities;
@@ -16,7 +15,6 @@ using MediaBrowser.Model.Library;
using MediaBrowser.Model.Querying;
using System;
using System.Collections.Generic;
-using System.IO;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
@@ -148,43 +146,16 @@ namespace MediaBrowser.Server.Implementations.Library
.ThenBy(i => i.SortName);
}
- public Task<UserView> GetUserView(string type, User user, string sortName, CancellationToken cancellationToken)
+ public Task<UserView> GetUserView(string category, string type, User user, string sortName, CancellationToken cancellationToken)
{
var name = _localizationManager.GetLocalizedString("ViewType" + type);
- return _libraryManager.GetNamedView(name, type, sortName, cancellationToken);
+ return _libraryManager.GetNamedView(name, category, type, sortName, cancellationToken);
}
- public async Task<SpecialFolder> GetSpecialFolder(string name, SpecialFolderType type, string itemType, CancellationToken cancellationToken)
+ public Task<UserView> GetUserView(string type, User user, string sortName, CancellationToken cancellationToken)
{
- var path = Path.Combine(_appPaths.ItemsByNamePath,
- "specialfolders",
- _fileSystem.GetValidFilename(name));
-
- var id = (path + "_specialfolder_" + name).GetMBId(typeof(SpecialFolder));
-
- var item = _libraryManager.GetItemById(id) as SpecialFolder;
-
- if (item == null)
- {
- Directory.CreateDirectory(Path.GetDirectoryName(path));
-
- item = new SpecialFolder
- {
- Path = path,
- Id = id,
- DateCreated = DateTime.UtcNow,
- Name = name,
- SpecialFolderType = type,
- ItemTypeName = itemType
- };
-
- await _libraryManager.CreateItem(item, cancellationToken).ConfigureAwait(false);
-
- await item.RefreshMetadata(cancellationToken).ConfigureAwait(false);
- }
-
- return item;
+ return GetUserView(null, type, user, sortName, cancellationToken);
}
}
}
diff --git a/MediaBrowser.Server.Implementations/Localization/Server/server.json b/MediaBrowser.Server.Implementations/Localization/Server/server.json
index 1020038f4..2192f5f08 100644
--- a/MediaBrowser.Server.Implementations/Localization/Server/server.json
+++ b/MediaBrowser.Server.Implementations/Localization/Server/server.json
@@ -859,6 +859,9 @@
"ViewTypeMovieCollections": "Collections",
"ViewTypeMovieFavorites": "Favorites",
"ViewTypeMovieGenres": "Genres",
+ "ViewTypeMusicLatest": "Latest",
+ "ViewTypeMusicAlbums": "Albums",
+ "ViewTypeMusicAlbumArtists": "Album Artists",
"HeaderOtherDisplaySettings": "Display Settings",
"HeaderMyViews": "My Views",
"LabelSelectFolderGroups": "Automatically group content from the following folders into views such as Movies, Music and TV:",
@@ -1109,12 +1112,14 @@
"HeaderMetadataSettings": "Metadata Settings",
"LabelLockItemToPreventChanges": "Lock this item to prevent future changes",
"MessageLeaveEmptyToInherit": "Leave empty to inherit settings from a parent item, or the global default value.",
- "TabSupporterClub": "Supporter Club",
+ "TabDonate": "Donate",
"HeaderDonationType": "Donation type:",
"OptionMakeOneTimeDonation": "Make a separate donation",
"OptionOneTimeDescription": "This is an additional donation to the team to show your support. It does not have any additional benefits.",
- "OptionLifeTimeSupporterClubMembership": "Lifetime supporter club membership",
- "HeaderSupporterBenefit": "Becoming a supporter club member provides additional benefits such as access to premium plugins, internet channel content, and more.",
+ "OptionLifeTimeSupporterMembership": "Lifetime supporter membership",
+ "OptionYearlySupporterMembership": "Yearly supporter membership",
+ "OptionMonthlySupporterMembership": "Monthly supporter membership",
+ "HeaderSupporterBenefit": "A supporter membership provides additional benefits such as access to premium plugins, internet channel content, and more.",
"OptionNoTrailer": "No Trailer",
"OptionNoThemeSong": "No Theme Song",
"OptionNoThemeVideo": "No Theme Video",
diff --git a/MediaBrowser.ServerApplication/ApplicationHost.cs b/MediaBrowser.ServerApplication/ApplicationHost.cs
index e97c21204..a532e58a6 100644
--- a/MediaBrowser.ServerApplication/ApplicationHost.cs
+++ b/MediaBrowser.ServerApplication/ApplicationHost.cs
@@ -4,6 +4,7 @@ using MediaBrowser.Common.Configuration;
using MediaBrowser.Common.Events;
using MediaBrowser.Common.Extensions;
using MediaBrowser.Common.Implementations;
+using MediaBrowser.Common.Implementations.Devices;
using MediaBrowser.Common.Implementations.ScheduledTasks;
using MediaBrowser.Common.IO;
using MediaBrowser.Common.Net;
@@ -903,11 +904,18 @@ namespace MediaBrowser.ServerApplication
}
}
- private readonly string _systemId = Environment.MachineName.GetMD5().ToString();
-
+ private DeviceId _serverId;
public string ServerId
{
- get { return _systemId; }
+ get
+ {
+ if (_serverId == null)
+ {
+ _serverId = new DeviceId(ApplicationPaths, LogManager.GetLogger("ServerId"));
+ }
+
+ return _serverId.Value;
+ }
}
/// <summary>