fixes around saving music brainz id's to xml
This commit is contained in:
parent
70844a3b34
commit
8d5c0cbe04
|
@ -273,13 +273,6 @@ namespace MediaBrowser.Api
|
|||
song.Artist = request.Artists[0];
|
||||
}
|
||||
|
||||
var musicAlbum = item as MusicAlbum;
|
||||
|
||||
if (musicAlbum != null)
|
||||
{
|
||||
musicAlbum.MusicBrainzReleaseGroupId = request.GetProviderId("MusicBrainzReleaseGroupId");
|
||||
}
|
||||
|
||||
var musicVideo = item as MusicVideo;
|
||||
|
||||
if (musicVideo != null)
|
||||
|
|
|
@ -90,6 +90,11 @@ namespace MediaBrowser.Controller.Dto
|
|||
}
|
||||
}
|
||||
|
||||
if (fields.Contains(ItemFields.DisplayPreferencesId))
|
||||
{
|
||||
dto.DisplayPreferencesId = item.DisplayPreferencesId.ToString("N");
|
||||
}
|
||||
|
||||
if (user != null)
|
||||
{
|
||||
AttachUserSpecificInfo(dto, item, user, fields);
|
||||
|
@ -272,11 +277,6 @@ namespace MediaBrowser.Controller.Dto
|
|||
/// <param name="fields">The fields.</param>
|
||||
private void AttachUserSpecificInfo(BaseItemDto dto, BaseItem item, User user, List<ItemFields> fields)
|
||||
{
|
||||
if (item.IsFolder && fields.Contains(ItemFields.DisplayPreferencesId))
|
||||
{
|
||||
dto.DisplayPreferencesId = ((Folder) item).DisplayPreferencesId.ToString("N");
|
||||
}
|
||||
|
||||
if (item.IsFolder)
|
||||
{
|
||||
var hasItemCounts = fields.Contains(ItemFields.ItemCounts);
|
||||
|
|
|
@ -91,11 +91,5 @@ namespace MediaBrowser.Controller.Entities.Audio
|
|||
{
|
||||
return RecursiveChildren.OfType<Audio>().Any(i => i.HasArtist(artist));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the music brainz release group id.
|
||||
/// </summary>
|
||||
/// <value>The music brainz release group id.</value>
|
||||
public string MusicBrainzReleaseGroupId { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
using MediaBrowser.Controller.Configuration;
|
||||
using MediaBrowser.Common.Extensions;
|
||||
using MediaBrowser.Controller.Configuration;
|
||||
using MediaBrowser.Controller.IO;
|
||||
using MediaBrowser.Controller.Library;
|
||||
using MediaBrowser.Controller.Localization;
|
||||
|
@ -83,6 +84,21 @@ namespace MediaBrowser.Controller.Entities
|
|||
/// <value>The id.</value>
|
||||
public Guid Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Return the id that should be used to key display prefs for this item.
|
||||
/// Default is based on the type for everything except actual generic folders.
|
||||
/// </summary>
|
||||
/// <value>The display prefs id.</value>
|
||||
[IgnoreDataMember]
|
||||
public virtual Guid DisplayPreferencesId
|
||||
{
|
||||
get
|
||||
{
|
||||
var thisType = GetType();
|
||||
return thisType == typeof(Folder) ? Id : thisType.FullName.GetMD5();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the path.
|
||||
/// </summary>
|
||||
|
|
|
@ -67,21 +67,6 @@ namespace MediaBrowser.Controller.Entities
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Return the id that should be used to key display prefs for this item.
|
||||
/// Default is based on the type for everything except actual generic folders.
|
||||
/// </summary>
|
||||
/// <value>The display prefs id.</value>
|
||||
[IgnoreDataMember]
|
||||
public virtual Guid DisplayPreferencesId
|
||||
{
|
||||
get
|
||||
{
|
||||
var thisType = GetType();
|
||||
return thisType == typeof(Folder) ? Id : thisType.FullName.GetMD5();
|
||||
}
|
||||
}
|
||||
|
||||
public virtual List<LinkedChild> LinkedChildren { get; set; }
|
||||
|
||||
protected virtual bool SupportsShortcutChildren
|
||||
|
|
|
@ -4,6 +4,7 @@ using System;
|
|||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using MoreLinq;
|
||||
|
||||
namespace MediaBrowser.Controller.IO
|
||||
{
|
||||
|
@ -38,7 +39,10 @@ namespace MediaBrowser.Controller.IO
|
|||
|
||||
if (!resolveShortcuts && flattenFolderDepth == 0)
|
||||
{
|
||||
return entries.ToDictionary(i => i.FullName, StringComparer.OrdinalIgnoreCase);
|
||||
// Seeing dupes on some users file system for some reason
|
||||
return entries
|
||||
.DistinctBy(i => i.FullName, StringComparer.OrdinalIgnoreCase)
|
||||
.ToDictionary(i => i.FullName, StringComparer.OrdinalIgnoreCase);
|
||||
}
|
||||
|
||||
var dict = new Dictionary<string, FileSystemInfo>(StringComparer.OrdinalIgnoreCase);
|
||||
|
|
|
@ -548,13 +548,23 @@ namespace MediaBrowser.Controller.Providers
|
|||
break;
|
||||
|
||||
case "MusicbrainzId":
|
||||
var mbz = reader.ReadElementContentAsString();
|
||||
if (!string.IsNullOrWhiteSpace(mbz))
|
||||
{
|
||||
item.SetProviderId(MetadataProviders.Musicbrainz, mbz);
|
||||
var mbz = reader.ReadElementContentAsString();
|
||||
if (!string.IsNullOrWhiteSpace(mbz))
|
||||
{
|
||||
item.SetProviderId(MetadataProviders.Musicbrainz, mbz);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case "MusicBrainzReleaseGroupId":
|
||||
{
|
||||
var mbz = reader.ReadElementContentAsString();
|
||||
if (!string.IsNullOrWhiteSpace(mbz))
|
||||
{
|
||||
item.SetProviderId(MetadataProviders.MusicBrainzReleaseGroup, mbz);
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case "RottenTomatoesId":
|
||||
var rtId = reader.ReadElementContentAsString();
|
||||
if (!string.IsNullOrWhiteSpace(rtId))
|
||||
|
|
|
@ -34,6 +34,7 @@ namespace MediaBrowser.Model.Entities
|
|||
/// <summary>
|
||||
/// Tmdb Collection Id
|
||||
/// </summary>
|
||||
TmdbCollection
|
||||
TmdbCollection,
|
||||
MusicBrainzReleaseGroup
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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))
|
||||
|
|
Loading…
Reference in New Issue
Block a user