diff options
| author | Luke Pulverenti <luke.pulverenti@gmail.com> | 2013-08-07 11:59:13 -0400 |
|---|---|---|
| committer | Luke Pulverenti <luke.pulverenti@gmail.com> | 2013-08-07 11:59:13 -0400 |
| commit | b1b4e77178922249b6e523e11110c76472c57bf1 (patch) | |
| tree | b1e9fd26462cffbe6ed3b78db3bed1faad9f3851 /MediaBrowser.Controller | |
| parent | b7f927d43a302975c81cb88ceec42a04f4c1c143 (diff) | |
reduced property virtualization
Diffstat (limited to 'MediaBrowser.Controller')
| -rw-r--r-- | MediaBrowser.Controller/Entities/Audio/MusicAlbum.cs | 54 | ||||
| -rw-r--r-- | MediaBrowser.Controller/Entities/BaseItem.cs | 8 | ||||
| -rw-r--r-- | MediaBrowser.Controller/Resolvers/EntityResolutionHelper.cs | 33 |
3 files changed, 22 insertions, 73 deletions
diff --git a/MediaBrowser.Controller/Entities/Audio/MusicAlbum.cs b/MediaBrowser.Controller/Entities/Audio/MusicAlbum.cs index 36cf995f5d..485afcaef9 100644 --- a/MediaBrowser.Controller/Entities/Audio/MusicAlbum.cs +++ b/MediaBrowser.Controller/Entities/Audio/MusicAlbum.cs @@ -57,24 +57,6 @@ namespace MediaBrowser.Controller.Entities.Audio /// <summary> /// Override to point to first child (song) /// </summary> - /// <value>The production year.</value> - public override int? ProductionYear - { - get - { - var child = Children.FirstOrDefault(); - - return child == null ? base.ProductionYear : child.ProductionYear; - } - set - { - base.ProductionYear = value; - } - } - - /// <summary> - /// Override to point to first child (song) - /// </summary> /// <value>The genres.</value> public override List<string> Genres { @@ -93,24 +75,6 @@ namespace MediaBrowser.Controller.Entities.Audio } /// <summary> - /// Override to point to first child (song) - /// </summary> - /// <value>The studios.</value> - public override List<string> Studios - { - get - { - var child = Children.FirstOrDefault(); - - return child == null ? base.Studios : child.Studios; - } - set - { - base.Studios = value; - } - } - - /// <summary> /// Gets or sets the images. /// </summary> /// <value>The images.</value> @@ -150,24 +114,6 @@ namespace MediaBrowser.Controller.Entities.Audio } /// <summary> - /// Gets or sets the name. - /// </summary> - /// <value>The name.</value> - public override string Name - { - get - { - var song = RecursiveChildren.OfType<Audio>().FirstOrDefault(i => !string.IsNullOrEmpty(i.Album)); - - return song == null ? base.Name : song.Album; - } - set - { - base.Name = value; - } - } - - /// <summary> /// Gets or sets the music brainz release group id. /// </summary> /// <value>The music brainz release group id.</value> diff --git a/MediaBrowser.Controller/Entities/BaseItem.cs b/MediaBrowser.Controller/Entities/BaseItem.cs index ab30d9ef73..d8dec46452 100644 --- a/MediaBrowser.Controller/Entities/BaseItem.cs +++ b/MediaBrowser.Controller/Entities/BaseItem.cs @@ -532,12 +532,12 @@ namespace MediaBrowser.Controller.Entities { get { return Genres; } } - + /// <summary> /// Gets or sets the studios. /// </summary> /// <value>The studios.</value> - public virtual List<string> Studios { get; set; } + public List<string> Studios { get; set; } /// <summary> /// Gets or sets the genres. @@ -613,7 +613,7 @@ namespace MediaBrowser.Controller.Entities /// Gets or sets the production year. /// </summary> /// <value>The production year.</value> - public virtual int? ProductionYear { get; set; } + public int? ProductionYear { get; set; } /// <summary> /// If the item is part of a series, this is it's number in the series. @@ -1022,7 +1022,7 @@ namespace MediaBrowser.Controller.Entities { rating = OfficialRatingForComparison; } - + if (string.IsNullOrEmpty(rating)) { return !user.Configuration.BlockNotRated; diff --git a/MediaBrowser.Controller/Resolvers/EntityResolutionHelper.cs b/MediaBrowser.Controller/Resolvers/EntityResolutionHelper.cs index 9564bf5a8c..db57544de7 100644 --- a/MediaBrowser.Controller/Resolvers/EntityResolutionHelper.cs +++ b/MediaBrowser.Controller/Resolvers/EntityResolutionHelper.cs @@ -70,20 +70,23 @@ namespace MediaBrowser.Controller.Resolvers /// <summary> /// The audio file extensions /// </summary> - private static readonly Dictionary<string,string> AudioFileExtensions = new[] { - ".mp3", - ".flac", - ".wma", - ".aac", - ".acc", - ".m4a", - ".m4b", - ".wav", - ".ape", - ".ogg", - ".oga" - - }.ToDictionary(i => i, StringComparer.OrdinalIgnoreCase); + public static readonly string[] AudioFileExtensions = new[] + { + ".mp3", + ".flac", + ".wma", + ".aac", + ".acc", + ".m4a", + ".m4b", + ".wav", + ".ape", + ".ogg", + ".oga" + + }; + + private static readonly Dictionary<string, string> AudioFileExtensionsDictionary = AudioFileExtensions.ToDictionary(i => i, StringComparer.OrdinalIgnoreCase); /// <summary> /// Determines whether [is audio file] [the specified args]. @@ -99,7 +102,7 @@ namespace MediaBrowser.Controller.Resolvers return false; } - return AudioFileExtensions.ContainsKey(extension); + return AudioFileExtensionsDictionary.ContainsKey(extension); } /// <summary> |
