audio page progress

This commit is contained in:
Luke Pulverenti 2013-04-22 23:56:11 -04:00
parent 9553542875
commit 4a100452cf
14 changed files with 40 additions and 69 deletions

View File

@ -161,12 +161,16 @@ namespace MediaBrowser.Api.UserLibrary
return itemsList return itemsList
.SelectMany(i => .SelectMany(i =>
{ {
var list = i.Artists.ToList(); var list = new List<string>();
if (!string.IsNullOrEmpty(i.AlbumArtist)) if (!string.IsNullOrEmpty(i.AlbumArtist))
{ {
list.Add(i.AlbumArtist); list.Add(i.AlbumArtist);
} }
if (!string.IsNullOrEmpty(i.Artist))
{
list.Add(i.Artist);
}
return list; return list;
}) })

View File

@ -427,7 +427,7 @@ namespace MediaBrowser.Controller.Dto
{ {
dto.Album = audio.Album; dto.Album = audio.Album;
dto.AlbumArtist = audio.AlbumArtist; dto.AlbumArtist = audio.AlbumArtist;
dto.Artists = audio.Artists; dto.Artist = audio.Artist;
} }
} }

View File

@ -1,7 +1,6 @@
using MediaBrowser.Model.Entities; using System;
using System; using MediaBrowser.Model.Entities;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization; using System.Runtime.Serialization;
namespace MediaBrowser.Controller.Entities.Audio namespace MediaBrowser.Controller.Entities.Audio
@ -53,7 +52,7 @@ namespace MediaBrowser.Controller.Entities.Audio
/// Gets or sets the artist. /// Gets or sets the artist.
/// </summary> /// </summary>
/// <value>The artist.</value> /// <value>The artist.</value>
public List<string> Artists { get; set; } public string Artist { get; set; }
/// <summary> /// <summary>
/// Gets or sets the album. /// Gets or sets the album.
@ -78,40 +77,13 @@ namespace MediaBrowser.Controller.Entities.Audio
} }
} }
/// <summary>
/// Initializes a new instance of the <see cref="Audio"/> class.
/// </summary>
public Audio()
{
Artists = new List<string>();
}
/// <summary>
/// Adds the artist.
/// </summary>
/// <param name="name">The name.</param>
/// <exception cref="System.ArgumentNullException">name</exception>
public void AddArtist(string name)
{
if (string.IsNullOrWhiteSpace(name))
{
throw new ArgumentNullException("name");
}
if (!Artists.Contains(name, StringComparer.OrdinalIgnoreCase))
{
Artists.Add(name);
}
}
/// <summary> /// <summary>
/// Creates the name of the sort. /// Creates the name of the sort.
/// </summary> /// </summary>
/// <returns>System.String.</returns> /// <returns>System.String.</returns>
protected override string CreateSortName() protected override string CreateSortName()
{ {
return (ProductionYear != null ? ProductionYear.Value.ToString("000-") : "") return (ParentIndexNumber != null ? ParentIndexNumber.Value.ToString("0000 - ") : "")
+ (ParentIndexNumber != null ? ParentIndexNumber.Value.ToString("0000 - ") : "")
+ (IndexNumber != null ? IndexNumber.Value.ToString("0000 - ") : "") + Name; + (IndexNumber != null ? IndexNumber.Value.ToString("0000 - ") : "") + Name;
} }
@ -122,7 +94,7 @@ namespace MediaBrowser.Controller.Entities.Audio
/// <returns><c>true</c> if the specified name has artist; otherwise, <c>false</c>.</returns> /// <returns><c>true</c> if the specified name has artist; otherwise, <c>false</c>.</returns>
public bool HasArtist(string name) public bool HasArtist(string name)
{ {
return Artists.Contains(name, StringComparer.OrdinalIgnoreCase) || string.Equals(AlbumArtist, name, StringComparison.OrdinalIgnoreCase); return string.Equals(Artist, name, StringComparison.OrdinalIgnoreCase) || string.Equals(AlbumArtist, name, StringComparison.OrdinalIgnoreCase);
} }
} }
} }

View File

@ -139,14 +139,5 @@ namespace MediaBrowser.Controller.Entities.Audio
base.Images = value; base.Images = value;
} }
} }
/// <summary>
/// Creates the name of the sort.
/// </summary>
/// <returns>System.String.</returns>
protected override string CreateSortName()
{
return ProductionYear != null ? ProductionYear.Value.ToString("0000") : Name;
}
} }
} }

View File

@ -193,8 +193,8 @@ namespace MediaBrowser.Controller.Entities
{ {
var songs = recursiveChildren.OfType<Audio.Audio>().ToList(); var songs = recursiveChildren.OfType<Audio.Audio>().ToList();
indexFolders = songs.SelectMany(i => i.Artists) indexFolders = songs.Select(i => i.Artist ?? string.Empty)
.Distinct() .Distinct(StringComparer.OrdinalIgnoreCase)
.Select(i => .Select(i =>
{ {
try try
@ -214,7 +214,7 @@ namespace MediaBrowser.Controller.Entities
}) })
.Where(i => i != null) .Where(i => i != null)
.Select(a => new IndexFolder(us, a, .Select(a => new IndexFolder(us, a,
songs.Where(i => i.Artists.Contains(a.Name, StringComparer.OrdinalIgnoreCase) songs.Where(i => string.Equals(i.Artist, a.Name, StringComparison.OrdinalIgnoreCase)
), currentIndexName)).Concat(indexFolders); ), currentIndexName)).Concat(indexFolders);
} }

View File

@ -109,19 +109,7 @@ namespace MediaBrowser.Controller.Providers.MediaInfo
audio.Album = GetDictionaryValue(tags, "album"); audio.Album = GetDictionaryValue(tags, "album");
var artists = GetDictionaryValue(tags, "artist"); audio.Artist = GetDictionaryValue(tags, "artist");
if (!string.IsNullOrWhiteSpace(artists))
{
foreach (var artist in Split(artists))
{
var name = artist.Trim();
if (!string.IsNullOrEmpty(name))
{
audio.AddArtist(name);
}
}
}
// Several different forms of albumartist // Several different forms of albumartist
audio.AlbumArtist = GetDictionaryValue(tags, "albumartist") ?? GetDictionaryValue(tags, "album artist") ?? GetDictionaryValue(tags, "album_artist"); audio.AlbumArtist = GetDictionaryValue(tags, "albumartist") ?? GetDictionaryValue(tags, "album artist") ?? GetDictionaryValue(tags, "album_artist");

View File

@ -268,7 +268,7 @@ namespace MediaBrowser.Model.Dto
/// Gets or sets the artist. /// Gets or sets the artist.
/// </summary> /// </summary>
/// <value>The artist.</value> /// <value>The artist.</value>
public List<string> Artists { get; set; } public string Artist { get; set; }
/// <summary> /// <summary>
/// Gets or sets the album. /// Gets or sets the album.

View File

@ -788,12 +788,16 @@ namespace MediaBrowser.Server.Implementations.Library
.OfType<Audio>() .OfType<Audio>()
.SelectMany(c => .SelectMany(c =>
{ {
var list = c.Artists.ToList(); var list = new List<string>();
if (!string.IsNullOrEmpty(c.AlbumArtist)) if (!string.IsNullOrEmpty(c.AlbumArtist))
{ {
list.Add(c.AlbumArtist); list.Add(c.AlbumArtist);
} }
if (!string.IsNullOrEmpty(c.Artist))
{
list.Add(c.Artist);
}
return list; return list;
}) })

View File

@ -32,7 +32,12 @@ namespace MediaBrowser.Server.Implementations.Sorting
{ {
var audio = x as Audio; var audio = x as Audio;
return audio == null ? string.Empty : audio.Artists.OrderBy(i => i).FirstOrDefault() ?? string.Empty; if (audio == null)
{
return string.Empty;
}
return audio.Artist ?? string.Empty;
} }
/// <summary> /// <summary>

View File

@ -485,6 +485,7 @@ namespace MediaBrowser.WebDashboard.Api
"pluginupdatespage.js", "pluginupdatespage.js",
"scheduledtaskpage.js", "scheduledtaskpage.js",
"scheduledtaskspage.js", "scheduledtaskspage.js",
"songs.js",
"supporterkeypage.js", "supporterkeypage.js",
"supporterpage.js", "supporterpage.js",
"tvgenres.js", "tvgenres.js",

View File

@ -246,6 +246,9 @@
<Content Include="dashboard-ui\musicrecommended.html"> <Content Include="dashboard-ui\musicrecommended.html">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content> </Content>
<Content Include="dashboard-ui\songs.html">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="dashboard-ui\playlist.html"> <Content Include="dashboard-ui\playlist.html">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content> </Content>
@ -297,6 +300,9 @@
<Content Include="dashboard-ui\scripts\musicgenres.js"> <Content Include="dashboard-ui\scripts\musicgenres.js">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content> </Content>
<Content Include="dashboard-ui\scripts\songs.js">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="dashboard-ui\scripts\playlist.js"> <Content Include="dashboard-ui\scripts\playlist.js">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content> </Content>

View File

@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd"> <package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
<metadata> <metadata>
<id>MediaBrowser.Common.Internal</id> <id>MediaBrowser.Common.Internal</id>
<version>3.0.80</version> <version>3.0.81</version>
<title>MediaBrowser.Common.Internal</title> <title>MediaBrowser.Common.Internal</title>
<authors>Luke</authors> <authors>Luke</authors>
<owners>ebr,Luke,scottisafool</owners> <owners>ebr,Luke,scottisafool</owners>
@ -12,7 +12,7 @@
<description>Contains common components shared by Media Browser Theatre and Media Browser Server. Not intended for plugin developer consumption.</description> <description>Contains common components shared by Media Browser Theatre and Media Browser Server. Not intended for plugin developer consumption.</description>
<copyright>Copyright © Media Browser 2013</copyright> <copyright>Copyright © Media Browser 2013</copyright>
<dependencies> <dependencies>
<dependency id="MediaBrowser.Common" version="3.0.80" /> <dependency id="MediaBrowser.Common" version="3.0.81" />
<dependency id="NLog" version="2.0.1.2" /> <dependency id="NLog" version="2.0.1.2" />
<dependency id="ServiceStack.Text" version="3.9.38" /> <dependency id="ServiceStack.Text" version="3.9.38" />
<dependency id="SimpleInjector" version="2.2.1" /> <dependency id="SimpleInjector" version="2.2.1" />

View File

@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd"> <package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata> <metadata>
<id>MediaBrowser.Common</id> <id>MediaBrowser.Common</id>
<version>3.0.80</version> <version>3.0.81</version>
<title>MediaBrowser.Common</title> <title>MediaBrowser.Common</title>
<authors>Media Browser Team</authors> <authors>Media Browser Team</authors>
<owners>ebr,Luke,scottisafool</owners> <owners>ebr,Luke,scottisafool</owners>

View File

@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd"> <package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata> <metadata>
<id>MediaBrowser.Server.Core</id> <id>MediaBrowser.Server.Core</id>
<version>3.0.80</version> <version>3.0.81</version>
<title>Media Browser.Server.Core</title> <title>Media Browser.Server.Core</title>
<authors>Media Browser Team</authors> <authors>Media Browser Team</authors>
<owners>ebr,Luke,scottisafool</owners> <owners>ebr,Luke,scottisafool</owners>
@ -12,7 +12,7 @@
<description>Contains core components required to build plugins for Media Browser Server.</description> <description>Contains core components required to build plugins for Media Browser Server.</description>
<copyright>Copyright © Media Browser 2013</copyright> <copyright>Copyright © Media Browser 2013</copyright>
<dependencies> <dependencies>
<dependency id="MediaBrowser.Common" version="3.0.80" /> <dependency id="MediaBrowser.Common" version="3.0.81" />
</dependencies> </dependencies>
</metadata> </metadata>
<files> <files>