diff --git a/MediaBrowser.Controller/MediaBrowser.Controller.csproj b/MediaBrowser.Controller/MediaBrowser.Controller.csproj index dd9383827..b84fe3c71 100644 --- a/MediaBrowser.Controller/MediaBrowser.Controller.csproj +++ b/MediaBrowser.Controller/MediaBrowser.Controller.csproj @@ -312,7 +312,6 @@ - diff --git a/MediaBrowser.Controller/Providers/ILocalMetadataProvider.cs b/MediaBrowser.Controller/Providers/ILocalMetadataProvider.cs index 3a8ef7325..28a535310 100644 --- a/MediaBrowser.Controller/Providers/ILocalMetadataProvider.cs +++ b/MediaBrowser.Controller/Providers/ILocalMetadataProvider.cs @@ -18,7 +18,7 @@ namespace MediaBrowser.Controller.Providers /// The directory service. /// The cancellation token. /// Task{MetadataResult{`0}}. - Task> GetMetadata(ItemInfo info, + Task> GetMetadata(ItemInfo info, IDirectoryService directoryService, CancellationToken cancellationToken); } diff --git a/MediaBrowser.Controller/Providers/LocalMetadataResult.cs b/MediaBrowser.Controller/Providers/LocalMetadataResult.cs deleted file mode 100644 index 76b7a3136..000000000 --- a/MediaBrowser.Controller/Providers/LocalMetadataResult.cs +++ /dev/null @@ -1,18 +0,0 @@ -using MediaBrowser.Controller.Entities; -using System.Collections.Generic; - -namespace MediaBrowser.Controller.Providers -{ - public class LocalMetadataResult : MetadataResult - where T : IHasMetadata - { - public List Images { get; set; } - public List UserDataLIst { get; set; } - - public LocalMetadataResult() - { - Images = new List(); - UserDataLIst = new List(); - } - } -} \ No newline at end of file diff --git a/MediaBrowser.Controller/Providers/MetadataResult.cs b/MediaBrowser.Controller/Providers/MetadataResult.cs index 68cdf4d72..17175f91c 100644 --- a/MediaBrowser.Controller/Providers/MetadataResult.cs +++ b/MediaBrowser.Controller/Providers/MetadataResult.cs @@ -1,10 +1,20 @@ using MediaBrowser.Controller.Entities; +using System; using System.Collections.Generic; +using System.Linq; namespace MediaBrowser.Controller.Providers { public class MetadataResult { + public List Images { get; set; } + public List UserDataList { get; set; } + + public MetadataResult() + { + Images = new List(); + } + public List People { get; set; } public bool HasMetadata { get; set; } @@ -31,5 +41,27 @@ namespace MediaBrowser.Controller.Providers } People.Clear(); } + + public UserItemData GetOrAddUserData(string userId) + { + if (UserDataList == null) + { + UserDataList = new List(); + } + + var userData = UserDataList.FirstOrDefault(i => string.Equals(userId, i.UserId.ToString("N"), StringComparison.OrdinalIgnoreCase)); + + if (userData == null) + { + userData = new UserItemData() + { + UserId = new Guid(userId) + }; + + UserDataList.Add(userData); + } + + return userData; + } } } \ No newline at end of file diff --git a/MediaBrowser.LocalMetadata/BaseXmlProvider.cs b/MediaBrowser.LocalMetadata/BaseXmlProvider.cs index 57358fe62..aa0f11475 100644 --- a/MediaBrowser.LocalMetadata/BaseXmlProvider.cs +++ b/MediaBrowser.LocalMetadata/BaseXmlProvider.cs @@ -13,11 +13,11 @@ namespace MediaBrowser.LocalMetadata { protected IFileSystem FileSystem; - public async Task> GetMetadata(ItemInfo info, + public async Task> GetMetadata(ItemInfo info, IDirectoryService directoryService, CancellationToken cancellationToken) { - var result = new LocalMetadataResult(); + var result = new MetadataResult(); var file = GetXmlFile(info, directoryService); @@ -47,7 +47,7 @@ namespace MediaBrowser.LocalMetadata return result; } - protected abstract void Fetch(LocalMetadataResult result, string path, CancellationToken cancellationToken); + protected abstract void Fetch(MetadataResult result, string path, CancellationToken cancellationToken); protected BaseXmlProvider(IFileSystem fileSystem) { diff --git a/MediaBrowser.LocalMetadata/Parsers/GameSystemXmlParser.cs b/MediaBrowser.LocalMetadata/Parsers/GameSystemXmlParser.cs index 8ae0eafec..09cc1fdd7 100644 --- a/MediaBrowser.LocalMetadata/Parsers/GameSystemXmlParser.cs +++ b/MediaBrowser.LocalMetadata/Parsers/GameSystemXmlParser.cs @@ -1,10 +1,10 @@ -using System.Threading; -using System.Threading.Tasks; -using System.Xml; -using MediaBrowser.Controller.Entities; +using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Providers; using MediaBrowser.Model.Entities; using MediaBrowser.Model.Logging; +using System.Threading; +using System.Threading.Tasks; +using System.Xml; namespace MediaBrowser.LocalMetadata.Parsers { diff --git a/MediaBrowser.LocalMetadata/Providers/BoxSetXmlProvider.cs b/MediaBrowser.LocalMetadata/Providers/BoxSetXmlProvider.cs index 98a5d5e91..fc22e75c5 100644 --- a/MediaBrowser.LocalMetadata/Providers/BoxSetXmlProvider.cs +++ b/MediaBrowser.LocalMetadata/Providers/BoxSetXmlProvider.cs @@ -21,7 +21,7 @@ namespace MediaBrowser.LocalMetadata.Providers _logger = logger; } - protected override void Fetch(LocalMetadataResult result, string path, CancellationToken cancellationToken) + protected override void Fetch(MetadataResult result, string path, CancellationToken cancellationToken) { new BoxSetXmlParser(_logger).Fetch(result, path, cancellationToken); } diff --git a/MediaBrowser.LocalMetadata/Providers/EpisodeXmlProvider.cs b/MediaBrowser.LocalMetadata/Providers/EpisodeXmlProvider.cs index c1fc1ba5e..bf2730032 100644 --- a/MediaBrowser.LocalMetadata/Providers/EpisodeXmlProvider.cs +++ b/MediaBrowser.LocalMetadata/Providers/EpisodeXmlProvider.cs @@ -20,7 +20,7 @@ namespace MediaBrowser.LocalMetadata.Providers _logger = logger; } - protected override void Fetch(LocalMetadataResult result, string path, CancellationToken cancellationToken) + protected override void Fetch(MetadataResult result, string path, CancellationToken cancellationToken) { var images = new List(); var chapters = new List(); diff --git a/MediaBrowser.LocalMetadata/Providers/FolderXmlProvider.cs b/MediaBrowser.LocalMetadata/Providers/FolderXmlProvider.cs index d18e92f16..bf059c553 100644 --- a/MediaBrowser.LocalMetadata/Providers/FolderXmlProvider.cs +++ b/MediaBrowser.LocalMetadata/Providers/FolderXmlProvider.cs @@ -20,7 +20,7 @@ namespace MediaBrowser.LocalMetadata.Providers _logger = logger; } - protected override void Fetch(LocalMetadataResult result, string path, CancellationToken cancellationToken) + protected override void Fetch(MetadataResult result, string path, CancellationToken cancellationToken) { new BaseItemXmlParser(_logger).Fetch(result, path, cancellationToken); } diff --git a/MediaBrowser.LocalMetadata/Providers/GameSystemXmlProvider.cs b/MediaBrowser.LocalMetadata/Providers/GameSystemXmlProvider.cs index 9d86edbf9..f51605f06 100644 --- a/MediaBrowser.LocalMetadata/Providers/GameSystemXmlProvider.cs +++ b/MediaBrowser.LocalMetadata/Providers/GameSystemXmlProvider.cs @@ -18,7 +18,7 @@ namespace MediaBrowser.LocalMetadata.Providers _logger = logger; } - protected override void Fetch(LocalMetadataResult result, string path, CancellationToken cancellationToken) + protected override void Fetch(MetadataResult result, string path, CancellationToken cancellationToken) { new GameSystemXmlParser(_logger).Fetch(result, path, cancellationToken); } diff --git a/MediaBrowser.LocalMetadata/Providers/GameXmlProvider.cs b/MediaBrowser.LocalMetadata/Providers/GameXmlProvider.cs index 97a3da147..7ee2c768b 100644 --- a/MediaBrowser.LocalMetadata/Providers/GameXmlProvider.cs +++ b/MediaBrowser.LocalMetadata/Providers/GameXmlProvider.cs @@ -18,7 +18,7 @@ namespace MediaBrowser.LocalMetadata.Providers _logger = logger; } - protected override void Fetch(LocalMetadataResult result, string path, CancellationToken cancellationToken) + protected override void Fetch(MetadataResult result, string path, CancellationToken cancellationToken) { new GameXmlParser(_logger).Fetch(result, path, cancellationToken); } diff --git a/MediaBrowser.LocalMetadata/Providers/MovieXmlProvider.cs b/MediaBrowser.LocalMetadata/Providers/MovieXmlProvider.cs index 09f13b2ea..82c7dbd67 100644 --- a/MediaBrowser.LocalMetadata/Providers/MovieXmlProvider.cs +++ b/MediaBrowser.LocalMetadata/Providers/MovieXmlProvider.cs @@ -18,7 +18,7 @@ namespace MediaBrowser.LocalMetadata.Providers _logger = logger; } - protected override void Fetch(LocalMetadataResult result, string path, CancellationToken cancellationToken) + protected override void Fetch(MetadataResult result, string path, CancellationToken cancellationToken) { new MovieXmlParser(_logger).Fetch(result, path, cancellationToken); } diff --git a/MediaBrowser.LocalMetadata/Providers/MusicVideoXmlProvider.cs b/MediaBrowser.LocalMetadata/Providers/MusicVideoXmlProvider.cs index b3476c03b..3171dd9a7 100644 --- a/MediaBrowser.LocalMetadata/Providers/MusicVideoXmlProvider.cs +++ b/MediaBrowser.LocalMetadata/Providers/MusicVideoXmlProvider.cs @@ -18,7 +18,7 @@ namespace MediaBrowser.LocalMetadata.Providers _logger = logger; } - protected override void Fetch(LocalMetadataResult result, string path, CancellationToken cancellationToken) + protected override void Fetch(MetadataResult result, string path, CancellationToken cancellationToken) { new MusicVideoXmlParser(_logger).Fetch(result, path, cancellationToken); } diff --git a/MediaBrowser.LocalMetadata/Providers/PersonXmlProvider.cs b/MediaBrowser.LocalMetadata/Providers/PersonXmlProvider.cs index a97d86406..115d5b041 100644 --- a/MediaBrowser.LocalMetadata/Providers/PersonXmlProvider.cs +++ b/MediaBrowser.LocalMetadata/Providers/PersonXmlProvider.cs @@ -17,7 +17,7 @@ namespace MediaBrowser.LocalMetadata.Providers _logger = logger; } - protected override void Fetch(LocalMetadataResult result, string path, CancellationToken cancellationToken) + protected override void Fetch(MetadataResult result, string path, CancellationToken cancellationToken) { new BaseItemXmlParser(_logger).Fetch(result, path, cancellationToken); } diff --git a/MediaBrowser.LocalMetadata/Providers/PlaylistXmlProvider.cs b/MediaBrowser.LocalMetadata/Providers/PlaylistXmlProvider.cs index f4c2a6afb..3de311e2b 100644 --- a/MediaBrowser.LocalMetadata/Providers/PlaylistXmlProvider.cs +++ b/MediaBrowser.LocalMetadata/Providers/PlaylistXmlProvider.cs @@ -18,7 +18,7 @@ namespace MediaBrowser.LocalMetadata.Providers _logger = logger; } - protected override void Fetch(LocalMetadataResult result, string path, CancellationToken cancellationToken) + protected override void Fetch(MetadataResult result, string path, CancellationToken cancellationToken) { new PlaylistXmlParser(_logger).Fetch(result, path, cancellationToken); } diff --git a/MediaBrowser.LocalMetadata/Providers/SeasonXmlProvider.cs b/MediaBrowser.LocalMetadata/Providers/SeasonXmlProvider.cs index ab68e1e86..f0c8f0fa1 100644 --- a/MediaBrowser.LocalMetadata/Providers/SeasonXmlProvider.cs +++ b/MediaBrowser.LocalMetadata/Providers/SeasonXmlProvider.cs @@ -21,7 +21,7 @@ namespace MediaBrowser.LocalMetadata.Providers _logger = logger; } - protected override void Fetch(LocalMetadataResult result, string path, CancellationToken cancellationToken) + protected override void Fetch(MetadataResult result, string path, CancellationToken cancellationToken) { new SeasonXmlParser(_logger).Fetch(result, path, cancellationToken); } diff --git a/MediaBrowser.LocalMetadata/Providers/SeriesXmlProvider.cs b/MediaBrowser.LocalMetadata/Providers/SeriesXmlProvider.cs index f27612f2f..80fdad483 100644 --- a/MediaBrowser.LocalMetadata/Providers/SeriesXmlProvider.cs +++ b/MediaBrowser.LocalMetadata/Providers/SeriesXmlProvider.cs @@ -21,7 +21,7 @@ namespace MediaBrowser.LocalMetadata.Providers _logger = logger; } - protected override void Fetch(LocalMetadataResult result, string path, CancellationToken cancellationToken) + protected override void Fetch(MetadataResult result, string path, CancellationToken cancellationToken) { new SeriesXmlParser(_logger).Fetch(result, path, cancellationToken); } diff --git a/MediaBrowser.LocalMetadata/Providers/VideoXmlProvider.cs b/MediaBrowser.LocalMetadata/Providers/VideoXmlProvider.cs index 9ba64164e..56d289f97 100644 --- a/MediaBrowser.LocalMetadata/Providers/VideoXmlProvider.cs +++ b/MediaBrowser.LocalMetadata/Providers/VideoXmlProvider.cs @@ -18,7 +18,7 @@ namespace MediaBrowser.LocalMetadata.Providers _logger = logger; } - protected override void Fetch(LocalMetadataResult