diff options
| author | 7illusions <z@7illusions.com> | 2014-05-12 16:55:07 +0200 |
|---|---|---|
| committer | 7illusions <z@7illusions.com> | 2014-05-12 16:55:07 +0200 |
| commit | baf5cf2544fcaad2246923f60caaf3fed4a94aaf (patch) | |
| tree | a808b700095f876e437b95c432c0220e241f9fda /MediaBrowser.Server.Implementations/Library | |
| parent | 8f3a6279e173dcbaaa05a56556afb410ee12dd4d (diff) | |
| parent | b9b568de13d81f9db1a8502d50940475c1d79c72 (diff) | |
Merge pull request #3 from MediaBrowser/master
Sync with Master
Diffstat (limited to 'MediaBrowser.Server.Implementations/Library')
| -rw-r--r-- | MediaBrowser.Server.Implementations/Library/Resolvers/ItemResolver.cs (renamed from MediaBrowser.Server.Implementations/Library/Resolvers/BaseItemResolver.cs) | 0 | ||||
| -rw-r--r-- | MediaBrowser.Server.Implementations/Library/Resolvers/Movies/MovieResolver.cs | 4 | ||||
| -rw-r--r-- | MediaBrowser.Server.Implementations/Library/UserManager.cs | 1 | ||||
| -rw-r--r-- | MediaBrowser.Server.Implementations/Library/Validators/BoxSetPostScanTask.cs | 2 | ||||
| -rw-r--r-- | MediaBrowser.Server.Implementations/Library/Validators/CountHelpers.cs | 171 | ||||
| -rw-r--r-- | MediaBrowser.Server.Implementations/Library/Validators/PeoplePostScanTask.cs | 44 |
6 files changed, 4 insertions, 218 deletions
diff --git a/MediaBrowser.Server.Implementations/Library/Resolvers/BaseItemResolver.cs b/MediaBrowser.Server.Implementations/Library/Resolvers/ItemResolver.cs index a03eda263..a03eda263 100644 --- a/MediaBrowser.Server.Implementations/Library/Resolvers/BaseItemResolver.cs +++ b/MediaBrowser.Server.Implementations/Library/Resolvers/ItemResolver.cs diff --git a/MediaBrowser.Server.Implementations/Library/Resolvers/Movies/MovieResolver.cs b/MediaBrowser.Server.Implementations/Library/Resolvers/Movies/MovieResolver.cs index 558087a25..905e6e676 100644 --- a/MediaBrowser.Server.Implementations/Library/Resolvers/Movies/MovieResolver.cs +++ b/MediaBrowser.Server.Implementations/Library/Resolvers/Movies/MovieResolver.cs @@ -381,7 +381,7 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers.Movies { firstMovie.IsMultiPart = true; - _logger.Info("Multi-part video found: " + firstMovie.Path); + _logger.Debug("Multi-part video found: " + firstMovie.Path); return firstMovie; } @@ -411,7 +411,7 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers.Movies { firstMovie.HasLocalAlternateVersions = true; - _logger.Info("Multi-version video found: " + firstMovie.Path); + _logger.Debug("Multi-version video found: " + firstMovie.Path); return firstMovie; } diff --git a/MediaBrowser.Server.Implementations/Library/UserManager.cs b/MediaBrowser.Server.Implementations/Library/UserManager.cs index 2ee843f09..23303c41f 100644 --- a/MediaBrowser.Server.Implementations/Library/UserManager.cs +++ b/MediaBrowser.Server.Implementations/Library/UserManager.cs @@ -5,6 +5,7 @@ using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Library; using MediaBrowser.Controller.Persistence; using MediaBrowser.Controller.Providers; +using MediaBrowser.Model.Events; using MediaBrowser.Model.Logging; using System; using System.Collections.Generic; diff --git a/MediaBrowser.Server.Implementations/Library/Validators/BoxSetPostScanTask.cs b/MediaBrowser.Server.Implementations/Library/Validators/BoxSetPostScanTask.cs index f02c907c6..86d88f7e0 100644 --- a/MediaBrowser.Server.Implementations/Library/Validators/BoxSetPostScanTask.cs +++ b/MediaBrowser.Server.Implementations/Library/Validators/BoxSetPostScanTask.cs @@ -27,7 +27,7 @@ namespace MediaBrowser.Server.Implementations.Library.Validators foreach (var boxset in boxsets) { - foreach (var child in boxset.GetLinkedChildren().OfType<ISupportsBoxSetGrouping>()) + foreach (var child in boxset.Children.Concat(boxset.GetLinkedChildren()).OfType<ISupportsBoxSetGrouping>()) { var boxsetIdList = child.BoxSetIdList.ToList(); if (!boxsetIdList.Contains(boxset.Id)) diff --git a/MediaBrowser.Server.Implementations/Library/Validators/CountHelpers.cs b/MediaBrowser.Server.Implementations/Library/Validators/CountHelpers.cs deleted file mode 100644 index edb4e7382..000000000 --- a/MediaBrowser.Server.Implementations/Library/Validators/CountHelpers.cs +++ /dev/null @@ -1,171 +0,0 @@ -using MediaBrowser.Controller.Entities; -using MediaBrowser.Controller.Entities.Audio; -using MediaBrowser.Controller.Entities.Movies; -using MediaBrowser.Controller.Entities.TV; -using MediaBrowser.Model.Dto; -using System; -using System.Collections.Generic; - -namespace MediaBrowser.Server.Implementations.Library.Validators -{ - /// <summary> - /// Class CountHelpers - /// </summary> - internal static class CountHelpers - { - private static CountType? GetCountType(BaseItem item) - { - if (item is Movie) - { - return CountType.Movie; - } - if (item is Episode) - { - return CountType.Episode; - } - if (item is Game) - { - return CountType.Game; - } - if (item is Audio) - { - return CountType.Song; - } - if (item is Trailer) - { - return CountType.Trailer; - } - if (item is Series) - { - return CountType.Series; - } - if (item is MusicAlbum) - { - return CountType.MusicAlbum; - } - if (item is MusicVideo) - { - return CountType.MusicVideo; - } - if (item is AdultVideo) - { - return CountType.AdultVideo; - } - - return null; - } - - /// <summary> - /// Increments the count. - /// </summary> - /// <param name="counts">The counts.</param> - /// <param name="key">The key.</param> - internal static void IncrementCount(Dictionary<CountType, int> counts, CountType key) - { - int count; - - if (counts.TryGetValue(key, out count)) - { - count++; - counts[key] = count; - } - else - { - counts.Add(key, 1); - } - } - - /// <summary> - /// Gets the counts. - /// </summary> - /// <param name="counts">The counts.</param> - /// <returns>ItemByNameCounts.</returns> - internal static ItemByNameCounts GetCounts(Dictionary<CountType, int> counts) - { - return new ItemByNameCounts - { - AdultVideoCount = GetCount(counts, CountType.AdultVideo), - AlbumCount = GetCount(counts, CountType.MusicAlbum), - EpisodeCount = GetCount(counts, CountType.Episode), - GameCount = GetCount(counts, CountType.Game), - MovieCount = GetCount(counts, CountType.Movie), - MusicVideoCount = GetCount(counts, CountType.MusicVideo), - SeriesCount = GetCount(counts, CountType.Series), - SongCount = GetCount(counts, CountType.Song), - TrailerCount = GetCount(counts, CountType.Trailer), - TotalCount = GetCount(counts, CountType.Total) - }; - } - - /// <summary> - /// Gets the count. - /// </summary> - /// <param name="counts">The counts.</param> - /// <param name="key">The key.</param> - /// <returns>System.Int32.</returns> - internal static int GetCount(Dictionary<CountType, int> counts, CountType key) - { - int count; - - if (counts.TryGetValue(key, out count)) - { - return count; - } - - return 0; - } - - /// <summary> - /// Sets the item counts. - /// </summary> - /// <param name="userId">The user id.</param> - /// <param name="media">The media.</param> - /// <param name="names">The names.</param> - /// <param name="masterDictionary">The master dictionary.</param> - internal static void SetItemCounts(Guid userId, BaseItem media, IEnumerable<string> names, Dictionary<string, Dictionary<Guid, Dictionary<CountType, int>>> masterDictionary) - { - var countType = GetCountType(media); - - foreach (var name in names) - { - Dictionary<Guid, Dictionary<CountType, int>> libraryCounts; - - if (!masterDictionary.TryGetValue(name, out libraryCounts)) - { - libraryCounts = new Dictionary<Guid, Dictionary<CountType, int>>(); - masterDictionary.Add(name, libraryCounts); - } - - var userLibId = userId/* ?? Guid.Empty*/; - Dictionary<CountType, int> userDictionary; - - if (!libraryCounts.TryGetValue(userLibId, out userDictionary)) - { - userDictionary = new Dictionary<CountType, int>(); - libraryCounts.Add(userLibId, userDictionary); - } - - if (countType.HasValue) - { - IncrementCount(userDictionary, countType.Value); - } - - IncrementCount(userDictionary, CountType.Total); - } - } - } - - internal enum CountType - { - AdultVideo, - MusicAlbum, - Episode, - Game, - Movie, - MusicVideo, - Series, - Song, - Trailer, - Total - } -} diff --git a/MediaBrowser.Server.Implementations/Library/Validators/PeoplePostScanTask.cs b/MediaBrowser.Server.Implementations/Library/Validators/PeoplePostScanTask.cs deleted file mode 100644 index d11e62a1a..000000000 --- a/MediaBrowser.Server.Implementations/Library/Validators/PeoplePostScanTask.cs +++ /dev/null @@ -1,44 +0,0 @@ -using MediaBrowser.Controller.Library; -using MediaBrowser.Controller.Providers; -using MediaBrowser.Model.Logging; -using System; -using System.Threading; -using System.Threading.Tasks; - -namespace MediaBrowser.Server.Implementations.Library.Validators -{ - class PeoplePostScanTask : ILibraryPostScanTask - { - /// <summary> - /// The _library manager - /// </summary> - private readonly ILibraryManager _libraryManager; - - /// <summary> - /// The _logger - /// </summary> - private readonly ILogger _logger; - - public PeoplePostScanTask(ILibraryManager libraryManager, ILogger logger) - { - _libraryManager = libraryManager; - _logger = logger; - } - - /// <summary> - /// Runs the specified progress. - /// </summary> - /// <param name="progress">The progress.</param> - /// <param name="cancellationToken">The cancellation token.</param> - /// <returns>Task.</returns> - public Task Run(IProgress<double> progress, CancellationToken cancellationToken) - { - return new PeopleValidator(_libraryManager, _logger).ValidatePeople(cancellationToken, new MetadataRefreshOptions - { - ImageRefreshMode = ImageRefreshMode.ValidationOnly, - MetadataRefreshMode = MetadataRefreshMode.None - - }, progress); - } - } -} |
