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
.SelectMany(i =>
{
var list = i.Artists.ToList();
var list = new List<string>();
if (!string.IsNullOrEmpty(i.AlbumArtist))
{
list.Add(i.AlbumArtist);
}
if (!string.IsNullOrEmpty(i.Artist))
{
list.Add(i.Artist);
}
return list;
})

View File

@ -427,7 +427,7 @@ namespace MediaBrowser.Controller.Dto
{
dto.Album = audio.Album;
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.Linq;
using System.Runtime.Serialization;
namespace MediaBrowser.Controller.Entities.Audio
@ -53,7 +52,7 @@ namespace MediaBrowser.Controller.Entities.Audio
/// Gets or sets the artist.
/// </summary>
/// <value>The artist.</value>
public List<string> Artists { get; set; }
public string Artist { get; set; }
/// <summary>
/// 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>
/// Creates the name of the sort.
/// </summary>
/// <returns>System.String.</returns>
protected override string CreateSortName()
{
return (ProductionYear != null ? ProductionYear.Value.ToString("000-") : "")
+ (ParentIndexNumber != null ? ParentIndexNumber.Value.ToString("0000 - ") : "")
return (ParentIndexNumber != null ? ParentIndexNumber.Value.ToString("0000 - ") : "")
+ (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>
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;
}
}
/// <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();
indexFolders = songs.SelectMany(i => i.Artists)
.Distinct()
indexFolders = songs.Select(i => i.Artist ?? string.Empty)
.Distinct(StringComparer.OrdinalIgnoreCase)
.Select(i =>
{
try
@ -214,7 +214,7 @@ namespace MediaBrowser.Controller.Entities
})
.Where(i => i != null)
.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);
}

View File

@ -109,19 +109,7 @@ namespace MediaBrowser.Controller.Providers.MediaInfo
audio.Album = GetDictionaryValue(tags, "album");
var artists = GetDictionaryValue(tags, "artist");
if (!string.IsNullOrWhiteSpace(artists))
{
foreach (var artist in Split(artists))
{
var name = artist.Trim();
if (!string.IsNullOrEmpty(name))
{
audio.AddArtist(name);
}
}
}
audio.Artist = GetDictionaryValue(tags, "artist");
// Several different forms of albumartist
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.
/// </summary>
/// <value>The artist.</value>
public List<string> Artists { get; set; }
public string Artist { get; set; }
/// <summary>
/// Gets or sets the album.
@ -403,7 +403,7 @@ namespace MediaBrowser.Model.Dto
/// </summary>
/// <value>The revenue.</value>
public double? Revenue { get; set; }
/// <summary>
/// Gets a value indicating whether this instance can resume.
/// </summary>

View File

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

View File

@ -32,7 +32,12 @@ namespace MediaBrowser.Server.Implementations.Sorting
{
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>

View File

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

View File

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

View File

@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
<metadata>
<id>MediaBrowser.Common.Internal</id>
<version>3.0.80</version>
<version>3.0.81</version>
<title>MediaBrowser.Common.Internal</title>
<authors>Luke</authors>
<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>
<copyright>Copyright © Media Browser 2013</copyright>
<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="ServiceStack.Text" version="3.9.38" />
<dependency id="SimpleInjector" version="2.2.1" />

View File

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

View File

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