fixes #689 - Support grouping latest items

This commit is contained in:
Luke Pulverenti
2014-07-05 01:21:13 -04:00
parent ba720ba957
commit ed5bf546c1
14 changed files with 586 additions and 392 deletions

View File

@@ -14,11 +14,11 @@ namespace MediaBrowser.Controller.Entities.Audio
/// <summary>
/// Class Audio
/// </summary>
public class Audio : BaseItem,
IHasAlbumArtist,
IHasArtist,
IHasMusicGenres,
IHasLookupInfo<SongInfo>,
public class Audio : BaseItem,
IHasAlbumArtist,
IHasArtist,
IHasMusicGenres,
IHasLookupInfo<SongInfo>,
IHasTags,
IHasMediaSources
{
@@ -64,7 +64,15 @@ namespace MediaBrowser.Controller.Entities.Audio
{
get
{
return Parents.OfType<MusicAlbum>().FirstOrDefault() ?? new MusicAlbum { Name = "<Unknown>" };
return LatestItemsIndexContainer ?? new MusicAlbum { Name = "Unknown Album" };
}
}
public override Folder LatestItemsIndexContainer
{
get
{
return Parents.OfType<MusicAlbum>().FirstOrDefault();
}
}
@@ -204,7 +212,7 @@ namespace MediaBrowser.Controller.Entities.Audio
private static MediaSourceInfo GetVersionInfo(Audio i, bool enablePathSubstituion)
{
var locationType = i.LocationType;
var info = new MediaSourceInfo
{
Id = i.Id.ToString("N"),

View File

@@ -796,6 +796,12 @@ namespace MediaBrowser.Controller.Entities
get { return null; }
}
[IgnoreDataMember]
public virtual Folder LatestItemsIndexContainer
{
get { return null; }
}
/// <summary>
/// Gets the user data key.
/// </summary>

View File

@@ -95,6 +95,14 @@ namespace MediaBrowser.Controller.Entities.TV
}
}
public override Folder LatestItemsIndexContainer
{
get
{
return Series;
}
}
/// <summary>
/// Gets the user data key.
/// </summary>

View File

@@ -5,13 +5,13 @@ namespace MediaBrowser.Controller.Providers
{
public static class NameParser
{
static readonly Regex[] NameMatches = new[] {
static readonly Regex[] NameMatches =
{
new Regex(@"(?<name>.*)\((?<year>\d{4})\)"), // matches "My Movie (2001)" and gives us the name and the year
new Regex(@"(?<name>.*)(\.(?<year>\d{4})(\.|$)).*$"),
new Regex(@"(?<name>.*)") // last resort matches the whole string as the name
};
/// <summary>
/// Parses the name.
/// </summary>