From 6b26d852bedbb3fac0a4526272806a07a5e17843 Mon Sep 17 00:00:00 2001 From: softworkz Date: Sat, 21 May 2016 01:22:10 +0200 Subject: [PATCH 01/20] Micro-fixes for logging instance creating exceptions --- MediaBrowser.Common.Implementations/BaseApplicationHost.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/MediaBrowser.Common.Implementations/BaseApplicationHost.cs b/MediaBrowser.Common.Implementations/BaseApplicationHost.cs index f44c975d41..a76ab9f07e 100644 --- a/MediaBrowser.Common.Implementations/BaseApplicationHost.cs +++ b/MediaBrowser.Common.Implementations/BaseApplicationHost.cs @@ -552,7 +552,7 @@ namespace MediaBrowser.Common.Implementations } catch (Exception ex) { - Logger.Error("Error creating {0}", ex, type.Name); + Logger.ErrorException("Error creating {0}", ex, type.Name); throw; } @@ -571,7 +571,7 @@ namespace MediaBrowser.Common.Implementations } catch (Exception ex) { - Logger.Error("Error creating {0}", ex, type.Name); + Logger.ErrorException("Error creating {0}", ex, type.Name); // Don't blow up in release mode return null; } From 75fcbd310e2103d494000c82746068691c4907c2 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Sat, 21 May 2016 00:52:54 -0400 Subject: [PATCH 02/20] restore version --- SharedVersion.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/SharedVersion.cs b/SharedVersion.cs index 375a554728..cf976f91fa 100644 --- a/SharedVersion.cs +++ b/SharedVersion.cs @@ -1,4 +1,4 @@ using System.Reflection; -//[assembly: AssemblyVersion("3.0.*")] -[assembly: AssemblyVersion("3.0.5960")] +[assembly: AssemblyVersion("3.0.*")] +//[assembly: AssemblyVersion("3.0.5960")] From 15f0832a042ef77bee549958fcf130986af9f430 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Sat, 21 May 2016 02:12:00 -0400 Subject: [PATCH 03/20] deprecate refreshinfo db --- MediaBrowser.Api/StartupWizardService.cs | 2 - .../MediaBrowser.Controller.csproj | 2 - .../Providers/IProviderRepository.cs | 25 -- .../Providers/MetadataStatus.cs | 49 ---- .../Configuration/ServerConfiguration.cs | 9 - .../Books/BookMetadataService.cs | 8 +- .../BoxSets/BoxSetMetadataService.cs | 8 +- .../Channels/ChannelMetadataService.cs | 6 +- .../CollectionFolderMetadataService.cs | 7 +- .../Folders/FolderMetadataService.cs | 8 +- .../Folders/UserViewMetadataService.cs | 6 +- .../GameGenres/GameGenreMetadataService.cs | 6 +- .../Games/GameMetadataService.cs | 8 +- .../Games/GameSystemMetadataService.cs | 8 +- .../Genres/GenreMetadataService.cs | 6 +- .../LiveTv/AudioRecordingService.cs | 6 +- .../LiveTv/ChannelMetadataService.cs | 6 +- .../LiveTv/ProgramMetadataService.cs | 6 +- .../LiveTv/VideoRecordingService.cs | 6 +- .../Manager/MetadataService.cs | 148 +---------- .../Movies/MovieMetadataService.cs | 17 +- .../Music/AlbumMetadataService.cs | 8 +- .../Music/ArtistMetadataService.cs | 8 +- .../Music/AudioMetadataService.cs | 8 +- .../Music/MusicVideoMetadataService.cs | 8 +- .../MusicGenres/MusicGenreMetadataService.cs | 6 +- .../People/PersonMetadataService.cs | 8 +- .../Photos/PhotoAlbumMetadataService.cs | 6 +- .../Photos/PhotoMetadataService.cs | 6 +- .../Playlists/PlaylistMetadataService.cs | 8 +- .../Studios/StudioMetadataService.cs | 6 +- .../TV/EpisodeMetadataService.cs | 8 +- .../TV/SeasonMetadataService.cs | 8 +- .../TV/SeriesMetadataService.cs | 2 +- .../Users/UserMetadataService.cs | 6 +- .../Videos/VideoMetadataService.cs | 8 +- .../Years/YearMetadataService.cs | 6 +- .../Library/LibraryManager.cs | 2 +- ...MediaBrowser.Server.Implementations.csproj | 1 - .../Persistence/SqliteItemRepository.cs | 44 ---- .../SqliteProviderInfoRepository.cs | 248 ------------------ .../ApplicationHost.cs | 6 - 42 files changed, 120 insertions(+), 638 deletions(-) delete mode 100644 MediaBrowser.Controller/Providers/IProviderRepository.cs delete mode 100644 MediaBrowser.Controller/Providers/MetadataStatus.cs delete mode 100644 MediaBrowser.Server.Implementations/Persistence/SqliteProviderInfoRepository.cs diff --git a/MediaBrowser.Api/StartupWizardService.cs b/MediaBrowser.Api/StartupWizardService.cs index 28265c72f9..02aa85efad 100644 --- a/MediaBrowser.Api/StartupWizardService.cs +++ b/MediaBrowser.Api/StartupWizardService.cs @@ -109,9 +109,7 @@ namespace MediaBrowser.Api private void SetWizardFinishValues(ServerConfiguration config) { - config.EnableLocalizedGuids = true; config.EnableCustomPathSubFolders = true; - config.EnableDateLastRefresh = true; config.EnableStandaloneMusicKeys = true; config.EnableCaseSensitiveItemIds = true; } diff --git a/MediaBrowser.Controller/MediaBrowser.Controller.csproj b/MediaBrowser.Controller/MediaBrowser.Controller.csproj index bc28ec0155..57855008d5 100644 --- a/MediaBrowser.Controller/MediaBrowser.Controller.csproj +++ b/MediaBrowser.Controller/MediaBrowser.Controller.csproj @@ -297,7 +297,6 @@ - @@ -334,7 +333,6 @@ - diff --git a/MediaBrowser.Controller/Providers/IProviderRepository.cs b/MediaBrowser.Controller/Providers/IProviderRepository.cs deleted file mode 100644 index 891275d775..0000000000 --- a/MediaBrowser.Controller/Providers/IProviderRepository.cs +++ /dev/null @@ -1,25 +0,0 @@ -using MediaBrowser.Controller.Persistence; -using System; -using System.Threading; -using System.Threading.Tasks; - -namespace MediaBrowser.Controller.Providers -{ - public interface IProviderRepository : IRepository - { - /// - /// Gets the metadata status. - /// - /// The item identifier. - /// MetadataStatus. - MetadataStatus GetMetadataStatus(Guid itemId); - - /// - /// Saves the metadata status. - /// - /// The status. - /// The cancellation token. - /// Task. - Task SaveMetadataStatus(MetadataStatus status, CancellationToken cancellationToken); - } -} diff --git a/MediaBrowser.Controller/Providers/MetadataStatus.cs b/MediaBrowser.Controller/Providers/MetadataStatus.cs deleted file mode 100644 index b19377a680..0000000000 --- a/MediaBrowser.Controller/Providers/MetadataStatus.cs +++ /dev/null @@ -1,49 +0,0 @@ -using System; - -namespace MediaBrowser.Controller.Providers -{ - public class MetadataStatus - { - /// - /// Gets or sets the item identifier. - /// - /// The item identifier. - public Guid ItemId { get; set; } - - /// - /// Gets or sets the date last metadata refresh. - /// - /// The date last metadata refresh. - public DateTime? DateLastMetadataRefresh { get; set; } - - /// - /// Gets or sets the date last images refresh. - /// - /// The date last images refresh. - public DateTime? DateLastImagesRefresh { get; set; } - - public DateTime? ItemDateModified { get; set; } - - public bool IsDirty { get; private set; } - - public void SetDateLastMetadataRefresh(DateTime? date) - { - if (date != DateLastMetadataRefresh) - { - IsDirty = true; - } - - DateLastMetadataRefresh = date; - } - - public void SetDateLastImagesRefresh(DateTime? date) - { - if (date != DateLastImagesRefresh) - { - IsDirty = true; - } - - DateLastImagesRefresh = date; - } - } -} diff --git a/MediaBrowser.Model/Configuration/ServerConfiguration.cs b/MediaBrowser.Model/Configuration/ServerConfiguration.cs index 1cb19afdf2..bbf21a9d75 100644 --- a/MediaBrowser.Model/Configuration/ServerConfiguration.cs +++ b/MediaBrowser.Model/Configuration/ServerConfiguration.cs @@ -86,12 +86,6 @@ namespace MediaBrowser.Model.Configuration /// true if [save local meta]; otherwise, false. public bool SaveLocalMeta { get; set; } - /// - /// Gets or sets a value indicating whether [enable localized guids]. - /// - /// true if [enable localized guids]; otherwise, false. - public bool EnableLocalizedGuids { get; set; } - /// /// Gets or sets the preferred metadata language. /// @@ -196,8 +190,6 @@ namespace MediaBrowser.Model.Configuration public int SharingExpirationDays { get; set; } - public bool EnableDateLastRefresh { get; set; } - public string[] Migrations { get; set; } public int MigrationVersion { get; set; } @@ -215,7 +207,6 @@ namespace MediaBrowser.Model.Configuration { Migrations = new string[] { }; - EnableLocalizedGuids = true; EnableCustomPathSubFolders = true; ImageSavingConvention = ImageSavingConvention.Compatible; diff --git a/MediaBrowser.Providers/Books/BookMetadataService.cs b/MediaBrowser.Providers/Books/BookMetadataService.cs index eb3335c9ab..6f4a744c29 100644 --- a/MediaBrowser.Providers/Books/BookMetadataService.cs +++ b/MediaBrowser.Providers/Books/BookMetadataService.cs @@ -12,10 +12,6 @@ namespace MediaBrowser.Providers.Books { public class BookMetadataService : MetadataService { - public BookMetadataService(IServerConfigurationManager serverConfigurationManager, ILogger logger, IProviderManager providerManager, IProviderRepository providerRepo, IFileSystem fileSystem, IUserDataManager userDataManager, ILibraryManager libraryManager) : base(serverConfigurationManager, logger, providerManager, providerRepo, fileSystem, userDataManager, libraryManager) - { - } - protected override void MergeData(MetadataResult source, MetadataResult target, List lockedFields, bool replaceData, bool mergeMetadataSettings) { ProviderUtils.MergeBaseItemData(source, target, lockedFields, replaceData, mergeMetadataSettings); @@ -25,5 +21,9 @@ namespace MediaBrowser.Providers.Books target.Item.SeriesName = source.Item.SeriesName; } } + + public BookMetadataService(IServerConfigurationManager serverConfigurationManager, ILogger logger, IProviderManager providerManager, IFileSystem fileSystem, IUserDataManager userDataManager, ILibraryManager libraryManager) : base(serverConfigurationManager, logger, providerManager, fileSystem, userDataManager, libraryManager) + { + } } } diff --git a/MediaBrowser.Providers/BoxSets/BoxSetMetadataService.cs b/MediaBrowser.Providers/BoxSets/BoxSetMetadataService.cs index 9a24887812..2dacb16ca1 100644 --- a/MediaBrowser.Providers/BoxSets/BoxSetMetadataService.cs +++ b/MediaBrowser.Providers/BoxSets/BoxSetMetadataService.cs @@ -15,10 +15,6 @@ namespace MediaBrowser.Providers.BoxSets { public class BoxSetMetadataService : MetadataService { - public BoxSetMetadataService(IServerConfigurationManager serverConfigurationManager, ILogger logger, IProviderManager providerManager, IProviderRepository providerRepo, IFileSystem fileSystem, IUserDataManager userDataManager, ILibraryManager libraryManager) : base(serverConfigurationManager, logger, providerManager, providerRepo, fileSystem, userDataManager, libraryManager) - { - } - protected override async Task BeforeSave(BoxSet item, bool isFullRefresh, ItemUpdateType currentUpdateType) { var updateType = await base.BeforeSave(item, isFullRefresh, currentUpdateType).ConfigureAwait(false); @@ -54,5 +50,9 @@ namespace MediaBrowser.Providers.BoxSets targetItem.Shares = sourceItem.Shares; } } + + public BoxSetMetadataService(IServerConfigurationManager serverConfigurationManager, ILogger logger, IProviderManager providerManager, IFileSystem fileSystem, IUserDataManager userDataManager, ILibraryManager libraryManager) : base(serverConfigurationManager, logger, providerManager, fileSystem, userDataManager, libraryManager) + { + } } } diff --git a/MediaBrowser.Providers/Channels/ChannelMetadataService.cs b/MediaBrowser.Providers/Channels/ChannelMetadataService.cs index 3a1d2374c8..22e196d72c 100644 --- a/MediaBrowser.Providers/Channels/ChannelMetadataService.cs +++ b/MediaBrowser.Providers/Channels/ChannelMetadataService.cs @@ -12,13 +12,13 @@ namespace MediaBrowser.Providers.Channels { public class ChannelMetadataService : MetadataService { - public ChannelMetadataService(IServerConfigurationManager serverConfigurationManager, ILogger logger, IProviderManager providerManager, IProviderRepository providerRepo, IFileSystem fileSystem, IUserDataManager userDataManager, ILibraryManager libraryManager) : base(serverConfigurationManager, logger, providerManager, providerRepo, fileSystem, userDataManager, libraryManager) + protected override void MergeData(MetadataResult source, MetadataResult target, List lockedFields, bool replaceData, bool mergeMetadataSettings) { + ProviderUtils.MergeBaseItemData(source, target, lockedFields, replaceData, mergeMetadataSettings); } - protected override void MergeData(MetadataResult source, MetadataResult target, List lockedFields, bool replaceData, bool mergeMetadataSettings) + public ChannelMetadataService(IServerConfigurationManager serverConfigurationManager, ILogger logger, IProviderManager providerManager, IFileSystem fileSystem, IUserDataManager userDataManager, ILibraryManager libraryManager) : base(serverConfigurationManager, logger, providerManager, fileSystem, userDataManager, libraryManager) { - ProviderUtils.MergeBaseItemData(source, target, lockedFields, replaceData, mergeMetadataSettings); } } } diff --git a/MediaBrowser.Providers/Folders/CollectionFolderMetadataService.cs b/MediaBrowser.Providers/Folders/CollectionFolderMetadataService.cs index e1de443de9..35c61b5c58 100644 --- a/MediaBrowser.Providers/Folders/CollectionFolderMetadataService.cs +++ b/MediaBrowser.Providers/Folders/CollectionFolderMetadataService.cs @@ -16,14 +16,13 @@ namespace MediaBrowser.Providers.Folders { public class CollectionFolderMetadataService : MetadataService { - public CollectionFolderMetadataService(IServerConfigurationManager serverConfigurationManager, ILogger logger, IProviderManager providerManager, IProviderRepository providerRepo, IFileSystem fileSystem, IUserDataManager userDataManager, ILibraryManager libraryManager) - : base(serverConfigurationManager, logger, providerManager, providerRepo, fileSystem, userDataManager, libraryManager) + protected override void MergeData(MetadataResult source, MetadataResult target, List lockedFields, bool replaceData, bool mergeMetadataSettings) { + ProviderUtils.MergeBaseItemData(source, target, lockedFields, replaceData, mergeMetadataSettings); } - protected override void MergeData(MetadataResult source, MetadataResult target, List lockedFields, bool replaceData, bool mergeMetadataSettings) + public CollectionFolderMetadataService(IServerConfigurationManager serverConfigurationManager, ILogger logger, IProviderManager providerManager, IFileSystem fileSystem, IUserDataManager userDataManager, ILibraryManager libraryManager) : base(serverConfigurationManager, logger, providerManager, fileSystem, userDataManager, libraryManager) { - ProviderUtils.MergeBaseItemData(source, target, lockedFields, replaceData, mergeMetadataSettings); } } } diff --git a/MediaBrowser.Providers/Folders/FolderMetadataService.cs b/MediaBrowser.Providers/Folders/FolderMetadataService.cs index e938297b76..8c4737fc4a 100644 --- a/MediaBrowser.Providers/Folders/FolderMetadataService.cs +++ b/MediaBrowser.Providers/Folders/FolderMetadataService.cs @@ -12,10 +12,6 @@ namespace MediaBrowser.Providers.Folders { public class FolderMetadataService : MetadataService { - public FolderMetadataService(IServerConfigurationManager serverConfigurationManager, ILogger logger, IProviderManager providerManager, IProviderRepository providerRepo, IFileSystem fileSystem, IUserDataManager userDataManager, ILibraryManager libraryManager) : base(serverConfigurationManager, logger, providerManager, providerRepo, fileSystem, userDataManager, libraryManager) - { - } - public override int Order { get @@ -29,5 +25,9 @@ namespace MediaBrowser.Providers.Folders { ProviderUtils.MergeBaseItemData(source, target, lockedFields, replaceData, mergeMetadataSettings); } + + public FolderMetadataService(IServerConfigurationManager serverConfigurationManager, ILogger logger, IProviderManager providerManager, IFileSystem fileSystem, IUserDataManager userDataManager, ILibraryManager libraryManager) : base(serverConfigurationManager, logger, providerManager, fileSystem, userDataManager, libraryManager) + { + } } } diff --git a/MediaBrowser.Providers/Folders/UserViewMetadataService.cs b/MediaBrowser.Providers/Folders/UserViewMetadataService.cs index 7c298a3ed4..b8f58307a4 100644 --- a/MediaBrowser.Providers/Folders/UserViewMetadataService.cs +++ b/MediaBrowser.Providers/Folders/UserViewMetadataService.cs @@ -12,13 +12,13 @@ namespace MediaBrowser.Providers.Folders { public class UserViewMetadataService : MetadataService { - public UserViewMetadataService(IServerConfigurationManager serverConfigurationManager, ILogger logger, IProviderManager providerManager, IProviderRepository providerRepo, IFileSystem fileSystem, IUserDataManager userDataManager, ILibraryManager libraryManager) : base(serverConfigurationManager, logger, providerManager, providerRepo, fileSystem, userDataManager, libraryManager) + protected override void MergeData(MetadataResult source, MetadataResult target, List lockedFields, bool replaceData, bool mergeMetadataSettings) { + ProviderUtils.MergeBaseItemData(source, target, lockedFields, replaceData, mergeMetadataSettings); } - protected override void MergeData(MetadataResult source, MetadataResult target, List lockedFields, bool replaceData, bool mergeMetadataSettings) + public UserViewMetadataService(IServerConfigurationManager serverConfigurationManager, ILogger logger, IProviderManager providerManager, IFileSystem fileSystem, IUserDataManager userDataManager, ILibraryManager libraryManager) : base(serverConfigurationManager, logger, providerManager, fileSystem, userDataManager, libraryManager) { - ProviderUtils.MergeBaseItemData(source, target, lockedFields, replaceData, mergeMetadataSettings); } } } diff --git a/MediaBrowser.Providers/GameGenres/GameGenreMetadataService.cs b/MediaBrowser.Providers/GameGenres/GameGenreMetadataService.cs index f80691d724..fb2244e327 100644 --- a/MediaBrowser.Providers/GameGenres/GameGenreMetadataService.cs +++ b/MediaBrowser.Providers/GameGenres/GameGenreMetadataService.cs @@ -12,13 +12,13 @@ namespace MediaBrowser.Providers.GameGenres { public class GameGenreMetadataService : MetadataService { - public GameGenreMetadataService(IServerConfigurationManager serverConfigurationManager, ILogger logger, IProviderManager providerManager, IProviderRepository providerRepo, IFileSystem fileSystem, IUserDataManager userDataManager, ILibraryManager libraryManager) : base(serverConfigurationManager, logger, providerManager, providerRepo, fileSystem, userDataManager, libraryManager) + protected override void MergeData(MetadataResult source, MetadataResult target, List lockedFields, bool replaceData, bool mergeMetadataSettings) { + ProviderUtils.MergeBaseItemData(source, target, lockedFields, replaceData, mergeMetadataSettings); } - protected override void MergeData(MetadataResult source, MetadataResult target, List lockedFields, bool replaceData, bool mergeMetadataSettings) + public GameGenreMetadataService(IServerConfigurationManager serverConfigurationManager, ILogger logger, IProviderManager providerManager, IFileSystem fileSystem, IUserDataManager userDataManager, ILibraryManager libraryManager) : base(serverConfigurationManager, logger, providerManager, fileSystem, userDataManager, libraryManager) { - ProviderUtils.MergeBaseItemData(source, target, lockedFields, replaceData, mergeMetadataSettings); } } } diff --git a/MediaBrowser.Providers/Games/GameMetadataService.cs b/MediaBrowser.Providers/Games/GameMetadataService.cs index 23284b84ef..a44f1d95f8 100644 --- a/MediaBrowser.Providers/Games/GameMetadataService.cs +++ b/MediaBrowser.Providers/Games/GameMetadataService.cs @@ -12,10 +12,6 @@ namespace MediaBrowser.Providers.Games { public class GameMetadataService : MetadataService { - public GameMetadataService(IServerConfigurationManager serverConfigurationManager, ILogger logger, IProviderManager providerManager, IProviderRepository providerRepo, IFileSystem fileSystem, IUserDataManager userDataManager, ILibraryManager libraryManager) : base(serverConfigurationManager, logger, providerManager, providerRepo, fileSystem, userDataManager, libraryManager) - { - } - protected override void MergeData(MetadataResult source, MetadataResult target, List lockedFields, bool replaceData, bool mergeMetadataSettings) { ProviderUtils.MergeBaseItemData(source, target, lockedFields, replaceData, mergeMetadataSettings); @@ -33,5 +29,9 @@ namespace MediaBrowser.Providers.Games targetItem.PlayersSupported = sourceItem.PlayersSupported; } } + + public GameMetadataService(IServerConfigurationManager serverConfigurationManager, ILogger logger, IProviderManager providerManager, IFileSystem fileSystem, IUserDataManager userDataManager, ILibraryManager libraryManager) : base(serverConfigurationManager, logger, providerManager, fileSystem, userDataManager, libraryManager) + { + } } } diff --git a/MediaBrowser.Providers/Games/GameSystemMetadataService.cs b/MediaBrowser.Providers/Games/GameSystemMetadataService.cs index a70b5c7fed..6cf2a45a47 100644 --- a/MediaBrowser.Providers/Games/GameSystemMetadataService.cs +++ b/MediaBrowser.Providers/Games/GameSystemMetadataService.cs @@ -12,10 +12,6 @@ namespace MediaBrowser.Providers.Games { public class GameSystemMetadataService : MetadataService { - public GameSystemMetadataService(IServerConfigurationManager serverConfigurationManager, ILogger logger, IProviderManager providerManager, IProviderRepository providerRepo, IFileSystem fileSystem, IUserDataManager userDataManager, ILibraryManager libraryManager) : base(serverConfigurationManager, logger, providerManager, providerRepo, fileSystem, userDataManager, libraryManager) - { - } - protected override void MergeData(MetadataResult source, MetadataResult target, List lockedFields, bool replaceData, bool mergeMetadataSettings) { ProviderUtils.MergeBaseItemData(source, target, lockedFields, replaceData, mergeMetadataSettings); @@ -28,5 +24,9 @@ namespace MediaBrowser.Providers.Games targetItem.GameSystemName = sourceItem.GameSystemName; } } + + public GameSystemMetadataService(IServerConfigurationManager serverConfigurationManager, ILogger logger, IProviderManager providerManager, IFileSystem fileSystem, IUserDataManager userDataManager, ILibraryManager libraryManager) : base(serverConfigurationManager, logger, providerManager, fileSystem, userDataManager, libraryManager) + { + } } } diff --git a/MediaBrowser.Providers/Genres/GenreMetadataService.cs b/MediaBrowser.Providers/Genres/GenreMetadataService.cs index 7aba931a22..d4ea3e9cf8 100644 --- a/MediaBrowser.Providers/Genres/GenreMetadataService.cs +++ b/MediaBrowser.Providers/Genres/GenreMetadataService.cs @@ -12,13 +12,13 @@ namespace MediaBrowser.Providers.Genres { public class GenreMetadataService : MetadataService { - public GenreMetadataService(IServerConfigurationManager serverConfigurationManager, ILogger logger, IProviderManager providerManager, IProviderRepository providerRepo, IFileSystem fileSystem, IUserDataManager userDataManager, ILibraryManager libraryManager) : base(serverConfigurationManager, logger, providerManager, providerRepo, fileSystem, userDataManager, libraryManager) + protected override void MergeData(MetadataResult source, MetadataResult target, List lockedFields, bool replaceData, bool mergeMetadataSettings) { + ProviderUtils.MergeBaseItemData(source, target, lockedFields, replaceData, mergeMetadataSettings); } - protected override void MergeData(MetadataResult source, MetadataResult target, List lockedFields, bool replaceData, bool mergeMetadataSettings) + public GenreMetadataService(IServerConfigurationManager serverConfigurationManager, ILogger logger, IProviderManager providerManager, IFileSystem fileSystem, IUserDataManager userDataManager, ILibraryManager libraryManager) : base(serverConfigurationManager, logger, providerManager, fileSystem, userDataManager, libraryManager) { - ProviderUtils.MergeBaseItemData(source, target, lockedFields, replaceData, mergeMetadataSettings); } } } diff --git a/MediaBrowser.Providers/LiveTv/AudioRecordingService.cs b/MediaBrowser.Providers/LiveTv/AudioRecordingService.cs index 4ccbb91165..1d99a678ba 100644 --- a/MediaBrowser.Providers/LiveTv/AudioRecordingService.cs +++ b/MediaBrowser.Providers/LiveTv/AudioRecordingService.cs @@ -12,13 +12,13 @@ namespace MediaBrowser.Providers.LiveTv { public class AudioRecordingService : MetadataService { - public AudioRecordingService(IServerConfigurationManager serverConfigurationManager, ILogger logger, IProviderManager providerManager, IProviderRepository providerRepo, IFileSystem fileSystem, IUserDataManager userDataManager, ILibraryManager libraryManager) : base(serverConfigurationManager, logger, providerManager, providerRepo, fileSystem, userDataManager, libraryManager) + protected override void MergeData(MetadataResult source, MetadataResult target, List lockedFields, bool replaceData, bool mergeMetadataSettings) { + ProviderUtils.MergeBaseItemData(source, target, lockedFields, replaceData, mergeMetadataSettings); } - protected override void MergeData(MetadataResult source, MetadataResult target, List lockedFields, bool replaceData, bool mergeMetadataSettings) + public AudioRecordingService(IServerConfigurationManager serverConfigurationManager, ILogger logger, IProviderManager providerManager, IFileSystem fileSystem, IUserDataManager userDataManager, ILibraryManager libraryManager) : base(serverConfigurationManager, logger, providerManager, fileSystem, userDataManager, libraryManager) { - ProviderUtils.MergeBaseItemData(source, target, lockedFields, replaceData, mergeMetadataSettings); } } } diff --git a/MediaBrowser.Providers/LiveTv/ChannelMetadataService.cs b/MediaBrowser.Providers/LiveTv/ChannelMetadataService.cs index 0b9b18bbc5..8abb996895 100644 --- a/MediaBrowser.Providers/LiveTv/ChannelMetadataService.cs +++ b/MediaBrowser.Providers/LiveTv/ChannelMetadataService.cs @@ -12,13 +12,13 @@ namespace MediaBrowser.Providers.LiveTv { public class ChannelMetadataService : MetadataService { - public ChannelMetadataService(IServerConfigurationManager serverConfigurationManager, ILogger logger, IProviderManager providerManager, IProviderRepository providerRepo, IFileSystem fileSystem, IUserDataManager userDataManager, ILibraryManager libraryManager) : base(serverConfigurationManager, logger, providerManager, providerRepo, fileSystem, userDataManager, libraryManager) + protected override void MergeData(MetadataResult source, MetadataResult target, List lockedFields, bool replaceData, bool mergeMetadataSettings) { + ProviderUtils.MergeBaseItemData(source, target, lockedFields, replaceData, mergeMetadataSettings); } - protected override void MergeData(MetadataResult source, MetadataResult target, List lockedFields, bool replaceData, bool mergeMetadataSettings) + public ChannelMetadataService(IServerConfigurationManager serverConfigurationManager, ILogger logger, IProviderManager providerManager, IFileSystem fileSystem, IUserDataManager userDataManager, ILibraryManager libraryManager) : base(serverConfigurationManager, logger, providerManager, fileSystem, userDataManager, libraryManager) { - ProviderUtils.MergeBaseItemData(source, target, lockedFields, replaceData, mergeMetadataSettings); } } } diff --git a/MediaBrowser.Providers/LiveTv/ProgramMetadataService.cs b/MediaBrowser.Providers/LiveTv/ProgramMetadataService.cs index 0bf4a1b37c..b73d82c19d 100644 --- a/MediaBrowser.Providers/LiveTv/ProgramMetadataService.cs +++ b/MediaBrowser.Providers/LiveTv/ProgramMetadataService.cs @@ -12,13 +12,13 @@ namespace MediaBrowser.Providers.LiveTv { public class ProgramMetadataService : MetadataService { - public ProgramMetadataService(IServerConfigurationManager serverConfigurationManager, ILogger logger, IProviderManager providerManager, IProviderRepository providerRepo, IFileSystem fileSystem, IUserDataManager userDataManager, ILibraryManager libraryManager) : base(serverConfigurationManager, logger, providerManager, providerRepo, fileSystem, userDataManager, libraryManager) + protected override void MergeData(MetadataResult source, MetadataResult target, List lockedFields, bool replaceData, bool mergeMetadataSettings) { + ProviderUtils.MergeBaseItemData(source, target, lockedFields, replaceData, mergeMetadataSettings); } - protected override void MergeData(MetadataResult source, MetadataResult target, List lockedFields, bool replaceData, bool mergeMetadataSettings) + public ProgramMetadataService(IServerConfigurationManager serverConfigurationManager, ILogger logger, IProviderManager providerManager, IFileSystem fileSystem, IUserDataManager userDataManager, ILibraryManager libraryManager) : base(serverConfigurationManager, logger, providerManager, fileSystem, userDataManager, libraryManager) { - ProviderUtils.MergeBaseItemData(source, target, lockedFields, replaceData, mergeMetadataSettings); } } } diff --git a/MediaBrowser.Providers/LiveTv/VideoRecordingService.cs b/MediaBrowser.Providers/LiveTv/VideoRecordingService.cs index 47ac546a23..15530f8f99 100644 --- a/MediaBrowser.Providers/LiveTv/VideoRecordingService.cs +++ b/MediaBrowser.Providers/LiveTv/VideoRecordingService.cs @@ -12,13 +12,13 @@ namespace MediaBrowser.Providers.LiveTv { public class VideoRecordingService : MetadataService { - public VideoRecordingService(IServerConfigurationManager serverConfigurationManager, ILogger logger, IProviderManager providerManager, IProviderRepository providerRepo, IFileSystem fileSystem, IUserDataManager userDataManager, ILibraryManager libraryManager) : base(serverConfigurationManager, logger, providerManager, providerRepo, fileSystem, userDataManager, libraryManager) + protected override void MergeData(MetadataResult source, MetadataResult target, List lockedFields, bool replaceData, bool mergeMetadataSettings) { + ProviderUtils.MergeBaseItemData(source, target, lockedFields, replaceData, mergeMetadataSettings); } - protected override void MergeData(MetadataResult source, MetadataResult target, List lockedFields, bool replaceData, bool mergeMetadataSettings) + public VideoRecordingService(IServerConfigurationManager serverConfigurationManager, ILogger logger, IProviderManager providerManager, IFileSystem fileSystem, IUserDataManager userDataManager, ILibraryManager libraryManager) : base(serverConfigurationManager, logger, providerManager, fileSystem, userDataManager, libraryManager) { - ProviderUtils.MergeBaseItemData(source, target, lockedFields, replaceData, mergeMetadataSettings); } } } diff --git a/MediaBrowser.Providers/Manager/MetadataService.cs b/MediaBrowser.Providers/Manager/MetadataService.cs index 7184302f19..0c29544243 100644 --- a/MediaBrowser.Providers/Manager/MetadataService.cs +++ b/MediaBrowser.Providers/Manager/MetadataService.cs @@ -1,5 +1,4 @@ using MediaBrowser.Common.Extensions; -using MediaBrowser.Common.IO; using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Library; @@ -12,11 +11,6 @@ using System.Linq; using System.Threading; using System.Threading.Tasks; using CommonIO; -using MediaBrowser.Controller.Channels; -using MediaBrowser.Controller.Entities.Audio; -using MediaBrowser.Controller.Entities.Movies; -using MediaBrowser.Controller.LiveTv; -using MediaBrowser.Controller.Playlists; using MediaBrowser.Model.Providers; namespace MediaBrowser.Providers.Manager @@ -28,95 +22,26 @@ namespace MediaBrowser.Providers.Manager protected readonly IServerConfigurationManager ServerConfigurationManager; protected readonly ILogger Logger; protected readonly IProviderManager ProviderManager; - protected readonly IProviderRepository ProviderRepo; protected readonly IFileSystem FileSystem; protected readonly IUserDataManager UserDataManager; protected readonly ILibraryManager LibraryManager; - protected MetadataService(IServerConfigurationManager serverConfigurationManager, ILogger logger, IProviderManager providerManager, IProviderRepository providerRepo, IFileSystem fileSystem, IUserDataManager userDataManager, ILibraryManager libraryManager) + protected MetadataService(IServerConfigurationManager serverConfigurationManager, ILogger logger, IProviderManager providerManager, IFileSystem fileSystem, IUserDataManager userDataManager, ILibraryManager libraryManager) { ServerConfigurationManager = serverConfigurationManager; Logger = logger; ProviderManager = providerManager; - ProviderRepo = providerRepo; FileSystem = fileSystem; UserDataManager = userDataManager; LibraryManager = libraryManager; } - /// - /// Saves the provider result. - /// - /// The item. - /// The result. - /// The directory service. - /// Task. - protected Task SaveProviderResult(TItemType item, MetadataStatus result, IDirectoryService directoryService) - { - result.ItemId = item.Id; - - //var locationType = item.LocationType; - - //if (locationType == LocationType.FileSystem || locationType == LocationType.Offline) - //{ - // if (!string.IsNullOrWhiteSpace(item.Path)) - // { - // var file = directoryService.GetFile(item.Path); - - // if ((file.Attributes & FileAttributes.Directory) != FileAttributes.Directory && file.Exists) - // { - // result.ItemDateModified = FileSystem.GetLastWriteTimeUtc(file); - // } - // } - //} - - result.ItemDateModified = item.DateModified; - - if (EnableDateLastRefreshed(item)) - { - return Task.FromResult(true); - } - - return ProviderRepo.SaveMetadataStatus(result, CancellationToken.None); - } - - /// - /// Gets the last result. - /// - /// The item. - /// ProviderResult. - protected MetadataStatus GetLastResult(IHasMetadata item) - { - if (GetLastRefreshDate(item) == default(DateTime)) - { - return new MetadataStatus { ItemId = item.Id }; - } - - if (EnableDateLastRefreshed(item) && item.DateModifiedDuringLastRefresh.HasValue) - { - return new MetadataStatus - { - ItemId = item.Id, - DateLastImagesRefresh = item.DateLastRefreshed, - DateLastMetadataRefresh = item.DateLastRefreshed, - ItemDateModified = item.DateModifiedDuringLastRefresh.Value - }; - } - - var result = ProviderRepo.GetMetadataStatus(item.Id) ?? new MetadataStatus { ItemId = item.Id }; - - item.DateModifiedDuringLastRefresh = result.ItemDateModified; - - return result; - } - public async Task RefreshMetadata(IHasMetadata item, MetadataRefreshOptions refreshOptions, CancellationToken cancellationToken) { var itemOfType = (TItemType)item; var config = ProviderManager.GetMetadataOptions(item); var updateType = ItemUpdateType.None; - var refreshResult = GetLastResult(item); var itemImageProvider = new ItemImageProvider(Logger, ProviderManager, ServerConfigurationManager, FileSystem); var localImagesFailed = false; @@ -153,12 +78,10 @@ namespace MediaBrowser.Providers.Manager // TODO: If this returns true, should we instead just change metadata refresh mode to Full? requiresRefresh = item.RequiresRefresh(); - var providers = GetProviders(item, refreshResult, refreshOptions, requiresRefresh) + var providers = GetProviders(item, refreshOptions, requiresRefresh) .ToList(); - var dateLastRefresh = EnableDateLastRefreshed(item) - ? item.DateLastRefreshed - : refreshResult.DateLastMetadataRefresh ?? default(DateTime); + var dateLastRefresh = item.DateLastRefreshed; if (providers.Count > 0 || dateLastRefresh == default(DateTime)) { @@ -185,13 +108,11 @@ namespace MediaBrowser.Providers.Manager updateType = updateType | result.UpdateType; if (result.Failures == 0) { - refreshResult.SetDateLastMetadataRefresh(DateTime.UtcNow); hasRefreshedMetadata = true; } else { hasRefreshedMetadata = false; - refreshResult.SetDateLastMetadataRefresh(null); } } } @@ -199,7 +120,7 @@ namespace MediaBrowser.Providers.Manager // Next run remote image providers, but only if local image providers didn't throw an exception if (!localImagesFailed && refreshOptions.ImageRefreshMode != ImageRefreshMode.ValidationOnly) { - var providers = GetNonLocalImageProviders(item, allImageProviders, refreshResult, refreshOptions).ToList(); + var providers = GetNonLocalImageProviders(item, allImageProviders, refreshOptions).ToList(); if (providers.Count > 0) { @@ -208,13 +129,11 @@ namespace MediaBrowser.Providers.Manager updateType = updateType | result.UpdateType; if (result.Failures == 0) { - refreshResult.SetDateLastImagesRefresh(DateTime.UtcNow); hasRefreshedImages = true; } else { hasRefreshedImages = false; - refreshResult.SetDateLastImagesRefresh(null); } } } @@ -248,11 +167,6 @@ namespace MediaBrowser.Providers.Manager await SaveItem(metadataResult, updateType, cancellationToken).ConfigureAwait(false); } - if (updateType > ItemUpdateType.None || refreshResult.IsDirty) - { - await SaveProviderResult(itemOfType, refreshResult, refreshOptions.DirectoryService).ConfigureAwait(false); - } - await AfterMetadataRefresh(itemOfType, refreshOptions, cancellationToken).ConfigureAwait(false); return updateType; @@ -279,47 +193,7 @@ namespace MediaBrowser.Providers.Manager private DateTime GetLastRefreshDate(IHasMetadata item) { - if (EnableDateLastRefreshed(item)) - { - return item.DateLastRefreshed; - } - - return item.DateLastSaved; - } - - private bool EnableDateLastRefreshed(IHasMetadata item) - { - if (ServerConfigurationManager.Configuration.EnableDateLastRefresh) - { - return true; - } - - if (item.DateLastRefreshed != default(DateTime)) - { - return true; - } - - if (!(item is Audio) && !(item is Video)) - { - return true; - } - - if (item is IItemByName) - { - return true; - } - - if (item.SourceType != SourceType.Library) - { - return true; - } - - if (item is MusicVideo) - { - return true; - } - - return false; + return item.DateLastRefreshed; } protected async Task SaveItem(MetadataResult result, ItemUpdateType reason, CancellationToken cancellationToken) @@ -466,14 +340,12 @@ namespace MediaBrowser.Providers.Manager /// Gets the providers. /// /// IEnumerable{`0}. - protected IEnumerable GetProviders(IHasMetadata item, MetadataStatus status, MetadataRefreshOptions options, bool requiresRefresh) + protected IEnumerable GetProviders(IHasMetadata item, MetadataRefreshOptions options, bool requiresRefresh) { // Get providers to refresh var providers = ((ProviderManager)ProviderManager).GetMetadataProviders(item).ToList(); - var dateLastRefresh = EnableDateLastRefreshed(item) - ? item.DateLastRefreshed - : status.DateLastMetadataRefresh ?? default(DateTime); + var dateLastRefresh = item.DateLastRefreshed; // Run all if either of these flags are true var runAllProviders = options.ReplaceAllMetadata || options.MetadataRefreshMode == MetadataRefreshMode.FullRefresh || dateLastRefresh == default(DateTime) || requiresRefresh; @@ -535,14 +407,12 @@ namespace MediaBrowser.Providers.Manager return providers; } - protected virtual IEnumerable GetNonLocalImageProviders(IHasMetadata item, IEnumerable allImageProviders, MetadataStatus status, ImageRefreshOptions options) + protected virtual IEnumerable GetNonLocalImageProviders(IHasMetadata item, IEnumerable allImageProviders, ImageRefreshOptions options) { // Get providers to refresh var providers = allImageProviders.Where(i => !(i is ILocalImageProvider)).ToList(); - var dateLastImageRefresh = EnableDateLastRefreshed(item) - ? item.DateLastRefreshed - : status.DateLastImagesRefresh ?? default(DateTime); + var dateLastImageRefresh = item.DateLastRefreshed; // Run all if either of these flags are true var runAllProviders = options.ImageRefreshMode == ImageRefreshMode.FullRefresh || dateLastImageRefresh == default(DateTime); diff --git a/MediaBrowser.Providers/Movies/MovieMetadataService.cs b/MediaBrowser.Providers/Movies/MovieMetadataService.cs index e70ec00576..83be9ca6f9 100644 --- a/MediaBrowser.Providers/Movies/MovieMetadataService.cs +++ b/MediaBrowser.Providers/Movies/MovieMetadataService.cs @@ -13,10 +13,6 @@ namespace MediaBrowser.Providers.Movies { public class MovieMetadataService : MetadataService { - public MovieMetadataService(IServerConfigurationManager serverConfigurationManager, ILogger logger, IProviderManager providerManager, IProviderRepository providerRepo, IFileSystem fileSystem, IUserDataManager userDataManager, ILibraryManager libraryManager) : base(serverConfigurationManager, logger, providerManager, providerRepo, fileSystem, userDataManager, libraryManager) - { - } - protected override bool IsFullLocalMetadata(Movie item) { if (string.IsNullOrWhiteSpace(item.Overview)) @@ -42,15 +38,14 @@ namespace MediaBrowser.Providers.Movies targetItem.CollectionName = sourceItem.CollectionName; } } - } - public class TrailerMetadataService : MetadataService - { - public TrailerMetadataService(IServerConfigurationManager serverConfigurationManager, ILogger logger, IProviderManager providerManager, IProviderRepository providerRepo, IFileSystem fileSystem, IUserDataManager userDataManager, ILibraryManager libraryManager) - : base(serverConfigurationManager, logger, providerManager, providerRepo, fileSystem, userDataManager, libraryManager) + public MovieMetadataService(IServerConfigurationManager serverConfigurationManager, ILogger logger, IProviderManager providerManager, IFileSystem fileSystem, IUserDataManager userDataManager, ILibraryManager libraryManager) : base(serverConfigurationManager, logger, providerManager, fileSystem, userDataManager, libraryManager) { } + } + public class TrailerMetadataService : MetadataService + { protected override bool IsFullLocalMetadata(Trailer item) { if (string.IsNullOrWhiteSpace(item.Overview)) @@ -73,6 +68,10 @@ namespace MediaBrowser.Providers.Movies target.Item.TrailerTypes = source.Item.TrailerTypes; } } + + public TrailerMetadataService(IServerConfigurationManager serverConfigurationManager, ILogger logger, IProviderManager providerManager, IFileSystem fileSystem, IUserDataManager userDataManager, ILibraryManager libraryManager) : base(serverConfigurationManager, logger, providerManager, fileSystem, userDataManager, libraryManager) + { + } } } diff --git a/MediaBrowser.Providers/Music/AlbumMetadataService.cs b/MediaBrowser.Providers/Music/AlbumMetadataService.cs index 8f951723e8..4f87b2036b 100644 --- a/MediaBrowser.Providers/Music/AlbumMetadataService.cs +++ b/MediaBrowser.Providers/Music/AlbumMetadataService.cs @@ -15,10 +15,6 @@ namespace MediaBrowser.Providers.Music { public class AlbumMetadataService : MetadataService { - public AlbumMetadataService(IServerConfigurationManager serverConfigurationManager, ILogger logger, IProviderManager providerManager, IProviderRepository providerRepo, IFileSystem fileSystem, IUserDataManager userDataManager, ILibraryManager libraryManager) : base(serverConfigurationManager, logger, providerManager, providerRepo, fileSystem, userDataManager, libraryManager) - { - } - protected override async Task BeforeSave(MusicAlbum item, bool isFullRefresh, ItemUpdateType currentUpdateType) { var updateType = await base.BeforeSave(item, isFullRefresh, currentUpdateType).ConfigureAwait(false); @@ -166,5 +162,9 @@ namespace MediaBrowser.Providers.Music targetItem.Artists = sourceItem.Artists; } } + + public AlbumMetadataService(IServerConfigurationManager serverConfigurationManager, ILogger logger, IProviderManager providerManager, IFileSystem fileSystem, IUserDataManager userDataManager, ILibraryManager libraryManager) : base(serverConfigurationManager, logger, providerManager, fileSystem, userDataManager, libraryManager) + { + } } } diff --git a/MediaBrowser.Providers/Music/ArtistMetadataService.cs b/MediaBrowser.Providers/Music/ArtistMetadataService.cs index 21e9b006bf..b2f975b131 100644 --- a/MediaBrowser.Providers/Music/ArtistMetadataService.cs +++ b/MediaBrowser.Providers/Music/ArtistMetadataService.cs @@ -15,10 +15,6 @@ namespace MediaBrowser.Providers.Music { public class ArtistMetadataService : MetadataService { - public ArtistMetadataService(IServerConfigurationManager serverConfigurationManager, ILogger logger, IProviderManager providerManager, IProviderRepository providerRepo, IFileSystem fileSystem, IUserDataManager userDataManager, ILibraryManager libraryManager) : base(serverConfigurationManager, logger, providerManager, providerRepo, fileSystem, userDataManager, libraryManager) - { - } - protected override async Task BeforeSave(MusicArtist item, bool isFullRefresh, ItemUpdateType currentUpdateType) { var updateType = await base.BeforeSave(item, isFullRefresh, currentUpdateType).ConfigureAwait(false); @@ -58,5 +54,9 @@ namespace MediaBrowser.Providers.Music { ProviderUtils.MergeBaseItemData(source, target, lockedFields, replaceData, mergeMetadataSettings); } + + public ArtistMetadataService(IServerConfigurationManager serverConfigurationManager, ILogger logger, IProviderManager providerManager, IFileSystem fileSystem, IUserDataManager userDataManager, ILibraryManager libraryManager) : base(serverConfigurationManager, logger, providerManager, fileSystem, userDataManager, libraryManager) + { + } } } diff --git a/MediaBrowser.Providers/Music/AudioMetadataService.cs b/MediaBrowser.Providers/Music/AudioMetadataService.cs index 161a161938..5321281869 100644 --- a/MediaBrowser.Providers/Music/AudioMetadataService.cs +++ b/MediaBrowser.Providers/Music/AudioMetadataService.cs @@ -12,10 +12,6 @@ namespace MediaBrowser.Providers.Music { public class AudioMetadataService : MetadataService { - public AudioMetadataService(IServerConfigurationManager serverConfigurationManager, ILogger logger, IProviderManager providerManager, IProviderRepository providerRepo, IFileSystem fileSystem, IUserDataManager userDataManager, ILibraryManager libraryManager) : base(serverConfigurationManager, logger, providerManager, providerRepo, fileSystem, userDataManager, libraryManager) - { - } - protected override void MergeData(MetadataResult