reduced property virtualization

This commit is contained in:
Luke Pulverenti
2013-08-07 11:59:13 -04:00
parent b7f927d43a
commit b1b4e77178
5 changed files with 148 additions and 72 deletions

View File

@@ -54,24 +54,6 @@ namespace MediaBrowser.Controller.Entities.Audio
get { return Parent as MusicArtist ?? UnknwonArtist; }
}
/// <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>
@@ -92,24 +74,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>
@@ -149,24 +113,6 @@ namespace MediaBrowser.Controller.Entities.Audio
return RecursiveChildren.OfType<Audio>().Any(i => i.HasArtist(artist));
}
/// <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>

View File

@@ -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;

View File

@@ -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"
public static readonly string[] AudioFileExtensions = new[]
{
".mp3",
".flac",
".wma",
".aac",
".acc",
".m4a",
".m4b",
".wav",
".ape",
".ogg",
".oga"
}.ToDictionary(i => i, StringComparer.OrdinalIgnoreCase);
};
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>