use music brainz values from audio files with bottom up refresh

This commit is contained in:
Luke Pulverenti
2014-02-07 17:40:03 -05:00
parent 76658f0797
commit 12757d094b
37 changed files with 544 additions and 132 deletions

View File

@@ -22,6 +22,15 @@ namespace MediaBrowser.Controller.Entities.Audio
Tags = new List<string>();
}
[IgnoreDataMember]
public MusicArtist MusicArtist
{
get
{
return Parents.OfType<MusicArtist>().FirstOrDefault();
}
}
/// <summary>
/// Gets or sets the tags.
/// </summary>
@@ -99,7 +108,7 @@ namespace MediaBrowser.Controller.Entities.Audio
return "MusicAlbum-MusicBrainzReleaseGroup-" + id;
}
id = this.GetProviderId(MetadataProviders.Musicbrainz);
id = this.GetProviderId(MetadataProviders.MusicBrainzAlbum);
if (!string.IsNullOrEmpty(id))
{

View File

@@ -89,6 +89,31 @@ namespace MediaBrowser.Controller.Entities.Audio
return GetUserDataKey(this);
}
/// <summary>
/// Returns the folder containing the item.
/// If the item is a folder, it returns the folder itself
/// </summary>
/// <value>The containing folder path.</value>
public override string ContainingFolderPath
{
get
{
return Path;
}
}
/// <summary>
/// Gets a value indicating whether this instance is owned item.
/// </summary>
/// <value><c>true</c> if this instance is owned item; otherwise, <c>false</c>.</value>
public override bool IsOwnedItem
{
get
{
return false;
}
}
/// <summary>
/// Gets the user data key.
/// </summary>
@@ -96,7 +121,7 @@ namespace MediaBrowser.Controller.Entities.Audio
/// <returns>System.String.</returns>
private static string GetUserDataKey(MusicArtist item)
{
var id = item.GetProviderId(MetadataProviders.Musicbrainz);
var id = item.GetProviderId(MetadataProviders.MusicBrainzArtist);
if (!string.IsNullOrEmpty(id))
{

View File

@@ -26,5 +26,30 @@ namespace MediaBrowser.Controller.Entities.Audio
[IgnoreDataMember]
public List<ItemByNameCounts> UserItemCountList { get; set; }
/// <summary>
/// Returns the folder containing the item.
/// If the item is a folder, it returns the folder itself
/// </summary>
/// <value>The containing folder path.</value>
public override string ContainingFolderPath
{
get
{
return Path;
}
}
/// <summary>
/// Gets a value indicating whether this instance is owned item.
/// </summary>
/// <value><c>true</c> if this instance is owned item; otherwise, <c>false</c>.</value>
public override bool IsOwnedItem
{
get
{
return false;
}
}
}
}

View File

@@ -124,7 +124,7 @@ namespace MediaBrowser.Controller.Entities
}
[IgnoreDataMember]
public bool IsOwnedItem
public virtual bool IsOwnedItem
{
get
{
@@ -1215,7 +1215,12 @@ namespace MediaBrowser.Controller.Entities
currentFile.Delete();
}
return LibraryManager.UpdateItem(this, ItemUpdateType.ImageUpdate, CancellationToken.None);
return UpdateToRepository(ItemUpdateType.ImageUpdate, CancellationToken.None);
}
public virtual Task UpdateToRepository(ItemUpdateType updateReason, CancellationToken cancellationToken)
{
return LibraryManager.UpdateItem(this, ItemUpdateType.ImageUpdate, cancellationToken);
}
/// <summary>
@@ -1370,7 +1375,7 @@ namespace MediaBrowser.Controller.Entities
info1.DateModified = FileSystem.GetLastWriteTimeUtc(info1.Path);
info2.DateModified = FileSystem.GetLastWriteTimeUtc(info2.Path);
return LibraryManager.UpdateItem(this, ItemUpdateType.ImageUpdate, CancellationToken.None);
return UpdateToRepository(ItemUpdateType.ImageUpdate, CancellationToken.None);
}
public virtual bool IsPlayed(User user)

View File

@@ -1,5 +1,4 @@
using MediaBrowser.Model.Dto;
using System;
using System.Collections.Generic;
using System.Runtime.Serialization;
@@ -23,5 +22,30 @@ namespace MediaBrowser.Controller.Entities
[IgnoreDataMember]
public List<ItemByNameCounts> UserItemCountList { get; set; }
/// <summary>
/// Returns the folder containing the item.
/// If the item is a folder, it returns the folder itself
/// </summary>
/// <value>The containing folder path.</value>
public override string ContainingFolderPath
{
get
{
return Path;
}
}
/// <summary>
/// Gets a value indicating whether this instance is owned item.
/// </summary>
/// <value><c>true</c> if this instance is owned item; otherwise, <c>false</c>.</value>
public override bool IsOwnedItem
{
get
{
return false;
}
}
}
}

View File

@@ -25,5 +25,30 @@ namespace MediaBrowser.Controller.Entities
[IgnoreDataMember]
public List<ItemByNameCounts> UserItemCountList { get; set; }
/// <summary>
/// Returns the folder containing the item.
/// If the item is a folder, it returns the folder itself
/// </summary>
/// <value>The containing folder path.</value>
public override string ContainingFolderPath
{
get
{
return Path;
}
}
/// <summary>
/// Gets a value indicating whether this instance is owned item.
/// </summary>
/// <value><c>true</c> if this instance is owned item; otherwise, <c>false</c>.</value>
public override bool IsOwnedItem
{
get
{
return false;
}
}
}
}

View File

@@ -8,7 +8,7 @@ namespace MediaBrowser.Controller.Entities
/// <summary>
/// This is the full Person object that can be retrieved with all of it's data.
/// </summary>
public class Person : BaseItem, IItemByName, IHasLookupInfo<Providers.PersonLookupInfo>
public class Person : BaseItem, IItemByName, IHasLookupInfo<PersonLookupInfo>
{
public Person()
{
@@ -33,9 +33,34 @@ namespace MediaBrowser.Controller.Entities
return "Person-" + Name;
}
public Providers.PersonLookupInfo GetLookupInfo()
public PersonLookupInfo GetLookupInfo()
{
return GetItemLookupInfo<Providers.PersonLookupInfo>();
return GetItemLookupInfo<PersonLookupInfo>();
}
/// <summary>
/// Returns the folder containing the item.
/// If the item is a folder, it returns the folder itself
/// </summary>
/// <value>The containing folder path.</value>
public override string ContainingFolderPath
{
get
{
return Path;
}
}
/// <summary>
/// Gets a value indicating whether this instance is owned item.
/// </summary>
/// <value><c>true</c> if this instance is owned item; otherwise, <c>false</c>.</value>
public override bool IsOwnedItem
{
get
{
return false;
}
}
}

View File

@@ -26,5 +26,30 @@ namespace MediaBrowser.Controller.Entities
[IgnoreDataMember]
public List<ItemByNameCounts> UserItemCountList { get; set; }
/// <summary>
/// Returns the folder containing the item.
/// If the item is a folder, it returns the folder itself
/// </summary>
/// <value>The containing folder path.</value>
public override string ContainingFolderPath
{
get
{
return Path;
}
}
/// <summary>
/// Gets a value indicating whether this instance is owned item.
/// </summary>
/// <value><c>true</c> if this instance is owned item; otherwise, <c>false</c>.</value>
public override bool IsOwnedItem
{
get
{
return false;
}
}
}
}

View File

@@ -72,6 +72,31 @@ namespace MediaBrowser.Controller.Entities
}
}
/// <summary>
/// Returns the folder containing the item.
/// If the item is a folder, it returns the folder itself
/// </summary>
/// <value>The containing folder path.</value>
public override string ContainingFolderPath
{
get
{
return Path;
}
}
/// <summary>
/// Gets a value indicating whether this instance is owned item.
/// </summary>
/// <value><c>true</c> if this instance is owned item; otherwise, <c>false</c>.</value>
public override bool IsOwnedItem
{
get
{
return false;
}
}
/// <summary>
/// The _root folder
/// </summary>
@@ -222,6 +247,11 @@ namespace MediaBrowser.Controller.Entities
}, CancellationToken.None);
}
public override Task UpdateToRepository(ItemUpdateType updateReason, CancellationToken cancellationToken)
{
return UserManager.UpdateUser(this);
}
/// <summary>
/// Gets the path to the user's configuration directory
/// </summary>

View File

@@ -26,5 +26,30 @@ namespace MediaBrowser.Controller.Entities
{
return "Year-" + Name;
}
/// <summary>
/// Returns the folder containing the item.
/// If the item is a folder, it returns the folder itself
/// </summary>
/// <value>The containing folder path.</value>
public override string ContainingFolderPath
{
get
{
return Path;
}
}
/// <summary>
/// Gets a value indicating whether this instance is owned item.
/// </summary>
/// <value><c>true</c> if this instance is owned item; otherwise, <c>false</c>.</value>
public override bool IsOwnedItem
{
get
{
return false;
}
}
}
}

View File

@@ -25,6 +25,31 @@ namespace MediaBrowser.Controller.LiveTv
public string ServiceName { get; set; }
/// <summary>
/// Returns the folder containing the item.
/// If the item is a folder, it returns the folder itself
/// </summary>
/// <value>The containing folder path.</value>
public override string ContainingFolderPath
{
get
{
return Path;
}
}
/// <summary>
/// Gets a value indicating whether this instance is owned item.
/// </summary>
/// <value><c>true</c> if this instance is owned item; otherwise, <c>false</c>.</value>
public override bool IsOwnedItem
{
get
{
return false;
}
}
public override string MediaType
{
get

View File

@@ -25,6 +25,31 @@ namespace MediaBrowser.Controller.LiveTv
[IgnoreDataMember]
public List<ItemByNameCounts> UserItemCountList { get; set; }
/// <summary>
/// Returns the folder containing the item.
/// If the item is a folder, it returns the folder itself
/// </summary>
/// <value>The containing folder path.</value>
public override string ContainingFolderPath
{
get
{
return Path;
}
}
/// <summary>
/// Gets a value indicating whether this instance is owned item.
/// </summary>
/// <value><c>true</c> if this instance is owned item; otherwise, <c>false</c>.</value>
public override bool IsOwnedItem
{
get
{
return false;
}
}
/// <summary>
/// Gets or sets the number.
/// </summary>

View File

@@ -127,6 +127,31 @@ namespace MediaBrowser.Controller.LiveTv
/// <value><c>true</c> if this instance is premiere; otherwise, <c>false</c>.</value>
public bool IsPremiere { get; set; }
/// <summary>
/// Returns the folder containing the item.
/// If the item is a folder, it returns the folder itself
/// </summary>
/// <value>The containing folder path.</value>
public override string ContainingFolderPath
{
get
{
return Path;
}
}
/// <summary>
/// Gets a value indicating whether this instance is owned item.
/// </summary>
/// <value><c>true</c> if this instance is owned item; otherwise, <c>false</c>.</value>
public override bool IsOwnedItem
{
get
{
return false;
}
}
public override string MediaType
{
get

View File

@@ -46,6 +46,31 @@ namespace MediaBrowser.Controller.LiveTv
}
}
/// <summary>
/// Returns the folder containing the item.
/// If the item is a folder, it returns the folder itself
/// </summary>
/// <value>The containing folder path.</value>
public override string ContainingFolderPath
{
get
{
return Path;
}
}
/// <summary>
/// Gets a value indicating whether this instance is owned item.
/// </summary>
/// <value><c>true</c> if this instance is owned item; otherwise, <c>false</c>.</value>
public override bool IsOwnedItem
{
get
{
return false;
}
}
public override string GetClientTypeName()
{
return "Recording";

View File

@@ -680,12 +680,30 @@ namespace MediaBrowser.Controller.Providers
}
break;
}
case "MusicbrainzId":
case "MusicBrainzAlbumId":
{
var mbz = reader.ReadElementContentAsString();
if (!string.IsNullOrWhiteSpace(mbz))
{
item.SetProviderId(MetadataProviders.Musicbrainz, 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;
}

View File

@@ -22,7 +22,7 @@ namespace MediaBrowser.Controller.Providers
public class LocalImageInfo
{
public string Path { get; set; }
public FileInfo FileInfo { get; set; }
public ImageType Type { get; set; }
}