From 3799ad594080f6476119e59e8d4631c4354ee598 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Tue, 28 Jul 2015 08:33:30 -0400 Subject: update task triggers --- MediaBrowser.Controller/Entities/BaseItem.cs | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'MediaBrowser.Controller/Entities/BaseItem.cs') diff --git a/MediaBrowser.Controller/Entities/BaseItem.cs b/MediaBrowser.Controller/Entities/BaseItem.cs index d9dbf265f..3062c00e7 100644 --- a/MediaBrowser.Controller/Entities/BaseItem.cs +++ b/MediaBrowser.Controller/Entities/BaseItem.cs @@ -1115,6 +1115,18 @@ namespace MediaBrowser.Controller.Entities return value.Value <= maxAllowedRating.Value; } + public int? GetParentalRatingValue() + { + var rating = CustomRatingForComparison; + + if (string.IsNullOrWhiteSpace(rating)) + { + rating = OfficialRatingForComparison; + } + + return LocalizationManager.GetRatingLevel(rating); + } + private bool IsVisibleViaTags(User user) { var hasTags = this as IHasTags; -- cgit v1.2.3 From d95057f13bb6d8bfe04ce20138f8cd2fc66c3519 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Tue, 28 Jul 2015 15:42:24 -0400 Subject: rework settings page --- MediaBrowser.Controller/Entities/BaseItem.cs | 5 +++++ MediaBrowser.Controller/Entities/InternalItemsQuery.cs | 4 ++-- MediaBrowser.Controller/LiveTv/LiveTvProgram.cs | 14 ++++++++++++++ .../MediaEncoding/ISubtitleEncoder.cs | 18 ------------------ .../Subtitles/SubtitleEncoder.cs | 17 +++++------------ .../IO/LibraryMonitor.cs | 16 ++++++++++++++-- .../Library/LibraryManager.cs | 15 +++++++++------ .../Localization/Core/core.json | 4 +--- .../MediaBrowser.WebDashboard.csproj | 1 + 9 files changed, 51 insertions(+), 43 deletions(-) (limited to 'MediaBrowser.Controller/Entities/BaseItem.cs') diff --git a/MediaBrowser.Controller/Entities/BaseItem.cs b/MediaBrowser.Controller/Entities/BaseItem.cs index 3062c00e7..c4917b0d1 100644 --- a/MediaBrowser.Controller/Entities/BaseItem.cs +++ b/MediaBrowser.Controller/Entities/BaseItem.cs @@ -1124,6 +1124,11 @@ namespace MediaBrowser.Controller.Entities rating = OfficialRatingForComparison; } + if (string.IsNullOrWhiteSpace(rating)) + { + return null; + } + return LocalizationManager.GetRatingLevel(rating); } diff --git a/MediaBrowser.Controller/Entities/InternalItemsQuery.cs b/MediaBrowser.Controller/Entities/InternalItemsQuery.cs index c9603c7e3..227a6bd0e 100644 --- a/MediaBrowser.Controller/Entities/InternalItemsQuery.cs +++ b/MediaBrowser.Controller/Entities/InternalItemsQuery.cs @@ -1,6 +1,6 @@ -using System.Collections.Generic; -using MediaBrowser.Model.Entities; +using MediaBrowser.Model.Entities; using System; +using System.Collections.Generic; namespace MediaBrowser.Controller.Entities { diff --git a/MediaBrowser.Controller/LiveTv/LiveTvProgram.cs b/MediaBrowser.Controller/LiveTv/LiveTvProgram.cs index 8232c5c7a..b54a7aaee 100644 --- a/MediaBrowser.Controller/LiveTv/LiveTvProgram.cs +++ b/MediaBrowser.Controller/LiveTv/LiveTvProgram.cs @@ -227,5 +227,19 @@ namespace MediaBrowser.Controller.LiveTv info.IsMovie = IsMovie; return info; } + + public override bool SupportsPeople + { + get + { + // Optimization + if (IsNews || IsSports) + { + return false; + } + + return base.SupportsPeople; + } + } } } diff --git a/MediaBrowser.Controller/MediaEncoding/ISubtitleEncoder.cs b/MediaBrowser.Controller/MediaEncoding/ISubtitleEncoder.cs index e4a2cd007..826711e51 100644 --- a/MediaBrowser.Controller/MediaEncoding/ISubtitleEncoder.cs +++ b/MediaBrowser.Controller/MediaEncoding/ISubtitleEncoder.cs @@ -7,24 +7,6 @@ namespace MediaBrowser.Controller.MediaEncoding { public interface ISubtitleEncoder { - /// - /// Converts the subtitles. - /// - /// The stream. - /// The input format. - /// The output format. - /// The start time ticks. - /// The end time ticks. - /// The cancellation token. - /// Task{Stream}. - Task ConvertSubtitles( - Stream stream, - string inputFormat, - string outputFormat, - long startTimeTicks, - long? endTimeTicks, - CancellationToken cancellationToken); - /// /// Gets the subtitles. /// diff --git a/MediaBrowser.MediaEncoding/Subtitles/SubtitleEncoder.cs b/MediaBrowser.MediaEncoding/Subtitles/SubtitleEncoder.cs index 60b70ad08..fe616c63e 100644 --- a/MediaBrowser.MediaEncoding/Subtitles/SubtitleEncoder.cs +++ b/MediaBrowser.MediaEncoding/Subtitles/SubtitleEncoder.cs @@ -53,7 +53,7 @@ namespace MediaBrowser.MediaEncoding.Subtitles } } - public async Task ConvertSubtitles(Stream stream, + private async Task ConvertSubtitles(Stream stream, string inputFormat, string outputFormat, long startTimeTicks, @@ -64,7 +64,9 @@ namespace MediaBrowser.MediaEncoding.Subtitles try { - var trackInfo = await GetTrackInfo(stream, inputFormat, cancellationToken).ConfigureAwait(false); + var reader = GetReader(inputFormat, true); + + var trackInfo = reader.Parse(stream, cancellationToken); FilterEvents(trackInfo, startTimeTicks, endTimeTicks, false); @@ -190,7 +192,7 @@ namespace MediaBrowser.MediaEncoding.Subtitles { throw new ArgumentNullException("charset"); } - + try { return Encoding.GetEncoding(charset); @@ -257,15 +259,6 @@ namespace MediaBrowser.MediaEncoding.Subtitles return new Tuple(subtitleStream.Path, protocol, currentFormat, true); } - private async Task GetTrackInfo(Stream stream, - string inputFormat, - CancellationToken cancellationToken) - { - var reader = GetReader(inputFormat, true); - - return reader.Parse(stream, cancellationToken); - } - private ISubtitleParser GetReader(string format, bool throwIfMissing) { if (string.IsNullOrEmpty(format)) diff --git a/MediaBrowser.Server.Implementations/IO/LibraryMonitor.cs b/MediaBrowser.Server.Implementations/IO/LibraryMonitor.cs index d6a1be962..26ccdfc9a 100644 --- a/MediaBrowser.Server.Implementations/IO/LibraryMonitor.cs +++ b/MediaBrowser.Server.Implementations/IO/LibraryMonitor.cs @@ -1,4 +1,5 @@ -using MediaBrowser.Common.IO; +using System.ComponentModel; +using MediaBrowser.Common.IO; using MediaBrowser.Common.ScheduledTasks; using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Entities; @@ -338,7 +339,7 @@ namespace MediaBrowser.Server.Implementations.IO } catch { - + } finally { @@ -370,6 +371,17 @@ namespace MediaBrowser.Server.Implementations.IO Logger.ErrorException("Error in Directory watcher for: " + dw.Path, ex); DisposeWatcher(dw); + + if (ex is Win32Exception) + { + Logger.Info("Disabling realtime monitor to prevent future instability"); + + if (ConfigurationManager.Configuration.EnableLibraryMonitor == AutoOnOff.Auto) + { + ConfigurationManager.Configuration.EnableLibraryMonitor = AutoOnOff.Disabled; + Stop(); + } + } } /// diff --git a/MediaBrowser.Server.Implementations/Library/LibraryManager.cs b/MediaBrowser.Server.Implementations/Library/LibraryManager.cs index 8d51e3e92..497a198fd 100644 --- a/MediaBrowser.Server.Implementations/Library/LibraryManager.cs +++ b/MediaBrowser.Server.Implementations/Library/LibraryManager.cs @@ -2071,14 +2071,17 @@ namespace MediaBrowser.Server.Implementations.Library public List GetPeople(BaseItem item) { - var people = GetPeople(new InternalPeopleQuery + if (item.SupportsPeople) { - ItemId = item.Id - }); + var people = GetPeople(new InternalPeopleQuery + { + ItemId = item.Id + }); - if (people.Count > 0) - { - return people; + if (people.Count > 0) + { + return people; + } } return item.People ?? new List(); diff --git a/MediaBrowser.Server.Implementations/Localization/Core/core.json b/MediaBrowser.Server.Implementations/Localization/Core/core.json index 44a10f0a9..4eb66929d 100644 --- a/MediaBrowser.Server.Implementations/Localization/Core/core.json +++ b/MediaBrowser.Server.Implementations/Localization/Core/core.json @@ -173,7 +173,5 @@ "HeaderProducer": "Producers", "HeaderWriter": "Writers", "HeaderParentalRatings": "Parental Ratings", - "HeaderCommunityRatings": "Community ratings", - - + "HeaderCommunityRatings": "Community ratings" } diff --git a/MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csproj b/MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csproj index f585a7c26..3e67540d8 100644 --- a/MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csproj +++ b/MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csproj @@ -204,6 +204,7 @@ PreserveNewest + PreserveNewest -- cgit v1.2.3 From 3aa1aff3719f279304cbacefd2aae1d217f6833f Mon Sep 17 00:00:00 2001 From: Eric Reed Date: Thu, 20 Aug 2015 09:05:41 -0400 Subject: Properly handle ratings for which we can't determine a value --- MediaBrowser.Controller/Entities/BaseItem.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'MediaBrowser.Controller/Entities/BaseItem.cs') diff --git a/MediaBrowser.Controller/Entities/BaseItem.cs b/MediaBrowser.Controller/Entities/BaseItem.cs index c4917b0d1..eaa9f8438 100644 --- a/MediaBrowser.Controller/Entities/BaseItem.cs +++ b/MediaBrowser.Controller/Entities/BaseItem.cs @@ -1109,7 +1109,7 @@ namespace MediaBrowser.Controller.Entities // Could not determine the integer value if (!value.HasValue) { - return true; + return !GetBlockUnratedValue(user.Policy); } return value.Value <= maxAllowedRating.Value; -- cgit v1.2.3 From 2667788b0068dc113e8e0d869a42458f2b221ad1 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Fri, 21 Aug 2015 12:54:03 -0400 Subject: revert parental control change --- MediaBrowser.Controller/Entities/BaseItem.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'MediaBrowser.Controller/Entities/BaseItem.cs') diff --git a/MediaBrowser.Controller/Entities/BaseItem.cs b/MediaBrowser.Controller/Entities/BaseItem.cs index eaa9f8438..c4917b0d1 100644 --- a/MediaBrowser.Controller/Entities/BaseItem.cs +++ b/MediaBrowser.Controller/Entities/BaseItem.cs @@ -1109,7 +1109,7 @@ namespace MediaBrowser.Controller.Entities // Could not determine the integer value if (!value.HasValue) { - return !GetBlockUnratedValue(user.Policy); + return true; } return value.Value <= maxAllowedRating.Value; -- cgit v1.2.3 From de133cb8aa2b078ba653ee7c3e1cef4fd16996d6 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Fri, 21 Aug 2015 22:59:10 -0400 Subject: update search --- MediaBrowser.Controller/Entities/BaseItem.cs | 1 + MediaBrowser.Controller/LiveTv/LiveTvProgram.cs | 6 + MediaBrowser.Controller/LiveTv/ProgramInfo.cs | 5 + .../Library/SearchEngine.cs | 272 ++++++--------------- .../Library/Validators/GameGenresValidator.cs | 27 +- .../Library/Validators/GenresValidator.cs | 27 +- .../Library/Validators/MusicGenresValidator.cs | 28 ++- .../Library/Validators/StudiosValidator.cs | 28 ++- .../LiveTv/EmbyTV/EmbyTV.cs | 18 +- .../LiveTv/Listings/SchedulesDirect.cs | 5 +- .../LiveTv/LiveTvManager.cs | 9 +- MediaBrowser.WebDashboard/Api/PackageCreator.cs | 2 +- .../MediaBrowser.WebDashboard.csproj | 18 +- 13 files changed, 224 insertions(+), 222 deletions(-) (limited to 'MediaBrowser.Controller/Entities/BaseItem.cs') diff --git a/MediaBrowser.Controller/Entities/BaseItem.cs b/MediaBrowser.Controller/Entities/BaseItem.cs index c4917b0d1..cd5c39173 100644 --- a/MediaBrowser.Controller/Entities/BaseItem.cs +++ b/MediaBrowser.Controller/Entities/BaseItem.cs @@ -485,6 +485,7 @@ namespace MediaBrowser.Controller.Entities /// Gets or sets the parent. /// /// The parent. + [IgnoreDataMember] public Folder Parent { get diff --git a/MediaBrowser.Controller/LiveTv/LiveTvProgram.cs b/MediaBrowser.Controller/LiveTv/LiveTvProgram.cs index 14944d36f..12052905f 100644 --- a/MediaBrowser.Controller/LiveTv/LiveTvProgram.cs +++ b/MediaBrowser.Controller/LiveTv/LiveTvProgram.cs @@ -30,6 +30,12 @@ namespace MediaBrowser.Controller.LiveTv return GetClientTypeName() + "-" + Name; } + /// + /// Gets or sets the etag. + /// + /// The etag. + public string Etag { get; set; } + /// /// Id of the program. /// diff --git a/MediaBrowser.Controller/LiveTv/ProgramInfo.cs b/MediaBrowser.Controller/LiveTv/ProgramInfo.cs index 467264e7a..a6a3e6108 100644 --- a/MediaBrowser.Controller/LiveTv/ProgramInfo.cs +++ b/MediaBrowser.Controller/LiveTv/ProgramInfo.cs @@ -180,6 +180,11 @@ namespace MediaBrowser.Controller.LiveTv /// /// The episode number. public int? EpisodeNumber { get; set; } + /// + /// Gets or sets the etag. + /// + /// The etag. + public string Etag { get; set; } public ProgramInfo() { diff --git a/MediaBrowser.Server.Implementations/Library/SearchEngine.cs b/MediaBrowser.Server.Implementations/Library/SearchEngine.cs index 21e92786d..d4ff89b4f 100644 --- a/MediaBrowser.Server.Implementations/Library/SearchEngine.cs +++ b/MediaBrowser.Server.Implementations/Library/SearchEngine.cs @@ -33,26 +33,17 @@ namespace MediaBrowser.Server.Implementations.Library public async Task> GetSearchHints(SearchQuery query) { - IEnumerable inputItems; - - Func filter = i => !(i is ICollectionFolder); - User user = null; if (string.IsNullOrWhiteSpace(query.UserId)) { - inputItems = _libraryManager.RootFolder.GetRecursiveChildren(filter); } else { user = _userManager.GetUserById(query.UserId); - - inputItems = user.RootFolder.GetRecursiveChildren(user, filter); } - inputItems = _libraryManager.ReplaceVideosWithPrimaryVersions(inputItems); - - var results = await GetSearchHints(inputItems, query, user).ConfigureAwait(false); + var results = await GetSearchHints(query, user).ConfigureAwait(false); var searchResultArray = results.ToArray(); results = searchResultArray; @@ -77,15 +68,22 @@ namespace MediaBrowser.Server.Implementations.Library }; } + private void AddIfMissing(List list, string value) + { + if (!list.Contains(value, StringComparer.OrdinalIgnoreCase)) + { + list.Add(value); + } + } + /// /// Gets the search hints. /// - /// The input items. /// The query. /// The user. /// IEnumerable{SearchHintResult}. /// searchTerm - private Task> GetSearchHints(IEnumerable inputItems, SearchQuery query, User user) + private Task> GetSearchHints(SearchQuery query, User user) { var searchTerm = query.SearchTerm; @@ -100,207 +98,80 @@ namespace MediaBrowser.Server.Implementations.Library var hints = new List>(); - var items = inputItems.Where(i => !(i is MusicArtist)).ToList(); + var excludeItemTypes = new List(); + var includeItemTypes = (query.IncludeItemTypes ?? new string[] { }).ToList(); - if (query.IncludeMedia) - { - var mediaItems = _libraryManager.GetItems(new InternalItemsQuery - { - NameContains = searchTerm, - ExcludeItemTypes = new[] - { - typeof (Person).Name, - typeof (Genre).Name, - typeof (MusicArtist).Name, - typeof (GameGenre).Name, - typeof (MusicGenre).Name, - typeof (Year).Name, - typeof (Studio).Name - }, - IncludeItemTypes = query.IncludeItemTypes - - }).Items; - - // Add search hints based on item name - hints.AddRange(mediaItems.Where(i => IncludeInSearch(i) && (user == null || i.IsVisibleStandalone(user)) && !(i is CollectionFolder)).Select(item => - { - var index = GetIndex(item.Name, searchTerm, terms); + excludeItemTypes.Add(typeof(Year).Name); - return new Tuple(item, index.Item1, index.Item2); - })); - } - - if (query.IncludeArtists && (query.IncludeItemTypes.Length == 0 || query.IncludeItemTypes.Contains("MusicArtist", StringComparer.OrdinalIgnoreCase))) + if (query.IncludeGenres && (includeItemTypes.Count == 0 || includeItemTypes.Contains("Genre", StringComparer.OrdinalIgnoreCase))) { - // Find artists - var artists = items.OfType