update music brainz to fetch overview

This commit is contained in:
Luke Pulverenti 2016-10-08 14:51:07 -04:00
parent 5cd3276775
commit b3595eab6a
7 changed files with 78 additions and 20 deletions

View File

@ -435,7 +435,8 @@ namespace MediaBrowser.Model.Configuration
Limit = 0,
Type = ImageType.Disc
}
}
},
DisabledMetadataFetchers = new []{ "TheAudioDB" }
},
new MetadataOptions(1, 1280)
@ -473,7 +474,8 @@ namespace MediaBrowser.Model.Configuration
Limit = 0,
Type = ImageType.Logo
}
}
},
DisabledMetadataFetchers = new []{ "TheAudioDB" }
},
new MetadataOptions(1, 1280)

View File

@ -169,6 +169,8 @@ namespace MediaBrowser.Model.Dto
/// <value>The game system.</value>
public string GameSystem { get; set; }
public string[] ProductionLocations { get; set; }
/// <summary>
/// Gets or sets the critic rating summary.
/// </summary>

View File

@ -32,7 +32,8 @@ namespace MediaBrowser.Model.Providers
public string SearchProviderName { get; set; }
public string GameSystem { get; set; }
public string Overview { get; set; }
public RemoteSearchResult()
{
ProviderIds = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);

View File

@ -85,7 +85,8 @@ namespace MediaBrowser.Providers.Music
{
var result = new RemoteSearchResult
{
Name = i.Title
Name = i.Title,
ProductionYear = i.Year
};
if (!string.IsNullOrWhiteSpace(i.ReleaseId))
@ -94,7 +95,7 @@ namespace MediaBrowser.Providers.Music
}
if (!string.IsNullOrWhiteSpace(i.ReleaseGroupId))
{
result.SetProviderId(MetadataProviders.MusicBrainzAlbum, i.ReleaseGroupId);
result.SetProviderId(MetadataProviders.MusicBrainzReleaseGroup, i.ReleaseGroupId);
}
return result;
@ -117,16 +118,22 @@ namespace MediaBrowser.Providers.Music
var releaseResult = await GetReleaseResult(artistMusicBrainzId, id.GetAlbumArtist(), id.Name, cancellationToken).ConfigureAwait(false);
if (!string.IsNullOrEmpty(releaseResult.ReleaseId))
if (releaseResult != null)
{
releaseId = releaseResult.ReleaseId;
result.HasMetadata = true;
}
if (!string.IsNullOrEmpty(releaseResult.ReleaseId))
{
releaseId = releaseResult.ReleaseId;
result.HasMetadata = true;
}
if (!string.IsNullOrEmpty(releaseResult.ReleaseGroupId))
{
releaseGroupId = releaseResult.ReleaseGroupId;
result.HasMetadata = true;
if (!string.IsNullOrEmpty(releaseResult.ReleaseGroupId))
{
releaseGroupId = releaseResult.ReleaseGroupId;
result.HasMetadata = true;
}
result.Item.ProductionYear = releaseResult.Year;
result.Item.Overview = releaseResult.Overview;
}
}
@ -205,6 +212,8 @@ namespace MediaBrowser.Providers.Music
public string ReleaseId;
public string ReleaseGroupId;
public string Title;
public string Overview;
public int? Year;
public static List<ReleaseResult> Parse(XmlDocument doc, int? limit = null)
{
@ -237,7 +246,9 @@ namespace MediaBrowser.Providers.Music
{
ReleaseId = releaseId,
ReleaseGroupId = releaseGroupId,
Title = GetTitleFromReleaseNode(node)
Title = GetValueFromReleaseNode(node, "title"),
Overview = GetValueFromReleaseNode(node, "annotation"),
Year = GetYearFromReleaseNode(node, "date")
});
if (limit.HasValue && list.Count >= limit.Value)
@ -251,14 +262,37 @@ namespace MediaBrowser.Providers.Music
return list;
}
private static string GetTitleFromReleaseNode(XmlNode node)
private static int? GetYearFromReleaseNode(XmlNode node, string name)
{
var subNodes = node.ChildNodes;
if (subNodes != null)
{
foreach (var subNode in subNodes.Cast<XmlNode>())
{
if (string.Equals(subNode.Name, "title", StringComparison.OrdinalIgnoreCase))
if (string.Equals(subNode.Name, name, StringComparison.OrdinalIgnoreCase))
{
DateTime date;
if (DateTime.TryParse(subNode.InnerText, out date))
{
return date.Year;
}
return null;
}
}
}
return null;
}
private static string GetValueFromReleaseNode(XmlNode node, string name)
{
var subNodes = node.ChildNodes;
if (subNodes != null)
{
foreach (var subNode in subNodes.Cast<XmlNode>())
{
if (string.Equals(subNode.Name, name, StringComparison.OrdinalIgnoreCase))
{
return subNode.InnerText;
}

View File

@ -86,7 +86,7 @@ namespace MediaBrowser.Providers.Music
if (node.Attributes != null)
{
string name = null;
string overview = null;
string mbzId = node.Attributes["id"].Value;
foreach (var child in node.ChildNodes.Cast<XmlNode>())
@ -94,7 +94,10 @@ namespace MediaBrowser.Providers.Music
if (string.Equals(child.Name, "name", StringComparison.OrdinalIgnoreCase))
{
name = child.InnerText;
break;
}
if (string.Equals(child.Name, "annotation", StringComparison.OrdinalIgnoreCase))
{
overview = child.InnerText;
}
}
@ -102,7 +105,8 @@ namespace MediaBrowser.Providers.Music
{
var result = new RemoteSearchResult
{
Name = name
Name = name,
Overview = overview
};
result.SetProviderId(MetadataProviders.MusicBrainzArtist, mbzId);
@ -135,6 +139,7 @@ namespace MediaBrowser.Providers.Music
{
musicBrainzId = singleResult.GetProviderId(MetadataProviders.MusicBrainzArtist);
//result.Item.Name = singleResult.Name;
result.Item.Overview = singleResult.Overview;
}
}

View File

@ -1432,6 +1432,12 @@ namespace MediaBrowser.Server.Implementations.Dto
SetBookProperties(dto, book);
}
var movie = item as Movie;
if (movie != null)
{
dto.ProductionLocations = new string[] { };
}
var photo = item as Photo;
if (photo != null)
{

View File

@ -742,7 +742,15 @@ namespace MediaBrowser.Server.Implementations.Persistence
_saveItemCommand.GetParameter(index++).Value = item.Id;
_saveItemCommand.GetParameter(index++).Value = item.GetType().FullName;
_saveItemCommand.GetParameter(index++).Value = _jsonSerializer.SerializeToBytes(item, _memoryStreamProvider);
if (TypeRequiresDeserialization(item.GetType()))
{
_saveItemCommand.GetParameter(index++).Value = _jsonSerializer.SerializeToBytes(item, _memoryStreamProvider);
}
else
{
_saveItemCommand.GetParameter(index++).Value = null;
}
_saveItemCommand.GetParameter(index++).Value = item.Path;