diff --git a/MediaBrowser.Api/Movies/MoviesService.cs b/MediaBrowser.Api/Movies/MoviesService.cs index d8946e416..8a6e5b8df 100644 --- a/MediaBrowser.Api/Movies/MoviesService.cs +++ b/MediaBrowser.Api/Movies/MoviesService.cs @@ -135,12 +135,9 @@ namespace MediaBrowser.Api.Movies IncludeItemTypes = new[] { typeof(Movie).Name } }; - if (user.Configuration.IncludeTrailersInSuggestions) - { - var includeList = query.IncludeItemTypes.ToList(); - includeList.Add(typeof(Trailer).Name); - query.IncludeItemTypes = includeList.ToArray(); - } + var includeList = query.IncludeItemTypes.ToList(); + includeList.Add(typeof(Trailer).Name); + query.IncludeItemTypes = includeList.ToArray(); var parentIds = string.IsNullOrWhiteSpace(request.ParentId) ? new string[] { } : new[] { request.ParentId }; var movies = _libraryManager.GetItemList(query, parentIds) @@ -188,12 +185,9 @@ namespace MediaBrowser.Api.Movies IncludeItemTypes = new[] { typeof(Movie).Name } }; - if (user == null || user.Configuration.IncludeTrailersInSuggestions) - { - var includeList = query.IncludeItemTypes.ToList(); - includeList.Add(typeof(Trailer).Name); - query.IncludeItemTypes = includeList.ToArray(); - } + var includeList = query.IncludeItemTypes.ToList(); + includeList.Add(typeof(Trailer).Name); + query.IncludeItemTypes = includeList.ToArray(); var list = _libraryManager.GetItemList(query) .OrderBy(i => (int)i.SourceType) diff --git a/MediaBrowser.Controller/Entities/BaseItem.cs b/MediaBrowser.Controller/Entities/BaseItem.cs index 1a9bd618d..2a00ce992 100644 --- a/MediaBrowser.Controller/Entities/BaseItem.cs +++ b/MediaBrowser.Controller/Entities/BaseItem.cs @@ -26,6 +26,7 @@ using System.Threading.Tasks; using CommonIO; using MediaBrowser.Controller.Sorting; using MediaBrowser.Model.LiveTv; +using MediaBrowser.Model.Providers; namespace MediaBrowser.Controller.Entities { @@ -2212,5 +2213,10 @@ namespace MediaBrowser.Controller.Entities DeleteFileLocation = false }); } + + public virtual List GetRelatedUrls() + { + return new List(); + } } } \ No newline at end of file diff --git a/MediaBrowser.Controller/Entities/Movies/Movie.cs b/MediaBrowser.Controller/Entities/Movies/Movie.cs index 5882b5f4d..605221dcd 100644 --- a/MediaBrowser.Controller/Entities/Movies/Movie.cs +++ b/MediaBrowser.Controller/Entities/Movies/Movie.cs @@ -8,6 +8,7 @@ using System.Runtime.Serialization; using System.Threading; using System.Threading.Tasks; using CommonIO; +using MediaBrowser.Model.Providers; namespace MediaBrowser.Controller.Entities.Movies { @@ -163,5 +164,22 @@ namespace MediaBrowser.Controller.Entities.Movies return hasChanges; } + + public override List GetRelatedUrls() + { + var list = base.GetRelatedUrls(); + + var imdbId = this.GetProviderId(MetadataProviders.Imdb); + if (!string.IsNullOrWhiteSpace(imdbId)) + { + list.Add(new ExternalUrl + { + Name = "Trakt", + Url = string.Format("https://trakt.tv/movies/{0}", imdbId) + }); + } + + return list; + } } } diff --git a/MediaBrowser.Controller/Entities/Trailer.cs b/MediaBrowser.Controller/Entities/Trailer.cs index 3be2fc624..74645bbe9 100644 --- a/MediaBrowser.Controller/Entities/Trailer.cs +++ b/MediaBrowser.Controller/Entities/Trailer.cs @@ -5,6 +5,7 @@ using System.Collections.Generic; using System.Globalization; using System.Runtime.Serialization; using MediaBrowser.Controller.Entities.Movies; +using MediaBrowser.Model.Providers; namespace MediaBrowser.Controller.Entities { @@ -110,5 +111,22 @@ namespace MediaBrowser.Controller.Entities return hasChanges; } + + public override List GetRelatedUrls() + { + var list = base.GetRelatedUrls(); + + var imdbId = this.GetProviderId(MetadataProviders.Imdb); + if (!string.IsNullOrWhiteSpace(imdbId)) + { + list.Add(new ExternalUrl + { + Name = "Trakt", + Url = string.Format("https://trakt.tv/movies/{0}", imdbId) + }); + } + + return list; + } } } diff --git a/MediaBrowser.Controller/LiveTv/LiveTvProgram.cs b/MediaBrowser.Controller/LiveTv/LiveTvProgram.cs index cc30709db..74c993248 100644 --- a/MediaBrowser.Controller/LiveTv/LiveTvProgram.cs +++ b/MediaBrowser.Controller/LiveTv/LiveTvProgram.cs @@ -7,6 +7,7 @@ using System; using System.Collections.Generic; using System.Runtime.Serialization; using MediaBrowser.Model.Entities; +using MediaBrowser.Model.Providers; namespace MediaBrowser.Controller.LiveTv { @@ -235,5 +236,25 @@ namespace MediaBrowser.Controller.LiveTv return false; } } + + public override List GetRelatedUrls() + { + var list = base.GetRelatedUrls(); + + var imdbId = this.GetProviderId(MetadataProviders.Imdb); + if (!string.IsNullOrWhiteSpace(imdbId)) + { + if (IsMovie) + { + list.Add(new ExternalUrl + { + Name = "Trakt", + Url = string.Format("https://trakt.tv/movies/{0}", imdbId) + }); + } + } + + return list; + } } } diff --git a/MediaBrowser.Controller/Providers/IProviderManager.cs b/MediaBrowser.Controller/Providers/IProviderManager.cs index a976a7f71..3eefa9647 100644 --- a/MediaBrowser.Controller/Providers/IProviderManager.cs +++ b/MediaBrowser.Controller/Providers/IProviderManager.cs @@ -133,7 +133,7 @@ namespace MediaBrowser.Controller.Providers /// /// The item. /// IEnumerable{ExternalUrl}. - IEnumerable GetExternalUrls(IHasProviderIds item); + IEnumerable GetExternalUrls(BaseItem item); /// /// Gets the external identifier infos. diff --git a/MediaBrowser.Model/Configuration/UserConfiguration.cs b/MediaBrowser.Model/Configuration/UserConfiguration.cs index 062c4674e..6195e3e70 100644 --- a/MediaBrowser.Model/Configuration/UserConfiguration.cs +++ b/MediaBrowser.Model/Configuration/UserConfiguration.cs @@ -39,8 +39,6 @@ namespace MediaBrowser.Model.Configuration public string[] OrderedViews { get; set; } - public bool IncludeTrailersInSuggestions { get; set; } - public string[] LatestItemsExcludes { get; set; } public string[] PlainFolderViews { get; set; } @@ -68,8 +66,6 @@ namespace MediaBrowser.Model.Configuration PlainFolderViews = new string[] { }; - IncludeTrailersInSuggestions = true; - GroupedFolders = new string[] { }; } } diff --git a/MediaBrowser.Providers/Manager/ProviderManager.cs b/MediaBrowser.Providers/Manager/ProviderManager.cs index 29897e073..0f0745d1b 100644 --- a/MediaBrowser.Providers/Manager/ProviderManager.cs +++ b/MediaBrowser.Providers/Manager/ProviderManager.cs @@ -830,7 +830,7 @@ namespace MediaBrowser.Providers.Manager }); } - public IEnumerable GetExternalUrls(IHasProviderIds item) + public IEnumerable GetExternalUrls(BaseItem item) { return GetExternalIds(item) .Select(i => @@ -853,7 +853,7 @@ namespace MediaBrowser.Providers.Manager Url = string.Format(i.UrlFormatString, value) }; - }).Where(i => i != null); + }).Where(i => i != null).Concat(item.GetRelatedUrls()); } public IEnumerable GetExternalIdInfos(IHasProviderIds item) diff --git a/MediaBrowser.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs b/MediaBrowser.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs index 25822a81b..6e5e8298f 100644 --- a/MediaBrowser.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs +++ b/MediaBrowser.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs @@ -548,9 +548,20 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV { PostPaddingSeconds = Math.Max(config.PostPaddingSeconds, 0), PrePaddingSeconds = Math.Max(config.PrePaddingSeconds, 0), - RecordAnyChannel = false, - RecordAnyTime = false, - RecordNewOnly = false + RecordAnyChannel = true, + RecordAnyTime = true, + RecordNewOnly = false, + + Days = new List + { + DayOfWeek.Sunday, + DayOfWeek.Monday, + DayOfWeek.Tuesday, + DayOfWeek.Wednesday, + DayOfWeek.Thursday, + DayOfWeek.Friday, + DayOfWeek.Saturday + } }; if (program != null) @@ -1215,6 +1226,8 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV if (!seriesTimer.RecordAnyTime) { allPrograms = allPrograms.Where(epg => Math.Abs(seriesTimer.StartDate.TimeOfDay.Ticks - epg.StartDate.TimeOfDay.Ticks) < TimeSpan.FromMinutes(5).Ticks); + + allPrograms = allPrograms.Where(i => seriesTimer.Days.Contains(i.StartDate.ToLocalTime().DayOfWeek)); } if (seriesTimer.RecordNewOnly) @@ -1227,8 +1240,6 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV allPrograms = allPrograms.Where(epg => string.Equals(epg.ChannelId, seriesTimer.ChannelId, StringComparison.OrdinalIgnoreCase)); } - allPrograms = allPrograms.Where(i => seriesTimer.Days.Contains(i.StartDate.ToLocalTime().DayOfWeek)); - if (string.IsNullOrWhiteSpace(seriesTimer.SeriesId)) { _logger.Error("seriesTimer.SeriesId is null. Cannot find programs for series"); diff --git a/MediaBrowser.Server.Implementations/Persistence/SqliteItemRepository.cs b/MediaBrowser.Server.Implementations/Persistence/SqliteItemRepository.cs index b1f43d20f..2775389a2 100644 --- a/MediaBrowser.Server.Implementations/Persistence/SqliteItemRepository.cs +++ b/MediaBrowser.Server.Implementations/Persistence/SqliteItemRepository.cs @@ -248,7 +248,7 @@ namespace MediaBrowser.Server.Implementations.Persistence "create index if not exists idx_PresentationUniqueKey on TypedBaseItems(PresentationUniqueKey)", "create index if not exists idx_Type on TypedBaseItems(Type)", "create index if not exists idx_TopParentId on TypedBaseItems(TopParentId)", - //"create index if not exists idx_TypeTopParentId on TypedBaseItems(Type,TopParentId)" + "create index if not exists idx_TypeTopParentId on TypedBaseItems(Type,TopParentId)" }; _connection.RunQueries(postQueries, Logger); diff --git a/MediaBrowser.Server.Implementations/Sync/SyncJobProcessor.cs b/MediaBrowser.Server.Implementations/Sync/SyncJobProcessor.cs index 398dcc86b..886308d43 100644 --- a/MediaBrowser.Server.Implementations/Sync/SyncJobProcessor.cs +++ b/MediaBrowser.Server.Implementations/Sync/SyncJobProcessor.cs @@ -483,6 +483,11 @@ namespace MediaBrowser.Server.Implementations.Sync private async Task ProcessJobItem(SyncJobItem jobItem, bool enableConversion, IProgress progress, CancellationToken cancellationToken) { + if (jobItem == null) + { + throw new ArgumentNullException("jobItem"); + } + var item = _libraryManager.GetItemById(jobItem.ItemId); if (item == null) {