fixes around saving music brainz id's to xml

This commit is contained in:
Luke Pulverenti
2013-08-25 13:18:56 -04:00
parent 70844a3b34
commit 8d5c0cbe04
10 changed files with 63 additions and 48 deletions

View File

@@ -182,10 +182,13 @@ namespace MediaBrowser.Providers.Music
var releaseEntryId = item.GetProviderId(MetadataProviders.Musicbrainz);
var musicBrainzReleaseGroupId = album.GetProviderId(MetadataProviders.MusicBrainzReleaseGroup);
// Fanart uses the release group id so we'll have to get that now using the release entry id
if (string.IsNullOrEmpty(album.MusicBrainzReleaseGroupId))
if (string.IsNullOrEmpty(musicBrainzReleaseGroupId))
{
album.MusicBrainzReleaseGroupId = await GetReleaseGroupId(releaseEntryId, cancellationToken).ConfigureAwait(false);
musicBrainzReleaseGroupId = await GetReleaseGroupId(releaseEntryId, cancellationToken).ConfigureAwait(false);
album.SetProviderId(MetadataProviders.MusicBrainzReleaseGroup, musicBrainzReleaseGroupId);
}
var doc = new XmlDocument();
@@ -199,9 +202,9 @@ namespace MediaBrowser.Providers.Music
// Try try with the release entry Id, if that doesn't produce anything try the release group id
var node = doc.SelectSingleNode("//fanart/music/albums/album[@id=\"" + releaseEntryId + "\"]/cdart/@url");
if (node == null && !string.IsNullOrEmpty(album.MusicBrainzReleaseGroupId))
if (node == null && !string.IsNullOrEmpty(musicBrainzReleaseGroupId))
{
node = doc.SelectSingleNode("//fanart/music/albums/album[@id=\"" + album.MusicBrainzReleaseGroupId + "\"]/cdart/@url");
node = doc.SelectSingleNode("//fanart/music/albums/album[@id=\"" + musicBrainzReleaseGroupId + "\"]/cdart/@url");
}
var path = node != null ? node.Value : null;
@@ -218,9 +221,9 @@ namespace MediaBrowser.Providers.Music
// Try try with the release entry Id, if that doesn't produce anything try the release group id
var node = doc.SelectSingleNode("//fanart/music/albums/album[@id=\"" + releaseEntryId + "\"]/albumcover/@url");
if (node == null && !string.IsNullOrEmpty(album.MusicBrainzReleaseGroupId))
if (node == null && !string.IsNullOrEmpty(musicBrainzReleaseGroupId))
{
node = doc.SelectSingleNode("//fanart/music/albums/album[@id=\"" + album.MusicBrainzReleaseGroupId + "\"]/albumcover/@url");
node = doc.SelectSingleNode("//fanart/music/albums/album[@id=\"" + musicBrainzReleaseGroupId + "\"]/albumcover/@url");
}
var path = node != null ? node.Value : null;

View File

@@ -65,6 +65,7 @@ namespace MediaBrowser.Providers.Savers
"IMDbId",
"TMDbId",
"TVcomId",
"TvDbId",
"RottenTomatoesId",
"MusicbrainzId",
"TMDbCollectionId",
@@ -81,7 +82,8 @@ namespace MediaBrowser.Providers.Savers
"BirthDate",
"DeathDate",
"LockedFields",
"Chapters"
"Chapters",
"MusicBrainzReleaseGroupId"
});
var position = xml.ToString().LastIndexOf("</", StringComparison.OrdinalIgnoreCase);
@@ -332,6 +334,13 @@ namespace MediaBrowser.Providers.Savers
builder.Append("<MusicbrainzId>" + SecurityElement.Escape(mbz) + "</MusicbrainzId>");
}
mbz = item.GetProviderId(MetadataProviders.MusicBrainzReleaseGroup);
if (!string.IsNullOrEmpty(mbz))
{
builder.Append("<MusicBrainzReleaseGroupId>" + SecurityElement.Escape(mbz) + "</MusicBrainzReleaseGroupId>");
}
var gamesdb = item.GetProviderId(MetadataProviders.Gamesdb);
if (!string.IsNullOrEmpty(gamesdb))