From 1663b258a71a164046007831e09ddd5f389b28a4 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Tue, 13 Jun 2017 02:33:29 -0400 Subject: [PATCH 1/2] update home sections --- .../Data/SqliteItemRepository.cs | 9 -- .../Emby.Server.Implementations.csproj | 1 - .../LiveTv/LiveTvManager.cs | 12 -- .../LiveTv/ProgramImageProvider.cs | 103 ------------------ MediaBrowser.Api/BaseApiService.cs | 84 +++++++------- .../Entities/InternalItemsQuery.cs | 1 - .../LiveTv/LiveTvProgram.cs | 6 - .../MediaEncoding/EncodingHelper.cs | 7 +- .../Encoder/EncoderValidator.cs | 8 +- MediaBrowser.Model/LiveTv/LiveTvOptions.cs | 3 - MediaBrowser.Model/Users/UserPolicy.cs | 2 + 11 files changed, 57 insertions(+), 179 deletions(-) delete mode 100644 Emby.Server.Implementations/LiveTv/ProgramImageProvider.cs diff --git a/Emby.Server.Implementations/Data/SqliteItemRepository.cs b/Emby.Server.Implementations/Data/SqliteItemRepository.cs index df3cecbf9d..e999f57532 100644 --- a/Emby.Server.Implementations/Data/SqliteItemRepository.cs +++ b/Emby.Server.Implementations/Data/SqliteItemRepository.cs @@ -3929,15 +3929,6 @@ namespace Emby.Server.Implementations.Data } } - if (!string.IsNullOrWhiteSpace(query.SlugName)) - { - whereClauses.Add("CleanName=@SlugName"); - if (statement != null) - { - statement.TryBind("@SlugName", GetCleanValue(query.SlugName)); - } - } - if (!string.IsNullOrWhiteSpace(query.MinSortName)) { whereClauses.Add("SortName>=@MinSortName"); diff --git a/Emby.Server.Implementations/Emby.Server.Implementations.csproj b/Emby.Server.Implementations/Emby.Server.Implementations.csproj index df70680f15..4482bb13b2 100644 --- a/Emby.Server.Implementations/Emby.Server.Implementations.csproj +++ b/Emby.Server.Implementations/Emby.Server.Implementations.csproj @@ -167,7 +167,6 @@ - diff --git a/Emby.Server.Implementations/LiveTv/LiveTvManager.cs b/Emby.Server.Implementations/LiveTv/LiveTvManager.cs index 1a5e6bddd4..8f62670e41 100644 --- a/Emby.Server.Implementations/LiveTv/LiveTvManager.cs +++ b/Emby.Server.Implementations/LiveTv/LiveTvManager.cs @@ -1422,18 +1422,6 @@ namespace Emby.Server.Implementations.LiveTv await _libraryManager.UpdateItem(program, ItemUpdateType.MetadataImport, cancellationToken).ConfigureAwait(false); } - if (!(service is EmbyTV.EmbyTV)) - { - foreach (var program in newPrograms) - { - _providerManager.QueueRefresh(program.Id, new MetadataRefreshOptions(_fileSystem), RefreshPriority.Low); - } - foreach (var program in updatedPrograms) - { - _providerManager.QueueRefresh(program.Id, new MetadataRefreshOptions(_fileSystem), RefreshPriority.Low); - } - } - currentChannel.IsMovie = isMovie; currentChannel.IsNews = isNews; currentChannel.IsSports = isSports; diff --git a/Emby.Server.Implementations/LiveTv/ProgramImageProvider.cs b/Emby.Server.Implementations/LiveTv/ProgramImageProvider.cs deleted file mode 100644 index 5cff88a676..0000000000 --- a/Emby.Server.Implementations/LiveTv/ProgramImageProvider.cs +++ /dev/null @@ -1,103 +0,0 @@ -using MediaBrowser.Controller.Entities; -using MediaBrowser.Controller.LiveTv; -using MediaBrowser.Controller.Providers; -using MediaBrowser.Model.Entities; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading; -using System.Threading.Tasks; - -namespace Emby.Server.Implementations.LiveTv -{ - public class ProgramImageProvider : IDynamicImageProvider, IHasItemChangeMonitor, IHasOrder - { - private readonly ILiveTvManager _liveTvManager; - - public ProgramImageProvider(ILiveTvManager liveTvManager) - { - _liveTvManager = liveTvManager; - } - - public IEnumerable GetSupportedImages(IHasImages item) - { - return new[] { ImageType.Primary }; - } - - private string GetItemExternalId(BaseItem item) - { - var externalId = item.ExternalId; - - if (string.IsNullOrWhiteSpace(externalId)) - { - externalId = item.GetProviderId("ProviderExternalId"); - } - - return externalId; - } - - public async Task GetImage(IHasImages item, ImageType type, CancellationToken cancellationToken) - { - var liveTvItem = (LiveTvProgram)item; - - var imageResponse = new DynamicImageResponse(); - - var service = _liveTvManager.Services.FirstOrDefault(i => string.Equals(i.Name, liveTvItem.ServiceName, StringComparison.OrdinalIgnoreCase)); - - if (service != null) - { - try - { - var channel = _liveTvManager.GetInternalChannel(liveTvItem.ChannelId); - - if (channel != null) - { - var response = await service.GetProgramImageAsync(GetItemExternalId(liveTvItem), GetItemExternalId(channel), cancellationToken).ConfigureAwait(false); - - if (response != null) - { - imageResponse.HasImage = true; - imageResponse.Stream = response.Stream; - imageResponse.Format = response.Format; - } - } - } - catch (NotImplementedException) - { - } - } - - return imageResponse; - } - - public string Name - { - get { return "Live TV Service Provider"; } - } - - public bool Supports(IHasImages item) - { - return item is LiveTvProgram; - } - - public int Order - { - get - { - // Let the better providers run first - return 100; - } - } - - public bool HasChanged(IHasMetadata item, IDirectoryService directoryService) - { - var liveTvItem = item as LiveTvProgram; - - if (liveTvItem != null) - { - return !liveTvItem.HasImage(ImageType.Primary); - } - return false; - } - } -} diff --git a/MediaBrowser.Api/BaseApiService.cs b/MediaBrowser.Api/BaseApiService.cs index 0f1d240d0c..d3cc18d4be 100644 --- a/MediaBrowser.Api/BaseApiService.cs +++ b/MediaBrowser.Api/BaseApiService.cs @@ -178,13 +178,7 @@ namespace MediaBrowser.Api { if (name.IndexOf(BaseItem.SlugChar) != -1) { - var result = libraryManager.GetItemList(new InternalItemsQuery - { - SlugName = name, - IncludeItemTypes = new[] { typeof(MusicArtist).Name }, - DtoOptions = dtoOptions - - }).OfType().FirstOrDefault(); + var result = GetItemFromSlugName(libraryManager, name, dtoOptions); if (result != null) { @@ -199,13 +193,7 @@ namespace MediaBrowser.Api { if (name.IndexOf(BaseItem.SlugChar) != -1) { - var result = libraryManager.GetItemList(new InternalItemsQuery - { - SlugName = name, - IncludeItemTypes = new[] { typeof(Studio).Name }, - DtoOptions = dtoOptions - - }).OfType().FirstOrDefault(); + var result = GetItemFromSlugName(libraryManager, name, dtoOptions); if (result != null) { @@ -220,13 +208,7 @@ namespace MediaBrowser.Api { if (name.IndexOf(BaseItem.SlugChar) != -1) { - var result = libraryManager.GetItemList(new InternalItemsQuery - { - SlugName = name, - IncludeItemTypes = new[] { typeof(Genre).Name }, - DtoOptions = dtoOptions - - }).OfType().FirstOrDefault(); + var result = GetItemFromSlugName(libraryManager, name, dtoOptions); if (result != null) { @@ -241,13 +223,7 @@ namespace MediaBrowser.Api { if (name.IndexOf(BaseItem.SlugChar) != -1) { - var result = libraryManager.GetItemList(new InternalItemsQuery - { - SlugName = name, - IncludeItemTypes = new[] { typeof(MusicGenre).Name }, - DtoOptions = dtoOptions - - }).OfType().FirstOrDefault(); + var result = GetItemFromSlugName(libraryManager, name, dtoOptions); if (result != null) { @@ -262,13 +238,7 @@ namespace MediaBrowser.Api { if (name.IndexOf(BaseItem.SlugChar) != -1) { - var result = libraryManager.GetItemList(new InternalItemsQuery - { - SlugName = name, - IncludeItemTypes = new[] { typeof(GameGenre).Name }, - DtoOptions = dtoOptions - - }).OfType().FirstOrDefault(); + var result = GetItemFromSlugName(libraryManager, name, dtoOptions); if (result != null) { @@ -283,13 +253,7 @@ namespace MediaBrowser.Api { if (name.IndexOf(BaseItem.SlugChar) != -1) { - var result = libraryManager.GetItemList(new InternalItemsQuery - { - SlugName = name, - IncludeItemTypes = new[] { typeof(Person).Name }, - DtoOptions = dtoOptions - - }).OfType().FirstOrDefault(); + var result = GetItemFromSlugName(libraryManager, name, dtoOptions); if (result != null) { @@ -300,6 +264,42 @@ namespace MediaBrowser.Api return libraryManager.GetPerson(name); } + private T GetItemFromSlugName(ILibraryManager libraryManager, string name, DtoOptions dtoOptions) + where T : BaseItem, new() + { + var result = libraryManager.GetItemList(new InternalItemsQuery + { + Name = name.Replace(BaseItem.SlugChar, '&'), + IncludeItemTypes = new[] { typeof(T).Name }, + DtoOptions = dtoOptions + + }).OfType().FirstOrDefault(); + + if (result == null) + { + result = libraryManager.GetItemList(new InternalItemsQuery + { + Name = name.Replace(BaseItem.SlugChar, '/'), + IncludeItemTypes = new[] { typeof(T).Name }, + DtoOptions = dtoOptions + + }).OfType().FirstOrDefault(); + } + + if (result == null) + { + result = libraryManager.GetItemList(new InternalItemsQuery + { + Name = name.Replace(BaseItem.SlugChar, '?'), + IncludeItemTypes = new[] { typeof(T).Name }, + DtoOptions = dtoOptions + + }).OfType().FirstOrDefault(); + } + + return result as T; + } + protected string GetPathValue(int index) { var pathInfo = Parse(Request.PathInfo); diff --git a/MediaBrowser.Controller/Entities/InternalItemsQuery.cs b/MediaBrowser.Controller/Entities/InternalItemsQuery.cs index 4d96c082fb..608e3f56c3 100644 --- a/MediaBrowser.Controller/Entities/InternalItemsQuery.cs +++ b/MediaBrowser.Controller/Entities/InternalItemsQuery.cs @@ -56,7 +56,6 @@ namespace MediaBrowser.Controller.Entities public string Path { get; set; } public string PathNotStartsWith { get; set; } public string Name { get; set; } - public string SlugName { get; set; } public string Person { get; set; } public string[] PersonIds { get; set; } diff --git a/MediaBrowser.Controller/LiveTv/LiveTvProgram.cs b/MediaBrowser.Controller/LiveTv/LiveTvProgram.cs index 87fc581307..9f55a9ff23 100644 --- a/MediaBrowser.Controller/LiveTv/LiveTvProgram.cs +++ b/MediaBrowser.Controller/LiveTv/LiveTvProgram.cs @@ -221,12 +221,6 @@ namespace MediaBrowser.Controller.LiveTv public override bool IsInternetMetadataEnabled() { - if (IsMovie) - { - var options = (LiveTvOptions)ConfigurationManager.GetConfiguration("livetv"); - return options.EnableMovieProviders; - } - return false; } diff --git a/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs b/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs index c14b1f416b..60583b95bf 100644 --- a/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs +++ b/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs @@ -233,7 +233,12 @@ namespace MediaBrowser.Controller.MediaEncoding return null; } - return codec; + if (_mediaEncoder.SupportsDecoder(codec)) + { + return codec; + } + + return null; } /// diff --git a/MediaBrowser.MediaEncoding/Encoder/EncoderValidator.cs b/MediaBrowser.MediaEncoding/Encoder/EncoderValidator.cs index 338f58c167..59f3576ec8 100644 --- a/MediaBrowser.MediaEncoding/Encoder/EncoderValidator.cs +++ b/MediaBrowser.MediaEncoding/Encoder/EncoderValidator.cs @@ -92,7 +92,13 @@ namespace MediaBrowser.MediaEncoding.Encoder "mpeg2_qsv", "vc1_qsv", "h264_cuvid", - "hevc_cuvid" + "hevc_cuvid", + "dts", + "ac3", + "aac", + "mp3", + "h264", + "hevc" }; foreach (var codec in required) diff --git a/MediaBrowser.Model/LiveTv/LiveTvOptions.cs b/MediaBrowser.Model/LiveTv/LiveTvOptions.cs index 91ea977f7e..32153a11ca 100644 --- a/MediaBrowser.Model/LiveTv/LiveTvOptions.cs +++ b/MediaBrowser.Model/LiveTv/LiveTvOptions.cs @@ -1,13 +1,11 @@ using System.Collections.Generic; using MediaBrowser.Model.Dto; -using MediaBrowser.Model.Extensions; namespace MediaBrowser.Model.LiveTv { public class LiveTvOptions { public int? GuideDays { get; set; } - public bool EnableMovieProviders { get; set; } public string RecordingPath { get; set; } public string MovieRecordingPath { get; set; } public string SeriesRecordingPath { get; set; } @@ -30,7 +28,6 @@ namespace MediaBrowser.Model.LiveTv public LiveTvOptions() { - EnableMovieProviders = true; TunerHosts = new List(); ListingProviders = new List(); MediaLocationsCreated = new string[] { }; diff --git a/MediaBrowser.Model/Users/UserPolicy.cs b/MediaBrowser.Model/Users/UserPolicy.cs index 2a987ceb14..e2a75c56be 100644 --- a/MediaBrowser.Model/Users/UserPolicy.cs +++ b/MediaBrowser.Model/Users/UserPolicy.cs @@ -70,6 +70,8 @@ namespace MediaBrowser.Model.Users public UserPolicy() { + EnableContentDeletion = true; + EnableSyncTranscoding = true; EnableMediaPlayback = true; From b615a2aeb16a527fe56a88a352574d76e77783e8 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Tue, 13 Jun 2017 02:33:49 -0400 Subject: [PATCH 2/2] 3.2.20.3 --- SharedVersion.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SharedVersion.cs b/SharedVersion.cs index ca38f525e4..f362517731 100644 --- a/SharedVersion.cs +++ b/SharedVersion.cs @@ -1,3 +1,3 @@ using System.Reflection; -[assembly: AssemblyVersion("3.2.20.2")] +[assembly: AssemblyVersion("3.2.20.3")]