diff options
| author | Luke Pulverenti <luke.pulverenti@gmail.com> | 2014-02-07 17:40:03 -0500 |
|---|---|---|
| committer | Luke Pulverenti <luke.pulverenti@gmail.com> | 2014-02-07 17:40:03 -0500 |
| commit | 12757d094b4998be8b56fc51e5199358d819d0da (patch) | |
| tree | 84357422ed918761d2be3e60bce92d978aab805b /MediaBrowser.Controller | |
| parent | 76658f07977a5857c752dc1266b66f881b454f48 (diff) | |
use music brainz values from audio files with bottom up refresh
Diffstat (limited to 'MediaBrowser.Controller')
| -rw-r--r-- | MediaBrowser.Controller/Entities/Audio/MusicAlbum.cs | 11 | ||||
| -rw-r--r-- | MediaBrowser.Controller/Entities/Audio/MusicArtist.cs | 27 | ||||
| -rw-r--r-- | MediaBrowser.Controller/Entities/Audio/MusicGenre.cs | 25 | ||||
| -rw-r--r-- | MediaBrowser.Controller/Entities/BaseItem.cs | 11 | ||||
| -rw-r--r-- | MediaBrowser.Controller/Entities/GameGenre.cs | 26 | ||||
| -rw-r--r-- | MediaBrowser.Controller/Entities/Genre.cs | 25 | ||||
| -rw-r--r-- | MediaBrowser.Controller/Entities/Person.cs | 31 | ||||
| -rw-r--r-- | MediaBrowser.Controller/Entities/Studio.cs | 25 | ||||
| -rw-r--r-- | MediaBrowser.Controller/Entities/User.cs | 30 | ||||
| -rw-r--r-- | MediaBrowser.Controller/Entities/Year.cs | 25 | ||||
| -rw-r--r-- | MediaBrowser.Controller/LiveTv/LiveTvAudioRecording.cs | 25 | ||||
| -rw-r--r-- | MediaBrowser.Controller/LiveTv/LiveTvChannel.cs | 25 | ||||
| -rw-r--r-- | MediaBrowser.Controller/LiveTv/LiveTvProgram.cs | 25 | ||||
| -rw-r--r-- | MediaBrowser.Controller/LiveTv/LiveTvVideoRecording.cs | 25 | ||||
| -rw-r--r-- | MediaBrowser.Controller/Providers/BaseItemXmlParser.cs | 22 | ||||
| -rw-r--r-- | MediaBrowser.Controller/Providers/ILocalImageProvider.cs | 2 |
16 files changed, 348 insertions, 12 deletions
diff --git a/MediaBrowser.Controller/Entities/Audio/MusicAlbum.cs b/MediaBrowser.Controller/Entities/Audio/MusicAlbum.cs index 6dda902c9..8b8c1a6ff 100644 --- a/MediaBrowser.Controller/Entities/Audio/MusicAlbum.cs +++ b/MediaBrowser.Controller/Entities/Audio/MusicAlbum.cs @@ -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)) { diff --git a/MediaBrowser.Controller/Entities/Audio/MusicArtist.cs b/MediaBrowser.Controller/Entities/Audio/MusicArtist.cs index 570a011c2..e80aaa69a 100644 --- a/MediaBrowser.Controller/Entities/Audio/MusicArtist.cs +++ b/MediaBrowser.Controller/Entities/Audio/MusicArtist.cs @@ -90,13 +90,38 @@ namespace MediaBrowser.Controller.Entities.Audio } /// <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> /// <param name="item">The item.</param> /// <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)) { diff --git a/MediaBrowser.Controller/Entities/Audio/MusicGenre.cs b/MediaBrowser.Controller/Entities/Audio/MusicGenre.cs index b54e14f2d..5e1d4c3c9 100644 --- a/MediaBrowser.Controller/Entities/Audio/MusicGenre.cs +++ b/MediaBrowser.Controller/Entities/Audio/MusicGenre.cs @@ -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; + } + } } } diff --git a/MediaBrowser.Controller/Entities/BaseItem.cs b/MediaBrowser.Controller/Entities/BaseItem.cs index 35691a080..01e8741af 100644 --- a/MediaBrowser.Controller/Entities/BaseItem.cs +++ b/MediaBrowser.Controller/Entities/BaseItem.cs @@ -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) diff --git a/MediaBrowser.Controller/Entities/GameGenre.cs b/MediaBrowser.Controller/Entities/GameGenre.cs index ffe62ba03..3a3c575cd 100644 --- a/MediaBrowser.Controller/Entities/GameGenre.cs +++ b/MediaBrowser.Controller/Entities/GameGenre.cs @@ -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; + } + } } } diff --git a/MediaBrowser.Controller/Entities/Genre.cs b/MediaBrowser.Controller/Entities/Genre.cs index 53bc64194..c15ca0aa2 100644 --- a/MediaBrowser.Controller/Entities/Genre.cs +++ b/MediaBrowser.Controller/Entities/Genre.cs @@ -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; + } + } } } diff --git a/MediaBrowser.Controller/Entities/Person.cs b/MediaBrowser.Controller/Entities/Person.cs index acf750870..c1dc81136 100644 --- a/MediaBrowser.Controller/Entities/Person.cs +++ b/MediaBrowser.Controller/Entities/Person.cs @@ -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; + } } } diff --git a/MediaBrowser.Controller/Entities/Studio.cs b/MediaBrowser.Controller/Entities/Studio.cs index 7bc17549f..5c3946f9b 100644 --- a/MediaBrowser.Controller/Entities/Studio.cs +++ b/MediaBrowser.Controller/Entities/Studio.cs @@ -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; + } + } } } diff --git a/MediaBrowser.Controller/Entities/User.cs b/MediaBrowser.Controller/Entities/User.cs index ddaa0eb26..66ef8c7dc 100644 --- a/MediaBrowser.Controller/Entities/User.cs +++ b/MediaBrowser.Controller/Entities/User.cs @@ -73,6 +73,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> private UserRootFolder _rootFolder; @@ -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> diff --git a/MediaBrowser.Controller/Entities/Year.cs b/MediaBrowser.Controller/Entities/Year.cs index cd50a1c60..c6ca028ae 100644 --- a/MediaBrowser.Controller/Entities/Year.cs +++ b/MediaBrowser.Controller/Entities/Year.cs @@ -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; + } + } } } diff --git a/MediaBrowser.Controller/LiveTv/LiveTvAudioRecording.cs b/MediaBrowser.Controller/LiveTv/LiveTvAudioRecording.cs index 93de9d5c3..f093ef7cb 100644 --- a/MediaBrowser.Controller/LiveTv/LiveTvAudioRecording.cs +++ b/MediaBrowser.Controller/LiveTv/LiveTvAudioRecording.cs @@ -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 diff --git a/MediaBrowser.Controller/LiveTv/LiveTvChannel.cs b/MediaBrowser.Controller/LiveTv/LiveTvChannel.cs index f37e94714..583b90fd4 100644 --- a/MediaBrowser.Controller/LiveTv/LiveTvChannel.cs +++ b/MediaBrowser.Controller/LiveTv/LiveTvChannel.cs @@ -26,6 +26,31 @@ namespace MediaBrowser.Controller.LiveTv 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> /// <value>The number.</value> diff --git a/MediaBrowser.Controller/LiveTv/LiveTvProgram.cs b/MediaBrowser.Controller/LiveTv/LiveTvProgram.cs index 6a00607e4..497cfad67 100644 --- a/MediaBrowser.Controller/LiveTv/LiveTvProgram.cs +++ b/MediaBrowser.Controller/LiveTv/LiveTvProgram.cs @@ -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 diff --git a/MediaBrowser.Controller/LiveTv/LiveTvVideoRecording.cs b/MediaBrowser.Controller/LiveTv/LiveTvVideoRecording.cs index bc4ed5493..aad760cc9 100644 --- a/MediaBrowser.Controller/LiveTv/LiveTvVideoRecording.cs +++ b/MediaBrowser.Controller/LiveTv/LiveTvVideoRecording.cs @@ -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"; diff --git a/MediaBrowser.Controller/Providers/BaseItemXmlParser.cs b/MediaBrowser.Controller/Providers/BaseItemXmlParser.cs index 76530d7dd..dbb8c1edf 100644 --- a/MediaBrowser.Controller/Providers/BaseItemXmlParser.cs +++ b/MediaBrowser.Controller/Providers/BaseItemXmlParser.cs @@ -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; } diff --git a/MediaBrowser.Controller/Providers/ILocalImageProvider.cs b/MediaBrowser.Controller/Providers/ILocalImageProvider.cs index 69242d1e2..d1ef68ce2 100644 --- a/MediaBrowser.Controller/Providers/ILocalImageProvider.cs +++ b/MediaBrowser.Controller/Providers/ILocalImageProvider.cs @@ -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; } } |
