diff options
| author | Luke <luke.pulverenti@gmail.com> | 2016-09-09 15:42:40 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2016-09-09 15:42:40 -0400 |
| commit | 080a6511dc44edde960e6aefcab7e6cc068a3414 (patch) | |
| tree | 499c61fec48dcc080888d9cfc021baf734886fe7 /MediaBrowser.Controller | |
| parent | 51051c27cd4a30010eee98f4f99ebb895e166a91 (diff) | |
| parent | 5ad606a2232c6911e2cd8cf5d03da635c7c0c75d (diff) | |
Merge pull request #2151 from MediaBrowser/beta
Beta
Diffstat (limited to 'MediaBrowser.Controller')
| -rw-r--r-- | MediaBrowser.Controller/Channels/IChannelManager.cs | 2 | ||||
| -rw-r--r-- | MediaBrowser.Controller/Collections/ManualCollectionsFolder.cs | 36 | ||||
| -rw-r--r-- | MediaBrowser.Controller/Entities/CollectionFolder.cs | 2 | ||||
| -rw-r--r-- | MediaBrowser.Controller/Entities/Folder.cs | 12 | ||||
| -rw-r--r-- | MediaBrowser.Controller/Entities/TV/Season.cs | 31 | ||||
| -rw-r--r-- | MediaBrowser.Controller/Entities/TV/Series.cs | 57 | ||||
| -rw-r--r-- | MediaBrowser.Controller/Entities/Trailer.cs | 2 | ||||
| -rw-r--r-- | MediaBrowser.Controller/IServerApplicationHost.cs | 2 | ||||
| -rw-r--r-- | MediaBrowser.Controller/Library/ILibraryManager.cs | 3 | ||||
| -rw-r--r-- | MediaBrowser.Controller/Library/NameExtensions.cs | 4 | ||||
| -rw-r--r-- | MediaBrowser.Controller/LiveTv/IHasRegistrationInfo.cs | 15 | ||||
| -rw-r--r-- | MediaBrowser.Controller/LiveTv/ILiveTvManager.cs | 5 | ||||
| -rw-r--r-- | MediaBrowser.Controller/LiveTv/ProgramInfo.cs | 7 | ||||
| -rw-r--r-- | MediaBrowser.Controller/MediaBrowser.Controller.csproj | 2 | ||||
| -rw-r--r-- | MediaBrowser.Controller/Providers/BaseItemXmlParser.cs | 165 |
15 files changed, 129 insertions, 216 deletions
diff --git a/MediaBrowser.Controller/Channels/IChannelManager.cs b/MediaBrowser.Controller/Channels/IChannelManager.cs index e3d2d0440..3c46247a7 100644 --- a/MediaBrowser.Controller/Channels/IChannelManager.cs +++ b/MediaBrowser.Controller/Channels/IChannelManager.cs @@ -31,6 +31,8 @@ namespace MediaBrowser.Controller.Channels /// <returns>ChannelFeatures.</returns> ChannelFeatures GetChannelFeatures(string id); + bool SupportsSync(string channelId); + /// <summary> /// Gets all channel features. /// </summary> diff --git a/MediaBrowser.Controller/Collections/ManualCollectionsFolder.cs b/MediaBrowser.Controller/Collections/ManualCollectionsFolder.cs new file mode 100644 index 000000000..d2d28e504 --- /dev/null +++ b/MediaBrowser.Controller/Collections/ManualCollectionsFolder.cs @@ -0,0 +1,36 @@ +using MediaBrowser.Controller.Entities; + +namespace MediaBrowser.Controller.Collections +{ + public class ManualCollectionsFolder : BasePluginFolder, IHiddenFromDisplay + { + public ManualCollectionsFolder() + { + Name = "Collections"; + DisplayMediaType = "CollectionFolder"; + } + + public override bool IsHidden + { + get + { + return true; + } + } + + public bool IsHiddenFromUser(User user) + { + return !ConfigurationManager.Configuration.DisplayCollectionsView; + } + + public override string CollectionType + { + get { return Model.Entities.CollectionType.BoxSets; } + } + + public override string GetClientTypeName() + { + return typeof(CollectionFolder).Name; + } + } +}
\ No newline at end of file diff --git a/MediaBrowser.Controller/Entities/CollectionFolder.cs b/MediaBrowser.Controller/Entities/CollectionFolder.cs index 597ecf973..30ea26eb6 100644 --- a/MediaBrowser.Controller/Entities/CollectionFolder.cs +++ b/MediaBrowser.Controller/Entities/CollectionFolder.cs @@ -106,7 +106,7 @@ namespace MediaBrowser.Controller.Entities { LibraryOptions[path] = options; - options.SchemaVersion = 1; + options.SchemaVersion = 2; XmlSerializer.SerializeToFile(options, GetLibraryOptionsPath(path)); } } diff --git a/MediaBrowser.Controller/Entities/Folder.cs b/MediaBrowser.Controller/Entities/Folder.cs index bf47ada0d..f1d8def4b 100644 --- a/MediaBrowser.Controller/Entities/Folder.cs +++ b/MediaBrowser.Controller/Entities/Folder.cs @@ -1057,11 +1057,21 @@ namespace MediaBrowser.Controller.Entities /// <returns>IList{BaseItem}.</returns> public IList<BaseItem> GetRecursiveChildren() { - return GetRecursiveChildren(i => true); + return GetRecursiveChildren(true); + } + + public IList<BaseItem> GetRecursiveChildren(bool includeLinkedChildren) + { + return GetRecursiveChildren(i => true, includeLinkedChildren); } public IList<BaseItem> GetRecursiveChildren(Func<BaseItem, bool> filter) { + return GetRecursiveChildren(filter, true); + } + + public IList<BaseItem> GetRecursiveChildren(Func<BaseItem, bool> filter, bool includeLinkedChildren) + { var result = new Dictionary<Guid, BaseItem>(); AddChildrenToList(result, true, true, filter); diff --git a/MediaBrowser.Controller/Entities/TV/Season.cs b/MediaBrowser.Controller/Entities/TV/Season.cs index 65b7c9955..ff3e53b69 100644 --- a/MediaBrowser.Controller/Entities/TV/Season.cs +++ b/MediaBrowser.Controller/Entities/TV/Season.cs @@ -85,9 +85,7 @@ namespace MediaBrowser.Controller.Entities.TV public override int GetChildCount(User user) { - Logger.Debug("Season {0} getting child cound", (Path ?? Name)); var result = GetChildren(user, true).Count(); - Logger.Debug("Season {0} child cound: ", result); return result; } @@ -158,13 +156,10 @@ namespace MediaBrowser.Controller.Entities.TV var id = Guid.NewGuid().ToString("N"); - Logger.Debug("Season.GetItemsInternal entering GetEpisodes. Request id: " + id); var items = GetEpisodes(user).Where(filter); - Logger.Debug("Season.GetItemsInternal entering PostFilterAndSort. Request id: " + id); var result = PostFilterAndSort(items, query, false, false); - Logger.Debug("Season.GetItemsInternal complete. Request id: " + id); return Task.FromResult(result); } @@ -185,34 +180,12 @@ namespace MediaBrowser.Controller.Entities.TV public IEnumerable<Episode> GetEpisodes(Series series, User user, IEnumerable<Episode> allSeriesEpisodes) { - return series.GetSeasonEpisodes(user, this, allSeriesEpisodes); + return series.GetSeasonEpisodes(this, user, allSeriesEpisodes); } public IEnumerable<Episode> GetEpisodes() { - var episodes = GetRecursiveChildren().OfType<Episode>(); - var series = Series; - - if (series != null && series.ContainsEpisodesWithoutSeasonFolders) - { - var seasonNumber = IndexNumber; - var list = episodes.ToList(); - - if (seasonNumber.HasValue) - { - list.AddRange(series.GetRecursiveChildren().OfType<Episode>() - .Where(i => i.ParentIndexNumber.HasValue && i.ParentIndexNumber.Value == seasonNumber.Value)); - } - else - { - list.AddRange(series.GetRecursiveChildren().OfType<Episode>() - .Where(i => !i.ParentIndexNumber.HasValue)); - } - - episodes = list.DistinctBy(i => i.Id); - } - - return episodes; + return Series.GetSeasonEpisodes(this, null, null); } public override IEnumerable<BaseItem> GetChildren(User user, bool includeLinkedChildren) diff --git a/MediaBrowser.Controller/Entities/TV/Series.cs b/MediaBrowser.Controller/Entities/TV/Series.cs index 4915cfedc..7e8ba0516 100644 --- a/MediaBrowser.Controller/Entities/TV/Series.cs +++ b/MediaBrowser.Controller/Entities/TV/Series.cs @@ -209,7 +209,6 @@ namespace MediaBrowser.Controller.Entities.TV var seriesKey = GetUniqueSeriesKey(this); - Logger.Debug("GetSeasons SeriesKey: {0}", seriesKey); var query = new InternalItemsQuery(user) { AncestorWithPresentationUniqueKey = seriesKey, @@ -267,7 +266,6 @@ namespace MediaBrowser.Controller.Entities.TV public IEnumerable<Episode> GetEpisodes(User user) { var seriesKey = GetUniqueSeriesKey(this); - Logger.Debug("GetEpisodes seriesKey: {0}", seriesKey); var query = new InternalItemsQuery(user) { @@ -291,8 +289,6 @@ namespace MediaBrowser.Controller.Entities.TV var allItems = LibraryManager.GetItemList(query).ToList(); - Logger.Debug("GetEpisodes return {0} items from database", allItems.Count); - var allSeriesEpisodes = allItems.OfType<Episode>().ToList(); var allEpisodes = allItems.OfType<Season>() @@ -373,27 +369,9 @@ namespace MediaBrowser.Controller.Entities.TV progress.Report(100); } - private IEnumerable<Episode> GetAllEpisodes(User user) - { - Logger.Debug("Series.GetAllEpisodes entering GetItemList"); - - var result = LibraryManager.GetItemList(new InternalItemsQuery(user) - { - AncestorWithPresentationUniqueKey = GetUniqueSeriesKey(this), - IncludeItemTypes = new[] { typeof(Episode).Name }, - SortBy = new[] { ItemSortBy.SortName } - - }).Cast<Episode>().ToList(); - - Logger.Debug("Series.GetAllEpisodes returning {0} episodes", result.Count); - - return result; - } - - public IEnumerable<Episode> GetSeasonEpisodes(User user, Season parentSeason) + public IEnumerable<Episode> GetSeasonEpisodes(Season parentSeason, User user) { var seriesKey = GetUniqueSeriesKey(this); - Logger.Debug("GetSeasonEpisodes seriesKey: {0}", seriesKey); var query = new InternalItemsQuery(user) { @@ -401,34 +379,35 @@ namespace MediaBrowser.Controller.Entities.TV IncludeItemTypes = new[] { typeof(Episode).Name }, SortBy = new[] { ItemSortBy.SortName } }; - var config = user.Configuration; - if (!config.DisplayMissingEpisodes && !config.DisplayUnairedEpisodes) + if (user != null) { - query.IsVirtualItem = false; - } - else if (!config.DisplayMissingEpisodes) - { - query.IsMissing = false; - } - else if (!config.DisplayUnairedEpisodes) - { - query.IsVirtualUnaired = false; + var config = user.Configuration; + if (!config.DisplayMissingEpisodes && !config.DisplayUnairedEpisodes) + { + query.IsVirtualItem = false; + } + else if (!config.DisplayMissingEpisodes) + { + query.IsMissing = false; + } + else if (!config.DisplayUnairedEpisodes) + { + query.IsVirtualUnaired = false; + } } var allItems = LibraryManager.GetItemList(query).OfType<Episode>(); - return GetSeasonEpisodes(user, parentSeason, allItems); + return GetSeasonEpisodes(parentSeason, user, allItems); } - public IEnumerable<Episode> GetSeasonEpisodes(User user, Season parentSeason, IEnumerable<Episode> allSeriesEpisodes) + public IEnumerable<Episode> GetSeasonEpisodes(Season parentSeason, User user, IEnumerable<Episode> allSeriesEpisodes) { if (allSeriesEpisodes == null) { - Logger.Debug("GetSeasonEpisodes allSeriesEpisodes is null"); - return GetSeasonEpisodes(user, parentSeason); + return GetSeasonEpisodes(parentSeason, user); } - Logger.Debug("GetSeasonEpisodes FilterEpisodesBySeason"); var episodes = FilterEpisodesBySeason(allSeriesEpisodes, parentSeason, ConfigurationManager.Configuration.DisplaySpecialsWithinSeasons); var sortBy = (parentSeason.IndexNumber ?? -1) == 0 ? ItemSortBy.SortName : ItemSortBy.AiredEpisodeOrder; diff --git a/MediaBrowser.Controller/Entities/Trailer.cs b/MediaBrowser.Controller/Entities/Trailer.cs index 306ce35ec..7a987a68e 100644 --- a/MediaBrowser.Controller/Entities/Trailer.cs +++ b/MediaBrowser.Controller/Entities/Trailer.cs @@ -64,7 +64,7 @@ namespace MediaBrowser.Controller.Entities info.IsLocalTrailer = TrailerTypes.Contains(TrailerType.LocalTrailer); - if (!IsInMixedFolder) + if (!IsInMixedFolder && LocationType == LocationType.FileSystem) { info.Name = System.IO.Path.GetFileName(ContainingFolderPath); } diff --git a/MediaBrowser.Controller/IServerApplicationHost.cs b/MediaBrowser.Controller/IServerApplicationHost.cs index f4c0e7658..d6744e804 100644 --- a/MediaBrowser.Controller/IServerApplicationHost.cs +++ b/MediaBrowser.Controller/IServerApplicationHost.cs @@ -89,5 +89,7 @@ namespace MediaBrowser.Controller string GetLocalApiUrl(IPAddress ipAddress); void LaunchUrl(string url); + + void EnableLoopback(string appName); } } diff --git a/MediaBrowser.Controller/Library/ILibraryManager.cs b/MediaBrowser.Controller/Library/ILibraryManager.cs index 0862e3eaf..04268bcea 100644 --- a/MediaBrowser.Controller/Library/ILibraryManager.cs +++ b/MediaBrowser.Controller/Library/ILibraryManager.cs @@ -566,5 +566,8 @@ namespace MediaBrowser.Controller.Library QueryResult<Tuple<BaseItem, ItemCounts>> GetArtists(InternalItemsQuery query); QueryResult<Tuple<BaseItem, ItemCounts>> GetAlbumArtists(InternalItemsQuery query); QueryResult<Tuple<BaseItem, ItemCounts>> GetAllArtists(InternalItemsQuery query); + + void RegisterIgnoredPath(string path); + void UnRegisterIgnoredPath(string path); } }
\ No newline at end of file diff --git a/MediaBrowser.Controller/Library/NameExtensions.cs b/MediaBrowser.Controller/Library/NameExtensions.cs index 6973dce64..72f036b0a 100644 --- a/MediaBrowser.Controller/Library/NameExtensions.cs +++ b/MediaBrowser.Controller/Library/NameExtensions.cs @@ -54,7 +54,7 @@ namespace MediaBrowser.Controller.Library } } - class TextComparer : IComparer<string>, IEqualityComparer<string> + public class DistinctNameComparer : IComparer<string>, IEqualityComparer<string> { public int Compare(string x, string y) { @@ -63,7 +63,7 @@ namespace MediaBrowser.Controller.Library return 0; } - return string.Compare(x, y, CultureInfo.InvariantCulture, CompareOptions.IgnoreCase | CompareOptions.IgnoreNonSpace); + return string.Compare(x.RemoveDiacritics(), y.RemoveDiacritics(), StringComparison.OrdinalIgnoreCase); } public bool Equals(string x, string y) diff --git a/MediaBrowser.Controller/LiveTv/IHasRegistrationInfo.cs b/MediaBrowser.Controller/LiveTv/IHasRegistrationInfo.cs deleted file mode 100644 index 3626c18e5..000000000 --- a/MediaBrowser.Controller/LiveTv/IHasRegistrationInfo.cs +++ /dev/null @@ -1,15 +0,0 @@ -using MediaBrowser.Model.Entities; -using System.Threading.Tasks; - -namespace MediaBrowser.Controller.LiveTv -{ - public interface IHasRegistrationInfo - { - /// <summary> - /// Gets the registration information. - /// </summary> - /// <param name="feature">The feature.</param> - /// <returns>Task<MBRegistrationRecord>.</returns> - Task<MBRegistrationRecord> GetRegistrationInfo(string feature); - } -} diff --git a/MediaBrowser.Controller/LiveTv/ILiveTvManager.cs b/MediaBrowser.Controller/LiveTv/ILiveTvManager.cs index ed64127c3..a8e42749b 100644 --- a/MediaBrowser.Controller/LiveTv/ILiveTvManager.cs +++ b/MediaBrowser.Controller/LiveTv/ILiveTvManager.cs @@ -108,6 +108,7 @@ namespace MediaBrowser.Controller.LiveTv /// <param name="cancellationToken">The cancellation token.</param> /// <returns>QueryResult{RecordingInfoDto}.</returns> Task<QueryResult<BaseItemDto>> GetRecordings(RecordingQuery query, DtoOptions options, CancellationToken cancellationToken); + Task<QueryResult<BaseItemDto>> GetRecordingSeries(RecordingQuery query, DtoOptions options, CancellationToken cancellationToken); /// <summary> /// Gets the timers. @@ -364,11 +365,9 @@ namespace MediaBrowser.Controller.LiveTv /// <summary> /// Gets the registration information. /// </summary> - /// <param name="channelId">The channel identifier.</param> - /// <param name="programId">The program identifier.</param> /// <param name="feature">The feature.</param> /// <returns>Task<MBRegistrationRecord>.</returns> - Task<MBRegistrationRecord> GetRegistrationInfo(string channelId, string programId, string feature); + Task<MBRegistrationRecord> GetRegistrationInfo(string feature); /// <summary> /// Adds the channel information. diff --git a/MediaBrowser.Controller/LiveTv/ProgramInfo.cs b/MediaBrowser.Controller/LiveTv/ProgramInfo.cs index a6a3e6108..ea5e6dbc6 100644 --- a/MediaBrowser.Controller/LiveTv/ProgramInfo.cs +++ b/MediaBrowser.Controller/LiveTv/ProgramInfo.cs @@ -1,6 +1,7 @@ using MediaBrowser.Model.LiveTv; using System; using System.Collections.Generic; +using MediaBrowser.Model.Entities; namespace MediaBrowser.Controller.LiveTv { @@ -66,6 +67,8 @@ namespace MediaBrowser.Controller.LiveTv /// <value><c>true</c> if this instance is hd; otherwise, <c>false</c>.</value> public bool? IsHD { get; set; } + public bool? Is3D { get; set; } + /// <summary> /// Gets or sets the audio. /// </summary> @@ -84,6 +87,8 @@ namespace MediaBrowser.Controller.LiveTv /// <value><c>true</c> if this instance is repeat; otherwise, <c>false</c>.</value> public bool IsRepeat { get; set; } + public bool IsSubjectToBlackout { get; set; } + /// <summary> /// Gets or sets the episode title. /// </summary> @@ -144,6 +149,8 @@ namespace MediaBrowser.Controller.LiveTv /// <value><c>true</c> if this instance is kids; otherwise, <c>false</c>.</value> public bool IsKids { get; set; } + public bool IsEducational { get; set; } + /// <summary> /// Gets or sets a value indicating whether this instance is premiere. /// </summary> diff --git a/MediaBrowser.Controller/MediaBrowser.Controller.csproj b/MediaBrowser.Controller/MediaBrowser.Controller.csproj index e7eaa1dc0..7cfd56c1e 100644 --- a/MediaBrowser.Controller/MediaBrowser.Controller.csproj +++ b/MediaBrowser.Controller/MediaBrowser.Controller.csproj @@ -98,6 +98,7 @@ <Compile Include="Collections\CollectionCreationOptions.cs" /> <Compile Include="Collections\CollectionEvents.cs" /> <Compile Include="Collections\ICollectionManager.cs" /> + <Compile Include="Collections\ManualCollectionsFolder.cs" /> <Compile Include="Connect\ConnectSupporterSummary.cs" /> <Compile Include="Connect\IConnectManager.cs" /> <Compile Include="Connect\UserLinkResult.cs" /> @@ -198,7 +199,6 @@ <Compile Include="Library\NameExtensions.cs" /> <Compile Include="Library\PlaybackStopEventArgs.cs" /> <Compile Include="Library\UserDataSaveEventArgs.cs" /> - <Compile Include="LiveTv\IHasRegistrationInfo.cs" /> <Compile Include="LiveTv\IListingsProvider.cs" /> <Compile Include="LiveTv\ITunerHost.cs" /> <Compile Include="LiveTv\RecordingGroup.cs" /> diff --git a/MediaBrowser.Controller/Providers/BaseItemXmlParser.cs b/MediaBrowser.Controller/Providers/BaseItemXmlParser.cs index c0912708c..fccbd9211 100644 --- a/MediaBrowser.Controller/Providers/BaseItemXmlParser.cs +++ b/MediaBrowser.Controller/Providers/BaseItemXmlParser.cs @@ -23,14 +23,18 @@ namespace MediaBrowser.Controller.Providers /// The logger /// </summary> protected ILogger Logger { get; private set; } + protected IProviderManager ProviderManager { get; private set; } + + private Dictionary<string, string> _validProviderIds; /// <summary> /// Initializes a new instance of the <see cref="BaseItemXmlParser{T}" /> class. /// </summary> /// <param name="logger">The logger.</param> - public BaseItemXmlParser(ILogger logger) + public BaseItemXmlParser(ILogger logger, IProviderManager providerManager) { Logger = logger; + ProviderManager = providerManager; } /// <summary> @@ -60,6 +64,22 @@ namespace MediaBrowser.Controller.Providers ValidationType = ValidationType.None }; + _validProviderIds = _validProviderIds = new Dictionary<string, string>(StringComparer.InvariantCultureIgnoreCase); + + var idInfos = ProviderManager.GetExternalIdInfos(item.Item); + + foreach (var info in idInfos) + { + var id = info.Key + "Id"; + if (!_validProviderIds.ContainsKey(id)) + { + _validProviderIds.Add(id, info.Key); + } + } + + //Additional Mappings + _validProviderIds.Add("IMDB", "Imdb"); + //Fetch(item, metadataFile, settings, Encoding.GetEncoding("ISO-8859-1"), cancellationToken); Fetch(item, metadataFile, settings, Encoding.UTF8, cancellationToken); } @@ -657,14 +677,6 @@ namespace MediaBrowser.Controller.Providers break; } - case "TvDbId": - var tvdbId = reader.ReadElementContentAsString(); - if (!string.IsNullOrWhiteSpace(tvdbId)) - { - item.SetProviderId(MetadataProviders.Tvdb, tvdbId); - } - break; - case "VoteCount": { var val = reader.ReadElementContentAsString(); @@ -679,95 +691,7 @@ namespace MediaBrowser.Controller.Providers } break; } - case "MusicBrainzAlbumId": - { - var mbz = reader.ReadElementContentAsString(); - if (!string.IsNullOrWhiteSpace(mbz)) - { - item.SetProviderId(MetadataProviders.MusicBrainzAlbum, mbz); - } - break; - } - case "MusicBrainzAlbumArtistId": - { - var mbz = reader.ReadElementContentAsString(); - if (!string.IsNullOrWhiteSpace(mbz)) - { - item.SetProviderId(MetadataProviders.MusicBrainzAlbumArtist, mbz); - } - break; - } - case "MusicBrainzArtistId": - { - var mbz = reader.ReadElementContentAsString(); - if (!string.IsNullOrWhiteSpace(mbz)) - { - item.SetProviderId(MetadataProviders.MusicBrainzArtist, mbz); - } - break; - } - case "MusicBrainzReleaseGroupId": - { - var mbz = reader.ReadElementContentAsString(); - if (!string.IsNullOrWhiteSpace(mbz)) - { - item.SetProviderId(MetadataProviders.MusicBrainzReleaseGroup, mbz); - } - break; - } - case "TVRageId": - { - var id = reader.ReadElementContentAsString(); - if (!string.IsNullOrWhiteSpace(id)) - { - item.SetProviderId(MetadataProviders.TvRage, id); - } - break; - } - case "TvMazeId": - { - var id = reader.ReadElementContentAsString(); - if (!string.IsNullOrWhiteSpace(id)) - { - item.SetProviderId(MetadataProviders.TvMaze, id); - } - break; - } - case "AudioDbArtistId": - { - var id = reader.ReadElementContentAsString(); - if (!string.IsNullOrWhiteSpace(id)) - { - item.SetProviderId(MetadataProviders.AudioDbArtist, id); - } - break; - } - case "AudioDbAlbumId": - { - var id = reader.ReadElementContentAsString(); - if (!string.IsNullOrWhiteSpace(id)) - { - item.SetProviderId(MetadataProviders.AudioDbAlbum, id); - } - break; - } - case "RottenTomatoesId": - var rtId = reader.ReadElementContentAsString(); - if (!string.IsNullOrWhiteSpace(rtId)) - { - item.SetProviderId(MetadataProviders.RottenTomatoes, rtId); - } - break; - - case "TMDbId": - var tmdb = reader.ReadElementContentAsString(); - if (!string.IsNullOrWhiteSpace(tmdb)) - { - item.SetProviderId(MetadataProviders.Tmdb, tmdb); - } - break; - - case "TMDbCollectionId": + case "CollectionNumber": var tmdbCollection = reader.ReadElementContentAsString(); if (!string.IsNullOrWhiteSpace(tmdbCollection)) { @@ -775,30 +699,6 @@ namespace MediaBrowser.Controller.Providers } break; - case "TVcomId": - var TVcomId = reader.ReadElementContentAsString(); - if (!string.IsNullOrWhiteSpace(TVcomId)) - { - item.SetProviderId(MetadataProviders.Tvcom, TVcomId); - } - break; - - case "Zap2ItId": - var zap2ItId = reader.ReadElementContentAsString(); - if (!string.IsNullOrWhiteSpace(zap2ItId)) - { - item.SetProviderId(MetadataProviders.Zap2It, zap2ItId); - } - break; - - case "IMDB": - var imDbId = reader.ReadElementContentAsString(); - if (!string.IsNullOrWhiteSpace(imDbId)) - { - item.SetProviderId(MetadataProviders.Imdb, imDbId); - } - break; - case "Genres": { using (var subtree = reader.ReadSubtree()) @@ -890,8 +790,25 @@ namespace MediaBrowser.Controller.Providers } default: - reader.Skip(); - break; + { + string readerName = reader.Name; + string providerIdValue; + if (_validProviderIds.TryGetValue(readerName, out providerIdValue)) + { + var id = reader.ReadElementContentAsString(); + if (!string.IsNullOrWhiteSpace(id)) + { + item.SetProviderId(providerIdValue, id); + } + } + else + { + reader.Skip(); + } + + break; + + } } } |
