diff options
| -rw-r--r-- | MediaBrowser.Api/LiveTv/LiveTvService.cs | 10 | ||||
| -rw-r--r-- | MediaBrowser.Api/Sync/SyncService.cs | 5 | ||||
| -rw-r--r-- | MediaBrowser.Controller/Channels/ChannelItemInfo.cs | 6 | ||||
| -rw-r--r-- | MediaBrowser.Model/LiveTv/RecordingQuery.cs | 7 | ||||
| -rw-r--r-- | MediaBrowser.Providers/Music/MusicBrainzAlbumProvider.cs | 38 | ||||
| -rw-r--r-- | MediaBrowser.Server.Implementations/Channels/ChannelManager.cs | 12 | ||||
| -rw-r--r-- | MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs | 9 | ||||
| -rw-r--r-- | MediaBrowser.Server.Implementations/Persistence/SqliteItemRepository.cs | 11 | ||||
| -rw-r--r-- | Nuget/MediaBrowser.Common.Internal.nuspec | 4 | ||||
| -rw-r--r-- | Nuget/MediaBrowser.Common.nuspec | 2 | ||||
| -rw-r--r-- | Nuget/MediaBrowser.Server.Core.nuspec | 2 |
11 files changed, 83 insertions, 23 deletions
diff --git a/MediaBrowser.Api/LiveTv/LiveTvService.cs b/MediaBrowser.Api/LiveTv/LiveTvService.cs index 074dba7c5..784057b32 100644 --- a/MediaBrowser.Api/LiveTv/LiveTvService.cs +++ b/MediaBrowser.Api/LiveTv/LiveTvService.cs @@ -146,6 +146,13 @@ namespace MediaBrowser.Api.LiveTv /// <value>The fields.</value> [ApiMember(Name = "Fields", Description = "Optional. Specify additional fields of information to return in the output. This allows multiple, comma delimeted. Options: Budget, Chapters, CriticRatingSummary, DateCreated, Genres, HomePageUrl, IndexOptions, MediaStreams, Overview, ParentId, Path, People, ProviderIds, PrimaryImageAspectRatio, Revenue, SortName, Studios, Taglines", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET", AllowMultiple = true)] public string Fields { get; set; } + + public bool EnableTotalRecordCount { get; set; } + + public GetRecordings() + { + EnableTotalRecordCount = true; + } } [Route("/LiveTv/Recordings/Groups", "GET", Summary = "Gets live tv recording groups")] @@ -898,7 +905,8 @@ namespace MediaBrowser.Api.LiveTv Limit = request.Limit, Status = request.Status, SeriesTimerId = request.SeriesTimerId, - IsInProgress = request.IsInProgress + IsInProgress = request.IsInProgress, + EnableTotalRecordCount = request.EnableTotalRecordCount }, options, CancellationToken.None).ConfigureAwait(false); diff --git a/MediaBrowser.Api/Sync/SyncService.cs b/MediaBrowser.Api/Sync/SyncService.cs index dcc5bd54f..a15ce216f 100644 --- a/MediaBrowser.Api/Sync/SyncService.cs +++ b/MediaBrowser.Api/Sync/SyncService.cs @@ -243,7 +243,7 @@ namespace MediaBrowser.Api.Sync await _syncManager.ReportSyncJobItemTransferBeginning(request.Id).ConfigureAwait(false); - return ResultFactory.GetStaticFileResult(Request, new StaticFileResultOptions + return await ResultFactory.GetStaticFileResult(Request, new StaticFileResultOptions { Path = jobItem.OutputPath, OnError = () => @@ -251,7 +251,8 @@ namespace MediaBrowser.Api.Sync var failedTask = _syncManager.ReportSyncJobItemTransferFailed(request.Id); Task.WaitAll(failedTask); } - }); + + }).ConfigureAwait(false); } public async Task<object> Get(GetSyncDialogOptions request) diff --git a/MediaBrowser.Controller/Channels/ChannelItemInfo.cs b/MediaBrowser.Controller/Channels/ChannelItemInfo.cs index 6135240e9..57c2f1f7f 100644 --- a/MediaBrowser.Controller/Channels/ChannelItemInfo.cs +++ b/MediaBrowser.Controller/Channels/ChannelItemInfo.cs @@ -55,6 +55,10 @@ namespace MediaBrowser.Controller.Channels public string HomePageUrl { get; set; } + public List<string> Artists { get; set; } + + public List<string> AlbumArtists { get; set; } + public ChannelItemInfo() { MediaSources = new List<ChannelMediaInfo>(); @@ -64,6 +68,8 @@ namespace MediaBrowser.Controller.Channels People = new List<PersonInfo>(); Tags = new List<string>(); ProviderIds = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase); + Artists = new List<string>(); + AlbumArtists = new List<string>(); } } } diff --git a/MediaBrowser.Model/LiveTv/RecordingQuery.cs b/MediaBrowser.Model/LiveTv/RecordingQuery.cs index 0cf997602..923d303f8 100644 --- a/MediaBrowser.Model/LiveTv/RecordingQuery.cs +++ b/MediaBrowser.Model/LiveTv/RecordingQuery.cs @@ -70,5 +70,12 @@ namespace MediaBrowser.Model.LiveTv public bool? EnableImages { get; set; } public int? ImageTypeLimit { get; set; } public ImageType[] EnableImageTypes { get; set; } + + public bool EnableTotalRecordCount { get; set; } + + public RecordingQuery() + { + EnableTotalRecordCount = true; + } } } diff --git a/MediaBrowser.Providers/Music/MusicBrainzAlbumProvider.cs b/MediaBrowser.Providers/Music/MusicBrainzAlbumProvider.cs index 792f92b49..36676c6b2 100644 --- a/MediaBrowser.Providers/Music/MusicBrainzAlbumProvider.cs +++ b/MediaBrowser.Providers/Music/MusicBrainzAlbumProvider.cs @@ -14,6 +14,7 @@ using System.Text; using System.Threading; using System.Threading.Tasks; using System.Xml; +using MediaBrowser.Model.Serialization; namespace MediaBrowser.Providers.Music { @@ -24,14 +25,16 @@ namespace MediaBrowser.Providers.Music private readonly IHttpClient _httpClient; private readonly IApplicationHost _appHost; private readonly ILogger _logger; + private readonly IJsonSerializer _json; public static string MusicBrainzBaseUrl = "https://www.musicbrainz.org"; - public MusicBrainzAlbumProvider(IHttpClient httpClient, IApplicationHost appHost, ILogger logger) + public MusicBrainzAlbumProvider(IHttpClient httpClient, IApplicationHost appHost, ILogger logger, IJsonSerializer json) { _httpClient = httpClient; _appHost = appHost; _logger = logger; + _json = json; Current = this; } @@ -332,33 +335,38 @@ namespace MediaBrowser.Providers.Music private async Task<MbzUrl> GetMbzUrl() { - if (_mbzUrls == null || (DateTime.UtcNow.Ticks - _lastMbzUrlQueryTicks) > TimeSpan.FromHours(12).Ticks) + if (_chosenUrl == null || _mbzUrls == null || (DateTime.UtcNow.Ticks - _lastMbzUrlQueryTicks) > TimeSpan.FromHours(12).Ticks) { - await RefreshMzbUrls().ConfigureAwait(false); + var urls = await RefreshMzbUrls().ConfigureAwait(false); - var urls = _mbzUrls.ToList(); _chosenUrl = urls[new Random().Next(0, urls.Count - 1)]; } return _chosenUrl; } - private async Task RefreshMzbUrls() + private async Task<List<MbzUrl>> RefreshMzbUrls() { + List<MbzUrl> list; + try { - _mbzUrls = new List<MbzUrl> + var options = new HttpRequestOptions { - new MbzUrl - { - url = MusicBrainzBaseUrl, - throttleMs = 1000 - } + Url = "https://mb3admin.com/admin/service/standards/musicBrainzUrls", + UserAgent = _appHost.Name + "/" + _appHost.ApplicationVersion }; + + using (var stream = await _httpClient.Get(options).ConfigureAwait(false)) + { + list = _json.DeserializeFromStream<List<MbzUrl>>(stream); + } } - catch + catch (Exception ex) { - _mbzUrls = new List<MbzUrl> + _logger.ErrorException("Error getting music brainz info", ex); + + list = new List<MbzUrl> { new MbzUrl { @@ -367,6 +375,10 @@ namespace MediaBrowser.Providers.Music } }; } + + _mbzUrls = list.ToList(); + + return list; } /// <summary> diff --git a/MediaBrowser.Server.Implementations/Channels/ChannelManager.cs b/MediaBrowser.Server.Implementations/Channels/ChannelManager.cs index e768c9099..faca936d3 100644 --- a/MediaBrowser.Server.Implementations/Channels/ChannelManager.cs +++ b/MediaBrowser.Server.Implementations/Channels/ChannelManager.cs @@ -1310,6 +1310,18 @@ namespace MediaBrowser.Server.Implementations.Channels item.HomePageUrl = info.HomePageUrl; } + var hasArtists = item as IHasArtist; + if (hasArtists != null) + { + hasArtists.Artists = info.Artists; + } + + var hasAlbumArtists = item as IHasAlbumArtist; + if (hasAlbumArtists != null) + { + hasAlbumArtists.AlbumArtists = info.AlbumArtists; + } + var trailer = item as Trailer; if (trailer != null) { diff --git a/MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs b/MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs index 29c4a43d3..95ed2aac1 100644 --- a/MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs +++ b/MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs @@ -896,6 +896,12 @@ namespace MediaBrowser.Server.Implementations.LiveTv var topFolder = await GetInternalLiveTvFolder(cancellationToken).ConfigureAwait(false); + if (query.SortBy.Length == 0) + { + // Unless something else was specified, order by start date to take advantage of a specialized index + query.SortBy = new[] { ItemSortBy.StartDate }; + } + var internalQuery = new InternalItemsQuery(user) { IncludeItemTypes = new[] { typeof(LiveTvProgram).Name }, @@ -1414,7 +1420,8 @@ namespace MediaBrowser.Server.Implementations.LiveTv ExcludeLocationTypes = new[] { LocationType.Virtual }, Limit = Math.Min(200, query.Limit ?? int.MaxValue), SortBy = new[] { ItemSortBy.DateCreated }, - SortOrder = SortOrder.Descending + SortOrder = SortOrder.Descending, + EnableTotalRecordCount = query.EnableTotalRecordCount }); } diff --git a/MediaBrowser.Server.Implementations/Persistence/SqliteItemRepository.cs b/MediaBrowser.Server.Implementations/Persistence/SqliteItemRepository.cs index ed5a64b8c..006cb2edf 100644 --- a/MediaBrowser.Server.Implementations/Persistence/SqliteItemRepository.cs +++ b/MediaBrowser.Server.Implementations/Persistence/SqliteItemRepository.cs @@ -162,7 +162,6 @@ namespace MediaBrowser.Server.Implementations.Persistence "create table if not exists ItemValues (ItemId GUID, Type INT, Value TEXT, CleanValue TEXT)", //"create index if not exists idx_ItemValues on ItemValues(ItemId)", "create index if not exists idx_ItemValues2 on ItemValues(ItemId,Type)", - "create index if not exists idx_ItemValues3 on ItemValues(ItemId,Type,CleanValue)", "create table if not exists ProviderIds (ItemId GUID, Name TEXT, Value TEXT, PRIMARY KEY (ItemId, Name))", "create index if not exists Idx_ProviderIds on ProviderIds(ItemId)", @@ -276,6 +275,9 @@ namespace MediaBrowser.Server.Implementations.Persistence "create index if not exists idx_TopParentId on TypedBaseItems(TopParentId)", "create index if not exists idx_TypeTopParentId on TypedBaseItems(Type,TopParentId)", + // live tv programs + "create index if not exists idx_TypeTopParentIdStartDate on TypedBaseItems(Type,TopParentId,StartDate)", + // used by movie suggestions "create index if not exists idx_TypeTopParentIdGroup on TypedBaseItems(Type,TopParentId,PresentationUniqueKey)", "create index if not exists idx_TypeTopParentId2 on TypedBaseItems(TopParentId,MediaType,IsVirtualItem)", @@ -286,8 +288,13 @@ namespace MediaBrowser.Server.Implementations.Persistence // latest items "create index if not exists idx_TypeTopParentId9 on TypedBaseItems(TopParentId,Type,IsVirtualItem,PresentationUniqueKey,DateCreated)", + "create index if not exists idx_TypeTopParentId8 on TypedBaseItems(TopParentId,IsFolder,IsVirtualItem,PresentationUniqueKey,DateCreated)", + + // resume "create index if not exists idx_TypeTopParentId7 on TypedBaseItems(TopParentId,MediaType,IsVirtualItem,PresentationUniqueKey)", - "create index if not exists idx_TypeTopParentId8 on TypedBaseItems(TopParentId,IsFolder,IsVirtualItem,PresentationUniqueKey)" + + // items by name + "create index if not exists idx_ItemValues3 on ItemValues(ItemId,Type,CleanValue)" }; _connection.RunQueries(postQueries, Logger); diff --git a/Nuget/MediaBrowser.Common.Internal.nuspec b/Nuget/MediaBrowser.Common.Internal.nuspec index a8ef26932..506bc4e36 100644 --- a/Nuget/MediaBrowser.Common.Internal.nuspec +++ b/Nuget/MediaBrowser.Common.Internal.nuspec @@ -2,7 +2,7 @@ <package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd"> <metadata> <id>MediaBrowser.Common.Internal</id> - <version>3.0.650</version> + <version>3.0.651</version> <title>MediaBrowser.Common.Internal</title> <authors>Luke</authors> <owners>ebr,Luke,scottisafool</owners> @@ -12,7 +12,7 @@ <description>Contains common components shared by Emby Theater and Emby Server. Not intended for plugin developer consumption.</description> <copyright>Copyright © Emby 2013</copyright> <dependencies> - <dependency id="MediaBrowser.Common" version="3.0.650" /> + <dependency id="MediaBrowser.Common" version="3.0.651" /> <dependency id="NLog" version="4.3.4" /> <dependency id="SimpleInjector" version="3.1.5" /> </dependencies> diff --git a/Nuget/MediaBrowser.Common.nuspec b/Nuget/MediaBrowser.Common.nuspec index 2bf899ad6..07bf6faa7 100644 --- a/Nuget/MediaBrowser.Common.nuspec +++ b/Nuget/MediaBrowser.Common.nuspec @@ -2,7 +2,7 @@ <package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd"> <metadata> <id>MediaBrowser.Common</id> - <version>3.0.650</version> + <version>3.0.651</version> <title>MediaBrowser.Common</title> <authors>Emby Team</authors> <owners>ebr,Luke,scottisafool</owners> diff --git a/Nuget/MediaBrowser.Server.Core.nuspec b/Nuget/MediaBrowser.Server.Core.nuspec index 3fdeeaf53..c2616798e 100644 --- a/Nuget/MediaBrowser.Server.Core.nuspec +++ b/Nuget/MediaBrowser.Server.Core.nuspec @@ -2,7 +2,7 @@ <package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd"> <metadata> <id>MediaBrowser.Server.Core</id> - <version>3.0.650</version> + <version>3.0.651</version> <title>Media Browser.Server.Core</title> <authors>Emby Team</authors> <owners>ebr,Luke,scottisafool</owners> |
