fixes #268 - (Multicd) Albums with discnumbers in subfolders on filesystem = Multiple album objects

This commit is contained in:
Luke Pulverenti 2013-05-12 10:06:08 -04:00
parent 734e53e937
commit 57d7e9fccc
6 changed files with 71 additions and 6 deletions

View File

@ -128,7 +128,12 @@ namespace MediaBrowser.Api
if (auth.ContainsKey("UserId")) if (auth.ContainsKey("UserId"))
{ {
user = UserManager.GetUserById(new Guid(auth["UserId"])); var userId = auth["UserId"];
if (!string.IsNullOrEmpty(userId))
{
user = UserManager.GetUserById(new Guid(userId));
}
} }
var deviceId = auth["DeviceId"]; var deviceId = auth["DeviceId"];

View File

@ -0,0 +1,25 @@

namespace MediaBrowser.Controller.Entities.Audio
{
/// <summary>
/// Class MusicAlbumDisc
/// </summary>
public class MusicAlbumDisc : Folder
{
/// <summary>
/// Gets or sets the display type of the media.
/// </summary>
/// <value>The display type of the media.</value>
public override string DisplayMediaType
{
get
{
return "Disc";
}
set
{
base.DisplayMediaType = value;
}
}
}
}

View File

@ -71,6 +71,7 @@
</Compile> </Compile>
<Compile Include="Configuration\IServerConfigurationManager.cs" /> <Compile Include="Configuration\IServerConfigurationManager.cs" />
<Compile Include="Dto\SessionInfoDtoBuilder.cs" /> <Compile Include="Dto\SessionInfoDtoBuilder.cs" />
<Compile Include="Entities\Audio\MusicAlbumDisc.cs" />
<Compile Include="Session\ISessionManager.cs" /> <Compile Include="Session\ISessionManager.cs" />
<Compile Include="Drawing\ImageExtensions.cs" /> <Compile Include="Drawing\ImageExtensions.cs" />
<Compile Include="Drawing\ImageHeader.cs" /> <Compile Include="Drawing\ImageHeader.cs" />

View File

@ -0,0 +1,33 @@
using MediaBrowser.Controller.Entities.Audio;
using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.Resolvers;
namespace MediaBrowser.Server.Implementations.Library.Resolvers.Audio
{
/// <summary>
/// Class MusicAlbumDiscResolver
/// </summary>
public class MusicAlbumDiscResolver : ItemResolver<MusicAlbumDisc>
{
/// <summary>
/// Gets the priority.
/// </summary>
/// <value>The priority.</value>
public override ResolverPriority Priority
{
get { return ResolverPriority.Third; } // we need to be ahead of the generic folder resolver but behind the movie one
}
/// <summary>
/// Resolves the specified args.
/// </summary>
/// <param name="args">The args.</param>
/// <returns>MusicAlbum.</returns>
protected override MusicAlbumDisc Resolve(ItemResolveArgs args)
{
if (!args.IsDirectory) return null;
return args.Parent is MusicAlbum ? new MusicAlbumDisc() : null;
}
}
}

View File

@ -1,10 +1,9 @@
using System.Collections.Generic; using MediaBrowser.Controller.Entities.Audio;
using System.IO;
using System.Linq;
using MediaBrowser.Controller.Entities.Audio;
using MediaBrowser.Controller.IO;
using MediaBrowser.Controller.Library; using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.Resolvers; using MediaBrowser.Controller.Resolvers;
using System.Collections.Generic;
using System.IO;
using System.Linq;
namespace MediaBrowser.Server.Implementations.Library.Resolvers.Audio namespace MediaBrowser.Server.Implementations.Library.Resolvers.Audio
{ {
@ -34,6 +33,7 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers.Audio
//Avoid mis-identifying top folders //Avoid mis-identifying top folders
if (args.Parent == null) return null; if (args.Parent == null) return null;
if (args.Parent.IsRoot) return null; if (args.Parent.IsRoot) return null;
if (args.Parent is MusicAlbum) return null;
return IsMusicAlbum(args) ? new MusicAlbum() : null; return IsMusicAlbum(args) ? new MusicAlbum() : null;
} }

View File

@ -129,6 +129,7 @@
<Compile Include="Library\LuceneSearchEngine.cs" /> <Compile Include="Library\LuceneSearchEngine.cs" />
<Compile Include="Library\ResolverHelper.cs" /> <Compile Include="Library\ResolverHelper.cs" />
<Compile Include="Library\Resolvers\Audio\AudioResolver.cs" /> <Compile Include="Library\Resolvers\Audio\AudioResolver.cs" />
<Compile Include="Library\Resolvers\Audio\MusicAlbumDiscResolver.cs" />
<Compile Include="Library\Resolvers\Audio\MusicAlbumResolver.cs" /> <Compile Include="Library\Resolvers\Audio\MusicAlbumResolver.cs" />
<Compile Include="Library\Resolvers\Audio\MusicArtistResolver.cs" /> <Compile Include="Library\Resolvers\Audio\MusicArtistResolver.cs" />
<Compile Include="Library\Resolvers\BaseItemResolver.cs" /> <Compile Include="Library\Resolvers\BaseItemResolver.cs" />