diff --git a/MediaBrowser.XbmcMetadata/Savers/AlbumNfoSaver.cs b/MediaBrowser.XbmcMetadata/Savers/AlbumNfoSaver.cs index 83539bbf4..9122d3046 100644 --- a/MediaBrowser.XbmcMetadata/Savers/AlbumNfoSaver.cs +++ b/MediaBrowser.XbmcMetadata/Savers/AlbumNfoSaver.cs @@ -85,15 +85,15 @@ namespace MediaBrowser.XbmcMetadata.Savers } } - protected override List GetTagsUsed() + protected override List GetTagsUsed(IHasMetadata item) { - var list = new List + var list = base.GetTagsUsed(item); + list.AddRange(new string[] { - "track", - "artist", - "albumartist" - }; - + "track", + "artist", + "albumartist" + }); return list; } diff --git a/MediaBrowser.XbmcMetadata/Savers/ArtistNfoSaver.cs b/MediaBrowser.XbmcMetadata/Savers/ArtistNfoSaver.cs index 14a56c33a..38738470e 100644 --- a/MediaBrowser.XbmcMetadata/Savers/ArtistNfoSaver.cs +++ b/MediaBrowser.XbmcMetadata/Savers/ArtistNfoSaver.cs @@ -79,14 +79,14 @@ namespace MediaBrowser.XbmcMetadata.Savers } } - protected override List GetTagsUsed() + protected override List GetTagsUsed(IHasMetadata item) { - var list = new List + var list = base.GetTagsUsed(item); + list.AddRange(new string[] { - "album", - "disbanded" - }; - + "album", + "disbanded" + }); return list; } diff --git a/MediaBrowser.XbmcMetadata/Savers/BaseNfoSaver.cs b/MediaBrowser.XbmcMetadata/Savers/BaseNfoSaver.cs index 9d6d3f0ad..4f7715874 100644 --- a/MediaBrowser.XbmcMetadata/Savers/BaseNfoSaver.cs +++ b/MediaBrowser.XbmcMetadata/Savers/BaseNfoSaver.cs @@ -183,9 +183,18 @@ namespace MediaBrowser.XbmcMetadata.Savers /// true if [is enabled for] [the specified item]; otherwise, false. public abstract bool IsEnabledFor(IHasMetadata item, ItemUpdateType updateType); - protected virtual List GetTagsUsed() + protected virtual List GetTagsUsed(IHasMetadata item) { - return new List(); + var list = new List(); + foreach (var providerKey in item.ProviderIds.Keys) + { + var providerIdTagName = GetTagForProviderKey(providerKey); + if (!CommonTags.ContainsKey(providerIdTagName)) + { + list.Add(providerIdTagName); + } + } + return list; } public void Save(IHasMetadata item, CancellationToken cancellationToken) @@ -271,7 +280,7 @@ namespace MediaBrowser.XbmcMetadata.Savers AddMediaInfo(hasMediaSources, writer); } - var tagsUsed = GetTagsUsed(); + var tagsUsed = GetTagsUsed(item); try { @@ -834,7 +843,8 @@ namespace MediaBrowser.XbmcMetadata.Savers var providerId = item.ProviderIds[providerKey]; if (!string.IsNullOrEmpty(providerId) && !writtenProviderIds.Contains(providerKey)) { - writer.WriteElementString(providerKey.ToLower() + "id", providerId); + writer.WriteElementString(GetTagForProviderKey(providerKey), providerId); + writtenProviderIds.Add(providerKey); } } } @@ -1093,5 +1103,10 @@ namespace MediaBrowser.XbmcMetadata.Savers } } } + + private static string GetTagForProviderKey(string providerKey) + { + return providerKey.ToLower() + "id"; + } } } diff --git a/MediaBrowser.XbmcMetadata/Savers/EpisodeNfoSaver.cs b/MediaBrowser.XbmcMetadata/Savers/EpisodeNfoSaver.cs index 3346b43d3..e734b0640 100644 --- a/MediaBrowser.XbmcMetadata/Savers/EpisodeNfoSaver.cs +++ b/MediaBrowser.XbmcMetadata/Savers/EpisodeNfoSaver.cs @@ -108,24 +108,24 @@ namespace MediaBrowser.XbmcMetadata.Savers private static readonly CultureInfo UsCulture = new CultureInfo("en-US"); - protected override List GetTagsUsed() + protected override List GetTagsUsed(IHasMetadata item) { - var list = new List + var list = base.GetTagsUsed(item); + list.AddRange(new string[] { - "aired", - "season", - "episode", - "episodenumberend", - "airsafter_season", - "airsbefore_episode", - "airsbefore_season", - "DVD_episodenumber", - "DVD_season", - "absolute_number", - "displayseason", - "displayepisode" - }; - + "aired", + "season", + "episode", + "episodenumberend", + "airsafter_season", + "airsbefore_episode", + "airsbefore_season", + "DVD_episodenumber", + "DVD_season", + "absolute_number", + "displayseason", + "displayepisode" + }); return list; } diff --git a/MediaBrowser.XbmcMetadata/Savers/MovieNfoSaver.cs b/MediaBrowser.XbmcMetadata/Savers/MovieNfoSaver.cs index 3bd3a1555..cdada7446 100644 --- a/MediaBrowser.XbmcMetadata/Savers/MovieNfoSaver.cs +++ b/MediaBrowser.XbmcMetadata/Savers/MovieNfoSaver.cs @@ -113,16 +113,16 @@ namespace MediaBrowser.XbmcMetadata.Savers } } - protected override List GetTagsUsed() + protected override List GetTagsUsed(IHasMetadata item) { - var list = new List + var list = base.GetTagsUsed(item); + list.AddRange(new string[] { - "album", - "artist", - "set", - "id" - }; - + "album", + "artist", + "set", + "id" + }); return list; } diff --git a/MediaBrowser.XbmcMetadata/Savers/SeasonNfoSaver.cs b/MediaBrowser.XbmcMetadata/Savers/SeasonNfoSaver.cs index bbf4b5900..5c6b02360 100644 --- a/MediaBrowser.XbmcMetadata/Savers/SeasonNfoSaver.cs +++ b/MediaBrowser.XbmcMetadata/Savers/SeasonNfoSaver.cs @@ -51,11 +51,13 @@ namespace MediaBrowser.XbmcMetadata.Savers } } - protected override List GetTagsUsed() + protected override List GetTagsUsed(IHasMetadata item) { - var list = base.GetTagsUsed(); - - list.Add("seasonnumber"); + var list = base.GetTagsUsed(item); + list.AddRange(new string[] + { + "seasonnumber" + }); return list; } diff --git a/MediaBrowser.XbmcMetadata/Savers/SeriesNfoSaver.cs b/MediaBrowser.XbmcMetadata/Savers/SeriesNfoSaver.cs index b512939a7..9e48b0c8b 100644 --- a/MediaBrowser.XbmcMetadata/Savers/SeriesNfoSaver.cs +++ b/MediaBrowser.XbmcMetadata/Savers/SeriesNfoSaver.cs @@ -90,20 +90,20 @@ namespace MediaBrowser.XbmcMetadata.Savers } } - protected override List GetTagsUsed() + protected override List GetTagsUsed(IHasMetadata item) { - var list = new List + var list = base.GetTagsUsed(item); + list.AddRange(new string[] { - "id", - "episodeguide", - "season", - "episode", - "status", - "airs_time", - "airs_dayofweek", - "animeseriesindex" - }; - + "id", + "episodeguide", + "season", + "episode", + "status", + "airs_time", + "airs_dayofweek", + "animeseriesindex" + }); return list; }