support artists tag value

This commit is contained in:
Luke Pulverenti 2015-01-27 17:45:59 -05:00
parent b3127f19b5
commit 782fe92cf7
16 changed files with 94 additions and 57 deletions

View File

@ -208,17 +208,10 @@ namespace MediaBrowser.Api
if (album != null)
{
var songs = album.GetRecursiveChildren(i => i is Audio)
.Cast<Audio>()
.ToList();
result.SongCount = album.Tracks.Count();
result.SongCount = songs.Count;
result.Artists = songs.SelectMany(i => i.AllArtists)
.Distinct(StringComparer.OrdinalIgnoreCase)
.ToArray();
result.AlbumArtist = songs.SelectMany(i => i.AlbumArtists).FirstOrDefault(i => !string.IsNullOrEmpty(i));
result.Artists = album.Artists.ToArray();
result.AlbumArtist = album.AlbumArtists.FirstOrDefault();
}
var song = item as Audio;

View File

@ -5,7 +5,6 @@ using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.Net;
using MediaBrowser.Controller.Persistence;
using MediaBrowser.Model.Dto;
using MediaBrowser.Model.Querying;
using ServiceStack;
using System;

View File

@ -66,7 +66,7 @@ namespace MediaBrowser.Controller.Entities
{
var path = ContainingFolderPath;
var args = new ItemResolveArgs(ConfigurationManager.ApplicationPaths, LibraryManager, directoryService)
var args = new ItemResolveArgs(ConfigurationManager.ApplicationPaths , directoryService)
{
FileInfo = new DirectoryInfo(path),
Path = path,

View File

@ -54,12 +54,6 @@ namespace MediaBrowser.Controller.Entities.Audio
public List<string> AlbumArtists { get; set; }
[IgnoreDataMember]
public string AlbumArtist
{
get { return AlbumArtists.FirstOrDefault(); }
}
/// <summary>
/// Gets the tracks.
/// </summary>

View File

@ -86,7 +86,7 @@ namespace MediaBrowser.Controller.Entities
{
var path = ContainingFolderPath;
var args = new ItemResolveArgs(ConfigurationManager.ApplicationPaths, LibraryManager, directoryService)
var args = new ItemResolveArgs(ConfigurationManager.ApplicationPaths, directoryService)
{
FileInfo = new DirectoryInfo(path),
Path = path,

View File

@ -168,7 +168,7 @@ namespace MediaBrowser.Controller.Entities
}
// If only the casing is changing, leave the file system alone
if (!UsesIdForConfigurationPath && !newName.Equals(Name, StringComparison.OrdinalIgnoreCase))
if (!UsesIdForConfigurationPath && !string.Equals(newName, Name, StringComparison.OrdinalIgnoreCase))
{
UsesIdForConfigurationPath = true;

View File

@ -17,7 +17,6 @@ namespace MediaBrowser.Controller.Library
/// The _app paths
/// </summary>
private readonly IServerApplicationPaths _appPaths;
private readonly ILibraryManager _libraryManager;
public IDirectoryService DirectoryService { get; private set; }
@ -25,11 +24,10 @@ namespace MediaBrowser.Controller.Library
/// Initializes a new instance of the <see cref="ItemResolveArgs" /> class.
/// </summary>
/// <param name="appPaths">The app paths.</param>
/// <param name="libraryManager">The library manager.</param>
public ItemResolveArgs(IServerApplicationPaths appPaths, ILibraryManager libraryManager, IDirectoryService directoryService)
/// <param name="directoryService">The directory service.</param>
public ItemResolveArgs(IServerApplicationPaths appPaths, IDirectoryService directoryService)
{
_appPaths = appPaths;
_libraryManager = libraryManager;
DirectoryService = directoryService;
}
@ -136,18 +134,6 @@ namespace MediaBrowser.Controller.Library
}
}
/// <summary>
/// Gets a value indicating whether this instance is root.
/// </summary>
/// <value><c>true</c> if this instance is root; otherwise, <c>false</c>.</value>
public bool IsRoot
{
get
{
return Parent == null;
}
}
/// <summary>
/// Gets or sets the additional locations.
/// </summary>

View File

@ -40,6 +40,7 @@ namespace MediaBrowser.Model.Entities
NesBoxRom = 14,
TvRage = 15,
AudioDbArtist = 16,
AudioDbAlbum = 17
AudioDbAlbum = 17,
MusicBrainzTrack = 18
}
}

View File

@ -1,8 +1,15 @@

using System.Collections.Generic;
namespace MediaBrowser.Model.Sync
{
public class SyncJobCreationResult
{
public SyncJob Job { get; set; }
public List<SyncJobItem> JobItems { get; set; }
public SyncJobCreationResult()
{
JobItems = new List<SyncJobItem>();
}
}
}

View File

@ -1,6 +1,5 @@
using MediaBrowser.Common.Configuration;
using MediaBrowser.Common.IO;
using MediaBrowser.Common.Net;
using MediaBrowser.Controller.Configuration;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Entities.Audio;
@ -9,6 +8,7 @@ using MediaBrowser.Controller.Library;
using MediaBrowser.Model.Configuration;
using MediaBrowser.Model.Entities;
using MediaBrowser.Model.Logging;
using MediaBrowser.Model.Net;
using System;
using System.Collections.Generic;
using System.Globalization;
@ -16,7 +16,6 @@ using System.IO;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using MediaBrowser.Model.Net;
namespace MediaBrowser.Providers.Manager
{

View File

@ -187,8 +187,17 @@ namespace MediaBrowser.Providers.MediaInfo
audio.Album = FFProbeHelpers.GetDictionaryValue(tags, "album");
var artist = FFProbeHelpers.GetDictionaryValue(tags, "artist");
var artists = FFProbeHelpers.GetDictionaryValue(tags, "artists");
if (!string.IsNullOrWhiteSpace(artists))
{
audio.Artists = artists.Split(new[] { '/' }, StringSplitOptions.RemoveEmptyEntries)
.Distinct(StringComparer.OrdinalIgnoreCase)
.ToList();
}
else
{
var artist = FFProbeHelpers.GetDictionaryValue(tags, "artist");
if (string.IsNullOrWhiteSpace(artist))
{
audio.Artists.Clear();
@ -198,7 +207,7 @@ namespace MediaBrowser.Providers.MediaInfo
audio.Artists = SplitArtists(artist)
.Distinct(StringComparer.OrdinalIgnoreCase)
.ToList();
}
}
var albumArtist = FFProbeHelpers.GetDictionaryValue(tags, "albumartist") ?? FFProbeHelpers.GetDictionaryValue(tags, "album artist") ?? FFProbeHelpers.GetDictionaryValue(tags, "album_artist");
@ -250,10 +259,23 @@ namespace MediaBrowser.Providers.MediaInfo
FetchStudios(audio, tags, "publisher");
}
audio.SetProviderId(MetadataProviders.MusicBrainzAlbumArtist, FFProbeHelpers.GetDictionaryValue(tags, "MusicBrainz Album Artist Id"));
audio.SetProviderId(MetadataProviders.MusicBrainzArtist, FFProbeHelpers.GetDictionaryValue(tags, "MusicBrainz Artist Id"));
// These support mulitple values, but for now we only store the first.
audio.SetProviderId(MetadataProviders.MusicBrainzAlbumArtist, GetMultipleMusicBrainzId(FFProbeHelpers.GetDictionaryValue(tags, "MusicBrainz Album Artist Id")));
audio.SetProviderId(MetadataProviders.MusicBrainzArtist, GetMultipleMusicBrainzId(FFProbeHelpers.GetDictionaryValue(tags, "MusicBrainz Artist Id")));
audio.SetProviderId(MetadataProviders.MusicBrainzAlbum, FFProbeHelpers.GetDictionaryValue(tags, "MusicBrainz Album Id"));
audio.SetProviderId(MetadataProviders.MusicBrainzReleaseGroup, FFProbeHelpers.GetDictionaryValue(tags, "MusicBrainz Release Group Id"));
audio.SetProviderId(MetadataProviders.MusicBrainzTrack, FFProbeHelpers.GetDictionaryValue(tags, "MusicBrainz Release Track Id"));
}
private string GetMultipleMusicBrainzId(string value)
{
if (string.IsNullOrWhiteSpace(value))
{
return null;
}
return value.Split(new[] { '/' }, StringSplitOptions.RemoveEmptyEntries).FirstOrDefault();
}
private readonly char[] _nameDelimiters = { '/', '|', ';', '\\' };

View File

@ -118,4 +118,27 @@ namespace MediaBrowser.Providers.Music
return item is Audio || item is MusicAlbum;
}
}
public class MusicBrainzTrackId : IExternalId
{
public string Name
{
get { return "MusicBrainz Track"; }
}
public string Key
{
get { return MetadataProviders.MusicBrainzTrack.ToString(); }
}
public string UrlFormatString
{
get { return "http://musicbrainz.org/track/{0}"; }
}
public bool Supports(IHasProviderIds item)
{
return item is Audio;
}
}
}

View File

@ -13,7 +13,6 @@ using MediaBrowser.Controller.Providers;
using MediaBrowser.Controller.Resolvers;
using MediaBrowser.Controller.Sorting;
using MediaBrowser.Model.Configuration;
using MediaBrowser.Model.Dto;
using MediaBrowser.Model.Entities;
using MediaBrowser.Model.Logging;
using MediaBrowser.Naming.Audio;
@ -579,7 +578,7 @@ namespace MediaBrowser.Server.Implementations.Library
collectionType = GetContentTypeOverride(fullPath, true);
}
var args = new ItemResolveArgs(ConfigurationManager.ApplicationPaths, this, directoryService)
var args = new ItemResolveArgs(ConfigurationManager.ApplicationPaths, directoryService)
{
Parent = parent,
Path = fullPath,
@ -753,12 +752,14 @@ namespace MediaBrowser.Server.Implementations.Library
Directory.CreateDirectory(userRootPath);
_userRootFolder = GetItemById(GetNewItemId(userRootPath, typeof(UserRootFolder))) as UserRootFolder;
var tmpItem = GetItemById(GetNewItemId(userRootPath, typeof(UserRootFolder))) as UserRootFolder;
if (_userRootFolder == null)
if (tmpItem == null)
{
_userRootFolder = (UserRootFolder)ResolvePath(new DirectoryInfo(userRootPath));
tmpItem = (UserRootFolder)ResolvePath(new DirectoryInfo(userRootPath));
}
_userRootFolder = tmpItem;
}
}
}

View File

@ -1,4 +1,5 @@
using MediaBrowser.Common.IO;
using MediaBrowser.Controller;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.Resolvers;
@ -11,10 +12,12 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers
class SpecialFolderResolver : FolderResolver<Folder>
{
private readonly IFileSystem _fileSystem;
private readonly IServerApplicationPaths _appPaths;
public SpecialFolderResolver(IFileSystem fileSystem)
public SpecialFolderResolver(IFileSystem fileSystem, IServerApplicationPaths appPaths)
{
_fileSystem = fileSystem;
_appPaths = appPaths;
}
/// <summary>
@ -39,7 +42,7 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers
{
return new AggregateFolder();
}
if (args.IsRoot)
if (string.Equals(args.Path, _appPaths.DefaultUserViewsPath, StringComparison.OrdinalIgnoreCase))
{
return new UserRootFolder(); //if we got here and still a root - must be user root
}

View File

@ -72,6 +72,8 @@ namespace MediaBrowser.Server.Implementations.Sorting
private int CompareEpisodeToSpecial(Episode x, Episode y)
{
// http://thetvdb.com/wiki/index.php?title=Special_Episodes
var xSeason = x.PhysicalSeasonNumber ?? -1;
var ySeason = y.AirsAfterSeasonNumber ?? y.AirsBeforeSeasonNumber ?? -1;

View File

@ -158,9 +158,16 @@ namespace MediaBrowser.Server.Implementations.Sync
}, _logger);
}
jobItemsResult = _repo.GetJobItems(new SyncJobItemQuery
{
Statuses = new List<SyncJobItemStatus> { SyncJobItemStatus.Queued, SyncJobItemStatus.Converting },
JobId = jobId
});
return new SyncJobCreationResult
{
Job = GetJob(jobId)
Job = GetJob(jobId),
JobItems = jobItemsResult.Items.ToList()
};
}