From 63c9104e624d0d22e6c5baf79db2d7bb9deb74d0 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Fri, 6 Dec 2013 15:07:34 -0500 Subject: [PATCH] Pull ProviderData out of memory --- MediaBrowser.Controller/Entities/BaseItem.cs | 23 -- .../Persistence/IItemRepository.cs | 17 ++ .../Providers/BaseMetadataProvider.cs | 39 +-- .../Providers/BaseProviderInfo.cs | 1 + .../FolderProviderFromXml.cs | 20 +- .../Games/GameProviderFromXml.cs | 16 +- .../Games/GameSystemProviderFromXml.cs | 15 +- .../ImageFromMediaLocationProvider.cs | 4 +- .../LiveTv/ChannelProviderFromXml.cs | 15 +- .../MediaInfo/AudioImageProvider.cs | 4 +- .../MediaInfo/FFProbeAudioInfoProvider.cs | 5 +- .../MediaInfo/FFProbeVideoInfoProvider.cs | 18 +- .../MediaInfo/VideoImageProvider.cs | 4 +- .../Movies/BoxSetProviderFromXml.cs | 15 +- .../Movies/FanArtMovieProvider.cs | 4 +- .../Movies/MovieDbImagesProvider.cs | 4 +- .../Movies/MovieDbPersonImageProvider.cs | 4 +- .../Movies/MovieDbPersonProvider.cs | 6 +- .../Movies/MovieDbProvider.cs | 4 +- .../Movies/MovieProviderFromXml.cs | 15 +- .../Movies/OpenMovieDatabaseProvider.cs | 6 +- .../Movies/PersonProviderFromXml.cs | 15 +- .../Music/AlbumInfoFromSongProvider.cs | 13 +- .../Music/AlbumProviderFromXml.cs | 15 +- .../Music/ArtistInfoFromSongProvider.cs | 13 +- .../Music/ArtistProviderFromXml.cs | 15 +- .../Music/FanArtAlbumProvider.cs | 6 +- .../Music/FanArtArtistProvider.cs | 4 +- .../Music/LastFmImageProvider.cs | 4 +- .../Music/LastfmAlbumProvider.cs | 13 +- .../Music/LastfmArtistProvider.cs | 4 +- .../Music/MusicBrainzAlbumProvider.cs | 4 +- .../EpisodeImageFromMediaLocationProvider.cs | 4 +- .../TV/EpisodeIndexNumberProvider.cs | 4 +- .../TV/EpisodeProviderFromXml.cs | 53 ++-- .../TV/FanArtSeasonProvider.cs | 4 +- MediaBrowser.Providers/TV/FanArtTVProvider.cs | 6 +- .../TV/SeasonProviderFromXml.cs | 15 +- .../TV/SeriesDynamicInfoProvider.cs | 2 +- .../TV/SeriesProviderFromXml.cs | 21 +- .../TV/TvdbEpisodeProvider.cs | 4 +- .../TV/TvdbPersonImageProvider.cs | 6 +- .../TV/TvdbSeasonProvider.cs | 4 +- .../TV/TvdbSeriesImageProvider.cs | 4 +- .../TV/TvdbSeriesProvider.cs | 4 +- .../UserRootFolderNameProvider.cs | 4 +- .../Library/UserManager.cs | 5 + .../LiveTv/ChannelImageProvider.cs | 6 +- ...MediaBrowser.Server.Implementations.csproj | 1 + .../Persistence/SqliteItemRepository.cs | 29 +- .../SqliteProviderInfoRepository.cs | 265 ++++++++++++++++++ .../Persistence/SqliteUserDataRepository.cs | 2 +- .../Providers/ProviderManager.cs | 39 ++- .../ApplicationHost.cs | 2 +- 54 files changed, 483 insertions(+), 346 deletions(-) create mode 100644 MediaBrowser.Server.Implementations/Persistence/SqliteProviderInfoRepository.cs diff --git a/MediaBrowser.Controller/Entities/BaseItem.cs b/MediaBrowser.Controller/Entities/BaseItem.cs index 7022dad7fd..541887598d 100644 --- a/MediaBrowser.Controller/Entities/BaseItem.cs +++ b/MediaBrowser.Controller/Entities/BaseItem.cs @@ -201,29 +201,6 @@ namespace MediaBrowser.Controller.Entities } } - /// - /// The _provider data - /// - private Dictionary _providerData; - /// - /// Holds persistent data for providers like last refresh date. - /// Providers can use this to determine if they need to refresh. - /// The BaseProviderInfo class can be extended to hold anything a provider may need. - /// Keyed by a unique provider ID. - /// - /// The provider data. - public Dictionary ProviderData - { - get - { - return _providerData ?? (_providerData = new Dictionary()); - } - set - { - _providerData = value; - } - } - /// /// Gets the type of the media. /// diff --git a/MediaBrowser.Controller/Persistence/IItemRepository.cs b/MediaBrowser.Controller/Persistence/IItemRepository.cs index 3a5cb4e870..3affe48e74 100644 --- a/MediaBrowser.Controller/Persistence/IItemRepository.cs +++ b/MediaBrowser.Controller/Persistence/IItemRepository.cs @@ -1,4 +1,5 @@ using MediaBrowser.Controller.Entities; +using MediaBrowser.Controller.Providers; using MediaBrowser.Model.Entities; using System; using System.Collections.Generic; @@ -111,6 +112,22 @@ namespace MediaBrowser.Controller.Persistence /// The cancellation token. /// Task. Task SaveMediaStreams(Guid id, IEnumerable streams, CancellationToken cancellationToken); + + /// + /// Gets the provider history. + /// + /// The item identifier. + /// IEnumerable{BaseProviderInfo}. + IEnumerable GetProviderHistory(Guid itemId); + + /// + /// Saves the provider history. + /// + /// The identifier. + /// The history. + /// The cancellation token. + /// Task. + Task SaveProviderHistory(Guid id, IEnumerable history, CancellationToken cancellationToken); } } diff --git a/MediaBrowser.Controller/Providers/BaseMetadataProvider.cs b/MediaBrowser.Controller/Providers/BaseMetadataProvider.cs index 07bb7d5b20..40afe0b544 100644 --- a/MediaBrowser.Controller/Providers/BaseMetadataProvider.cs +++ b/MediaBrowser.Controller/Providers/BaseMetadataProvider.cs @@ -36,7 +36,7 @@ namespace MediaBrowser.Controller.Providers /// /// The _id /// - protected readonly Guid Id; + public readonly Guid Id; /// /// The true task result @@ -132,41 +132,33 @@ namespace MediaBrowser.Controller.Providers /// The item. /// The value. /// The provider version. + /// The provider information. /// The status. /// item public virtual void SetLastRefreshed(BaseItem item, DateTime value, string providerVersion, - ProviderRefreshStatus status = ProviderRefreshStatus.Success) + BaseProviderInfo providerInfo, ProviderRefreshStatus status = ProviderRefreshStatus.Success) { if (item == null) { throw new ArgumentNullException("item"); } - BaseProviderInfo data; - - if (!item.ProviderData.TryGetValue(Id, out data)) - { - data = new BaseProviderInfo(); - } - - data.LastRefreshed = value; - data.LastRefreshStatus = status; - data.ProviderVersion = providerVersion; + providerInfo.LastRefreshed = value; + providerInfo.LastRefreshStatus = status; + providerInfo.ProviderVersion = providerVersion; // Save the file system stamp for future comparisons if (RefreshOnFileSystemStampChange && item.LocationType == LocationType.FileSystem) { try { - data.FileStamp = GetCurrentFileSystemStamp(item); + providerInfo.FileStamp = GetCurrentFileSystemStamp(item); } catch (IOException ex) { Logger.ErrorException("Error getting file stamp for {0}", ex, item.Path); } } - - item.ProviderData[Id] = data; } /// @@ -174,11 +166,12 @@ namespace MediaBrowser.Controller.Providers /// /// The item. /// The value. + /// The provider information. /// The status. public void SetLastRefreshed(BaseItem item, DateTime value, - ProviderRefreshStatus status = ProviderRefreshStatus.Success) + BaseProviderInfo providerInfo, ProviderRefreshStatus status = ProviderRefreshStatus.Success) { - SetLastRefreshed(item, value, ProviderVersion, status); + SetLastRefreshed(item, value, ProviderVersion, providerInfo, status); } /// @@ -189,20 +182,13 @@ namespace MediaBrowser.Controller.Providers /// The item. /// true if XXXX, false otherwise /// - public bool NeedsRefresh(BaseItem item) + public bool NeedsRefresh(BaseItem item, BaseProviderInfo data) { if (item == null) { throw new ArgumentNullException(); } - BaseProviderInfo data; - - if (!item.ProviderData.TryGetValue(Id, out data)) - { - data = new BaseProviderInfo(); - } - return NeedsRefreshInternal(item, data); } @@ -299,10 +285,11 @@ namespace MediaBrowser.Controller.Providers /// /// The item. /// if set to true [force]. + /// The provider information. /// The cancellation token. /// Task{System.Boolean}. /// - public abstract Task FetchAsync(BaseItem item, bool force, CancellationToken cancellationToken); + public abstract Task FetchAsync(BaseItem item, bool force, BaseProviderInfo providerInfo, CancellationToken cancellationToken); /// /// Gets the priority. diff --git a/MediaBrowser.Controller/Providers/BaseProviderInfo.cs b/MediaBrowser.Controller/Providers/BaseProviderInfo.cs index 243ce32af6..829dd34c8e 100644 --- a/MediaBrowser.Controller/Providers/BaseProviderInfo.cs +++ b/MediaBrowser.Controller/Providers/BaseProviderInfo.cs @@ -7,6 +7,7 @@ namespace MediaBrowser.Controller.Providers /// public class BaseProviderInfo { + public Guid ProviderId { get; set; } /// /// Gets or sets the last refreshed. /// diff --git a/MediaBrowser.Providers/FolderProviderFromXml.cs b/MediaBrowser.Providers/FolderProviderFromXml.cs index 253ff6785c..31e4bc8bcf 100644 --- a/MediaBrowser.Providers/FolderProviderFromXml.cs +++ b/MediaBrowser.Providers/FolderProviderFromXml.cs @@ -61,20 +61,10 @@ namespace MediaBrowser.Providers /// /// The item. /// if set to true [force]. + /// The provider information. /// The cancellation token. /// Task{System.Boolean}. - public override Task FetchAsync(BaseItem item, bool force, CancellationToken cancellationToken) - { - return Fetch(item, cancellationToken); - } - - /// - /// Fetches the specified item. - /// - /// The item. - /// The cancellation token. - /// true if XXXX, false otherwise - private async Task Fetch(BaseItem item, CancellationToken cancellationToken) + public override async Task FetchAsync(BaseItem item, bool force, BaseProviderInfo providerInfo, CancellationToken cancellationToken) { cancellationToken.ThrowIfCancellationRequested(); @@ -94,12 +84,10 @@ namespace MediaBrowser.Providers { XmlParsingResourcePool.Release(); } - - SetLastRefreshed(item, DateTime.UtcNow); - return true; } - return false; + SetLastRefreshed(item, DateTime.UtcNow, providerInfo); + return true; } } } diff --git a/MediaBrowser.Providers/Games/GameProviderFromXml.cs b/MediaBrowser.Providers/Games/GameProviderFromXml.cs index dcde7df498..ab1f96a8e4 100644 --- a/MediaBrowser.Providers/Games/GameProviderFromXml.cs +++ b/MediaBrowser.Providers/Games/GameProviderFromXml.cs @@ -57,19 +57,9 @@ namespace MediaBrowser.Providers.Games /// /// /// - public override Task FetchAsync(BaseItem item, bool force, CancellationToken cancellationToken) - { - return Fetch((Game)item, cancellationToken); - } - - /// - /// - /// - /// - /// - /// - private async Task Fetch(Game game, CancellationToken cancellationToken) + public override async Task FetchAsync(BaseItem item, bool force, BaseProviderInfo providerInfo, CancellationToken cancellationToken) { + var game = (Game)item; cancellationToken.ThrowIfCancellationRequested(); var metaFile = GameXmlSaver.GetGameSavePath(game); @@ -88,7 +78,7 @@ namespace MediaBrowser.Providers.Games } } - SetLastRefreshed(game, DateTime.UtcNow); + SetLastRefreshed(game, DateTime.UtcNow, providerInfo); return true; } diff --git a/MediaBrowser.Providers/Games/GameSystemProviderFromXml.cs b/MediaBrowser.Providers/Games/GameSystemProviderFromXml.cs index 12ae4b75b2..58143ce3db 100644 --- a/MediaBrowser.Providers/Games/GameSystemProviderFromXml.cs +++ b/MediaBrowser.Providers/Games/GameSystemProviderFromXml.cs @@ -60,18 +60,7 @@ namespace MediaBrowser.Providers.Games /// if set to true [force]. /// The cancellation token. /// Task{System.Boolean}. - public override Task FetchAsync(BaseItem item, bool force, CancellationToken cancellationToken) - { - return Fetch(item, cancellationToken); - } - - /// - /// Fetches the specified item. - /// - /// The item. - /// The cancellation token. - /// true if XXXX, false otherwise - private async Task Fetch(BaseItem item, CancellationToken cancellationToken) + public override async Task FetchAsync(BaseItem item, bool force, BaseProviderInfo providerInfo, CancellationToken cancellationToken) { cancellationToken.ThrowIfCancellationRequested(); @@ -92,7 +81,7 @@ namespace MediaBrowser.Providers.Games XmlParsingResourcePool.Release(); } - SetLastRefreshed(item, DateTime.UtcNow); + SetLastRefreshed(item, DateTime.UtcNow, providerInfo); return true; } diff --git a/MediaBrowser.Providers/ImageFromMediaLocationProvider.cs b/MediaBrowser.Providers/ImageFromMediaLocationProvider.cs index 3914ba2647..08e62afc51 100644 --- a/MediaBrowser.Providers/ImageFromMediaLocationProvider.cs +++ b/MediaBrowser.Providers/ImageFromMediaLocationProvider.cs @@ -97,7 +97,7 @@ namespace MediaBrowser.Providers /// if set to true [force]. /// The cancellation token. /// Task{System.Boolean}. - public override Task FetchAsync(BaseItem item, bool force, CancellationToken cancellationToken) + public override Task FetchAsync(BaseItem item, bool force, BaseProviderInfo providerInfo, CancellationToken cancellationToken) { cancellationToken.ThrowIfCancellationRequested(); @@ -121,7 +121,7 @@ namespace MediaBrowser.Providers PopulateBaseItemImages(item, args); - SetLastRefreshed(item, DateTime.UtcNow); + SetLastRefreshed(item, DateTime.UtcNow, providerInfo); return TrueTaskResult; } diff --git a/MediaBrowser.Providers/LiveTv/ChannelProviderFromXml.cs b/MediaBrowser.Providers/LiveTv/ChannelProviderFromXml.cs index 73564fa2b2..b0bc1b875d 100644 --- a/MediaBrowser.Providers/LiveTv/ChannelProviderFromXml.cs +++ b/MediaBrowser.Providers/LiveTv/ChannelProviderFromXml.cs @@ -60,18 +60,7 @@ namespace MediaBrowser.Providers.LiveTv /// if set to true [force]. /// The cancellation token. /// Task{System.Boolean}. - public override Task FetchAsync(BaseItem item, bool force, CancellationToken cancellationToken) - { - return Fetch(item, cancellationToken); - } - - /// - /// Fetches the specified item. - /// - /// The item. - /// The cancellation token. - /// true if XXXX, false otherwise - private async Task Fetch(BaseItem item, CancellationToken cancellationToken) + public override async Task FetchAsync(BaseItem item, bool force, BaseProviderInfo providerInfo, CancellationToken cancellationToken) { cancellationToken.ThrowIfCancellationRequested(); @@ -92,7 +81,7 @@ namespace MediaBrowser.Providers.LiveTv XmlParsingResourcePool.Release(); } - SetLastRefreshed(item, DateTime.UtcNow); + SetLastRefreshed(item, DateTime.UtcNow, providerInfo); return true; } diff --git a/MediaBrowser.Providers/MediaInfo/AudioImageProvider.cs b/MediaBrowser.Providers/MediaInfo/AudioImageProvider.cs index 914f5b290c..264b24b87f 100644 --- a/MediaBrowser.Providers/MediaInfo/AudioImageProvider.cs +++ b/MediaBrowser.Providers/MediaInfo/AudioImageProvider.cs @@ -121,7 +121,7 @@ namespace MediaBrowser.Providers.MediaInfo /// if set to true [force]. /// The cancellation token. /// Task{System.Boolean}. - public override async Task FetchAsync(BaseItem item, bool force, CancellationToken cancellationToken) + public override async Task FetchAsync(BaseItem item, bool force, BaseProviderInfo providerInfo, CancellationToken cancellationToken) { item.ValidateImages(); @@ -139,7 +139,7 @@ namespace MediaBrowser.Providers.MediaInfo } } - SetLastRefreshed(item, DateTime.UtcNow); + SetLastRefreshed(item, DateTime.UtcNow, providerInfo); return true; } diff --git a/MediaBrowser.Providers/MediaInfo/FFProbeAudioInfoProvider.cs b/MediaBrowser.Providers/MediaInfo/FFProbeAudioInfoProvider.cs index 42ba2d7b0c..673abea570 100644 --- a/MediaBrowser.Providers/MediaInfo/FFProbeAudioInfoProvider.cs +++ b/MediaBrowser.Providers/MediaInfo/FFProbeAudioInfoProvider.cs @@ -4,6 +4,7 @@ using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Entities.Audio; using MediaBrowser.Controller.Persistence; +using MediaBrowser.Controller.Providers; using MediaBrowser.Model.Entities; using MediaBrowser.Model.Logging; using MediaBrowser.Model.Serialization; @@ -28,7 +29,7 @@ namespace MediaBrowser.Providers.MediaInfo _itemRepo = itemRepo; } - public override async Task FetchAsync(BaseItem item, bool force, CancellationToken cancellationToken) + public override async Task FetchAsync(BaseItem item, bool force, BaseProviderInfo providerInfo, CancellationToken cancellationToken) { var myItem = (Audio)item; @@ -44,7 +45,7 @@ namespace MediaBrowser.Providers.MediaInfo await Fetch(myItem, cancellationToken, result).ConfigureAwait(false); - SetLastRefreshed(item, DateTime.UtcNow); + SetLastRefreshed(item, DateTime.UtcNow, providerInfo); return true; } diff --git a/MediaBrowser.Providers/MediaInfo/FFProbeVideoInfoProvider.cs b/MediaBrowser.Providers/MediaInfo/FFProbeVideoInfoProvider.cs index c09076bff4..7e3e3da3b5 100644 --- a/MediaBrowser.Providers/MediaInfo/FFProbeVideoInfoProvider.cs +++ b/MediaBrowser.Providers/MediaInfo/FFProbeVideoInfoProvider.cs @@ -138,7 +138,7 @@ namespace MediaBrowser.Providers.MediaInfo base.OnPreFetch(item, mount); } - public override async Task FetchAsync(BaseItem item, bool force, CancellationToken cancellationToken) + public override async Task FetchAsync(BaseItem item, bool force, BaseProviderInfo providerInfo, CancellationToken cancellationToken) { var video = (Video)item; @@ -154,7 +154,7 @@ namespace MediaBrowser.Providers.MediaInfo if (video.PlayableStreamFileNames.Count == 0) { Logger.Error("No playable vobs found in dvd structure, skipping ffprobe."); - SetLastRefreshed(item, DateTime.UtcNow); + SetLastRefreshed(item, DateTime.UtcNow, providerInfo); return true; } } @@ -167,7 +167,7 @@ namespace MediaBrowser.Providers.MediaInfo cancellationToken.ThrowIfCancellationRequested(); - await Fetch(video, force, cancellationToken, result, isoMount).ConfigureAwait(false); + await Fetch(video, force, providerInfo, cancellationToken, result, isoMount).ConfigureAwait(false); } finally @@ -178,7 +178,7 @@ namespace MediaBrowser.Providers.MediaInfo } } - SetLastRefreshed(item, DateTime.UtcNow); + SetLastRefreshed(item, DateTime.UtcNow, providerInfo); return true; } @@ -291,7 +291,7 @@ namespace MediaBrowser.Providers.MediaInfo /// The data. /// The iso mount. /// Task. - protected async Task Fetch(Video video, bool force, CancellationToken cancellationToken, MediaInfoResult data, IIsoMount isoMount) + protected async Task Fetch(Video video, bool force, BaseProviderInfo providerInfo, CancellationToken cancellationToken, MediaInfoResult data, IIsoMount isoMount) { if (data.format != null) { @@ -345,13 +345,7 @@ namespace MediaBrowser.Providers.MediaInfo await Kernel.Instance.FFMpegManager.PopulateChapterImages(video, chapters, false, false, cancellationToken).ConfigureAwait(false); - BaseProviderInfo providerInfo; - var videoFileChanged = false; - - if (video.ProviderData.TryGetValue(Id, out providerInfo)) - { - videoFileChanged = CompareDate(video) > providerInfo.LastRefreshed; - } + var videoFileChanged = CompareDate(video) > providerInfo.LastRefreshed; await _itemRepo.SaveMediaStreams(video.Id, mediaStreams, cancellationToken).ConfigureAwait(false); diff --git a/MediaBrowser.Providers/MediaInfo/VideoImageProvider.cs b/MediaBrowser.Providers/MediaInfo/VideoImageProvider.cs index 551f9d8f2d..2864983cef 100644 --- a/MediaBrowser.Providers/MediaInfo/VideoImageProvider.cs +++ b/MediaBrowser.Providers/MediaInfo/VideoImageProvider.cs @@ -171,7 +171,7 @@ namespace MediaBrowser.Providers.MediaInfo /// if set to true [force]. /// The cancellation token. /// Task{System.Boolean}. - public override async Task FetchAsync(BaseItem item, bool force, CancellationToken cancellationToken) + public override async Task FetchAsync(BaseItem item, bool force, BaseProviderInfo providerInfo, CancellationToken cancellationToken) { item.ValidateImages(); @@ -192,7 +192,7 @@ namespace MediaBrowser.Providers.MediaInfo } } - SetLastRefreshed(item, DateTime.UtcNow); + SetLastRefreshed(item, DateTime.UtcNow, providerInfo); return true; } diff --git a/MediaBrowser.Providers/Movies/BoxSetProviderFromXml.cs b/MediaBrowser.Providers/Movies/BoxSetProviderFromXml.cs index 43c0bd680f..7c88243b3a 100644 --- a/MediaBrowser.Providers/Movies/BoxSetProviderFromXml.cs +++ b/MediaBrowser.Providers/Movies/BoxSetProviderFromXml.cs @@ -65,18 +65,7 @@ namespace MediaBrowser.Providers.Movies /// if set to true [force]. /// The cancellation token. /// Task{System.Boolean}. - public override Task FetchAsync(BaseItem item, bool force, CancellationToken cancellationToken) - { - return Fetch(item, cancellationToken); - } - - /// - /// Fetches the specified item. - /// - /// The item. - /// The cancellation token. - /// true if XXXX, false otherwise - private async Task Fetch(BaseItem item, CancellationToken cancellationToken) + public override async Task FetchAsync(BaseItem item, bool force, BaseProviderInfo providerInfo, CancellationToken cancellationToken) { cancellationToken.ThrowIfCancellationRequested(); @@ -97,7 +86,7 @@ namespace MediaBrowser.Providers.Movies XmlParsingResourcePool.Release(); } - SetLastRefreshed(item, DateTime.UtcNow); + SetLastRefreshed(item, DateTime.UtcNow, providerInfo); return true; } diff --git a/MediaBrowser.Providers/Movies/FanArtMovieProvider.cs b/MediaBrowser.Providers/Movies/FanArtMovieProvider.cs index be195d6d2e..e483b1d61e 100644 --- a/MediaBrowser.Providers/Movies/FanArtMovieProvider.cs +++ b/MediaBrowser.Providers/Movies/FanArtMovieProvider.cs @@ -187,7 +187,7 @@ namespace MediaBrowser.Providers.Movies /// if set to true [force]. /// The cancellation token. /// Task{System.Boolean}. - public override async Task FetchAsync(BaseItem item, bool force, CancellationToken cancellationToken) + public override async Task FetchAsync(BaseItem item, bool force, BaseProviderInfo providerInfo, CancellationToken cancellationToken) { cancellationToken.ThrowIfCancellationRequested(); @@ -208,7 +208,7 @@ namespace MediaBrowser.Providers.Movies await FetchImages(item, images.ToList(), cancellationToken).ConfigureAwait(false); } - SetLastRefreshed(item, DateTime.UtcNow); + SetLastRefreshed(item, DateTime.UtcNow, providerInfo); return true; } diff --git a/MediaBrowser.Providers/Movies/MovieDbImagesProvider.cs b/MediaBrowser.Providers/Movies/MovieDbImagesProvider.cs index d2a12ac213..d63fcec5c0 100644 --- a/MediaBrowser.Providers/Movies/MovieDbImagesProvider.cs +++ b/MediaBrowser.Providers/Movies/MovieDbImagesProvider.cs @@ -164,13 +164,13 @@ namespace MediaBrowser.Providers.Movies /// if set to true [force]. /// The cancellation token /// Task{System.Boolean}. - public override async Task FetchAsync(BaseItem item, bool force, CancellationToken cancellationToken) + public override async Task FetchAsync(BaseItem item, bool force, BaseProviderInfo providerInfo, CancellationToken cancellationToken) { var images = await _providerManager.GetAvailableRemoteImages(item, cancellationToken, ManualMovieDbImageProvider.ProviderName).ConfigureAwait(false); await ProcessImages(item, images.ToList(), cancellationToken).ConfigureAwait(false); - SetLastRefreshed(item, DateTime.UtcNow); + SetLastRefreshed(item, DateTime.UtcNow, providerInfo); return true; } diff --git a/MediaBrowser.Providers/Movies/MovieDbPersonImageProvider.cs b/MediaBrowser.Providers/Movies/MovieDbPersonImageProvider.cs index 43550c3581..8fa2ea2499 100644 --- a/MediaBrowser.Providers/Movies/MovieDbPersonImageProvider.cs +++ b/MediaBrowser.Providers/Movies/MovieDbPersonImageProvider.cs @@ -161,13 +161,13 @@ namespace MediaBrowser.Providers.Movies /// if set to true [force]. /// The cancellation token /// Task{System.Boolean}. - public override async Task FetchAsync(BaseItem item, bool force, CancellationToken cancellationToken) + public override async Task FetchAsync(BaseItem item, bool force, BaseProviderInfo providerInfo, CancellationToken cancellationToken) { var images = await _providerManager.GetAvailableRemoteImages(item, cancellationToken, ManualMovieDbPersonImageProvider.ProviderName).ConfigureAwait(false); await ProcessImages(item, images.ToList(), cancellationToken).ConfigureAwait(false); - SetLastRefreshed(item, DateTime.UtcNow); + SetLastRefreshed(item, DateTime.UtcNow, providerInfo); return true; } diff --git a/MediaBrowser.Providers/Movies/MovieDbPersonProvider.cs b/MediaBrowser.Providers/Movies/MovieDbPersonProvider.cs index af9bef4482..3efd8d7fe1 100644 --- a/MediaBrowser.Providers/Movies/MovieDbPersonProvider.cs +++ b/MediaBrowser.Providers/Movies/MovieDbPersonProvider.cs @@ -91,7 +91,7 @@ namespace MediaBrowser.Providers.Movies return base.NeedsRefreshInternal(item, providerInfo); } - + protected override bool NeedsRefreshBasedOnCompareDate(BaseItem item, BaseProviderInfo providerInfo) { var provderId = item.GetProviderId(MetadataProviders.Tmdb); @@ -152,7 +152,7 @@ namespace MediaBrowser.Providers.Movies /// if set to true [force]. /// The cancellation token. /// Task{System.Boolean}. - public override async Task FetchAsync(BaseItem item, bool force, CancellationToken cancellationToken) + public override async Task FetchAsync(BaseItem item, bool force, BaseProviderInfo providerInfo, CancellationToken cancellationToken) { cancellationToken.ThrowIfCancellationRequested(); @@ -173,7 +173,7 @@ namespace MediaBrowser.Providers.Movies await FetchInfo(person, id, force, cancellationToken).ConfigureAwait(false); } - SetLastRefreshed(item, DateTime.UtcNow); + SetLastRefreshed(item, DateTime.UtcNow, providerInfo); return true; } diff --git a/MediaBrowser.Providers/Movies/MovieDbProvider.cs b/MediaBrowser.Providers/Movies/MovieDbProvider.cs index fb75a94993..ecf5a59510 100644 --- a/MediaBrowser.Providers/Movies/MovieDbProvider.cs +++ b/MediaBrowser.Providers/Movies/MovieDbProvider.cs @@ -252,7 +252,7 @@ namespace MediaBrowser.Providers.Movies /// if set to true [force]. /// The cancellation token /// Task{System.Boolean}. - public override async Task FetchAsync(BaseItem item, bool force, CancellationToken cancellationToken) + public override async Task FetchAsync(BaseItem item, bool force, BaseProviderInfo providerInfo, CancellationToken cancellationToken) { cancellationToken.ThrowIfCancellationRequested(); @@ -275,7 +275,7 @@ namespace MediaBrowser.Providers.Movies await FetchMovieData(item, id, force, cancellationToken).ConfigureAwait(false); } - SetLastRefreshed(item, DateTime.UtcNow); + SetLastRefreshed(item, DateTime.UtcNow, providerInfo); return true; } diff --git a/MediaBrowser.Providers/Movies/MovieProviderFromXml.cs b/MediaBrowser.Providers/Movies/MovieProviderFromXml.cs index ff6339034e..bb1299f67d 100644 --- a/MediaBrowser.Providers/Movies/MovieProviderFromXml.cs +++ b/MediaBrowser.Providers/Movies/MovieProviderFromXml.cs @@ -81,18 +81,7 @@ namespace MediaBrowser.Providers.Movies /// if set to true [force]. /// The cancellation token. /// Task{System.Boolean}. - public override Task FetchAsync(BaseItem item, bool force, CancellationToken cancellationToken) - { - return Fetch(item, cancellationToken); - } - - /// - /// Fetches the specified item. - /// - /// The item. - /// The cancellation token. - /// true if XXXX, false otherwise - private async Task Fetch(BaseItem item, CancellationToken cancellationToken) + public override async Task FetchAsync(BaseItem item, bool force, BaseProviderInfo providerInfo, CancellationToken cancellationToken) { cancellationToken.ThrowIfCancellationRequested(); @@ -114,7 +103,7 @@ namespace MediaBrowser.Providers.Movies } } - SetLastRefreshed(item, DateTime.UtcNow); + SetLastRefreshed(item, DateTime.UtcNow, providerInfo); return true; } diff --git a/MediaBrowser.Providers/Movies/OpenMovieDatabaseProvider.cs b/MediaBrowser.Providers/Movies/OpenMovieDatabaseProvider.cs index d881859c6e..379b7c62ca 100644 --- a/MediaBrowser.Providers/Movies/OpenMovieDatabaseProvider.cs +++ b/MediaBrowser.Providers/Movies/OpenMovieDatabaseProvider.cs @@ -107,13 +107,13 @@ namespace MediaBrowser.Providers.Movies protected readonly CultureInfo UsCulture = new CultureInfo("en-US"); - public override async Task FetchAsync(BaseItem item, bool force, CancellationToken cancellationToken) + public override async Task FetchAsync(BaseItem item, bool force, BaseProviderInfo providerInfo, CancellationToken cancellationToken) { var imdbId = item.GetProviderId(MetadataProviders.Imdb); if (string.IsNullOrEmpty(imdbId)) { - SetLastRefreshed(item, DateTime.UtcNow); + SetLastRefreshed(item, DateTime.UtcNow, providerInfo); return true; } @@ -174,7 +174,7 @@ namespace MediaBrowser.Providers.Movies ParseAdditionalMetadata(item, result); } - SetLastRefreshed(item, DateTime.UtcNow); + SetLastRefreshed(item, DateTime.UtcNow, providerInfo); return true; } diff --git a/MediaBrowser.Providers/Movies/PersonProviderFromXml.cs b/MediaBrowser.Providers/Movies/PersonProviderFromXml.cs index 1422fffa90..60722f980c 100644 --- a/MediaBrowser.Providers/Movies/PersonProviderFromXml.cs +++ b/MediaBrowser.Providers/Movies/PersonProviderFromXml.cs @@ -59,18 +59,7 @@ namespace MediaBrowser.Providers.Movies /// if set to true [force]. /// The cancellation token. /// Task{System.Boolean}. - public override Task FetchAsync(BaseItem item, bool force, CancellationToken cancellationToken) - { - return Fetch(item, cancellationToken); - } - - /// - /// Fetches the specified item. - /// - /// The item. - /// The cancellation token. - /// true if XXXX, false otherwise - private async Task Fetch(BaseItem item, CancellationToken cancellationToken) + public override async Task FetchAsync(BaseItem item, bool force, BaseProviderInfo providerInfo, CancellationToken cancellationToken) { cancellationToken.ThrowIfCancellationRequested(); @@ -91,7 +80,7 @@ namespace MediaBrowser.Providers.Movies XmlParsingResourcePool.Release(); } - SetLastRefreshed(item, DateTime.UtcNow); + SetLastRefreshed(item, DateTime.UtcNow, providerInfo); return true; } diff --git a/MediaBrowser.Providers/Music/AlbumInfoFromSongProvider.cs b/MediaBrowser.Providers/Music/AlbumInfoFromSongProvider.cs index da49d36ed6..c4b4af97ff 100644 --- a/MediaBrowser.Providers/Music/AlbumInfoFromSongProvider.cs +++ b/MediaBrowser.Providers/Music/AlbumInfoFromSongProvider.cs @@ -84,17 +84,10 @@ namespace MediaBrowser.Providers.Music return string.Join(string.Empty, albumArtistNames.OrderBy(i => i).ToArray()).GetMD5(); } - public override Task FetchAsync(BaseItem item, bool force, CancellationToken cancellationToken) + public override Task FetchAsync(BaseItem item, bool force, BaseProviderInfo providerInfo, CancellationToken cancellationToken) { var album = (MusicAlbum)item; - BaseProviderInfo data; - if (!item.ProviderData.TryGetValue(Id, out data)) - { - data = new BaseProviderInfo(); - item.ProviderData[Id] = data; - } - var songs = album.RecursiveChildren.OfType