support artists tag value

pull/702/head
Luke Pulverenti 10 years ago
parent b3127f19b5
commit 782fe92cf7

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

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

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

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

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

@ -168,7 +168,7 @@ namespace MediaBrowser.Controller.Entities
} }
// If only the casing is changing, leave the file system alone // 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; UsesIdForConfigurationPath = true;

@ -17,7 +17,6 @@ namespace MediaBrowser.Controller.Library
/// The _app paths /// The _app paths
/// </summary> /// </summary>
private readonly IServerApplicationPaths _appPaths; private readonly IServerApplicationPaths _appPaths;
private readonly ILibraryManager _libraryManager;
public IDirectoryService DirectoryService { get; private set; } public IDirectoryService DirectoryService { get; private set; }
@ -25,11 +24,10 @@ namespace MediaBrowser.Controller.Library
/// Initializes a new instance of the <see cref="ItemResolveArgs" /> class. /// Initializes a new instance of the <see cref="ItemResolveArgs" /> class.
/// </summary> /// </summary>
/// <param name="appPaths">The app paths.</param> /// <param name="appPaths">The app paths.</param>
/// <param name="libraryManager">The library manager.</param> /// <param name="directoryService">The directory service.</param>
public ItemResolveArgs(IServerApplicationPaths appPaths, ILibraryManager libraryManager, IDirectoryService directoryService) public ItemResolveArgs(IServerApplicationPaths appPaths, IDirectoryService directoryService)
{ {
_appPaths = appPaths; _appPaths = appPaths;
_libraryManager = libraryManager;
DirectoryService = directoryService; 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> /// <summary>
/// Gets or sets the additional locations. /// Gets or sets the additional locations.
/// </summary> /// </summary>

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

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

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

@ -187,18 +187,27 @@ namespace MediaBrowser.Providers.MediaInfo
audio.Album = FFProbeHelpers.GetDictionaryValue(tags, "album"); audio.Album = FFProbeHelpers.GetDictionaryValue(tags, "album");
var artist = FFProbeHelpers.GetDictionaryValue(tags, "artist"); var artists = FFProbeHelpers.GetDictionaryValue(tags, "artists");
if (string.IsNullOrWhiteSpace(artist)) if (!string.IsNullOrWhiteSpace(artists))
{ {
audio.Artists.Clear(); audio.Artists = artists.Split(new[] { '/' }, StringSplitOptions.RemoveEmptyEntries)
.Distinct(StringComparer.OrdinalIgnoreCase)
.ToList();
} }
else else
{ {
audio.Artists = SplitArtists(artist) var artist = FFProbeHelpers.GetDictionaryValue(tags, "artist");
.Distinct(StringComparer.OrdinalIgnoreCase) if (string.IsNullOrWhiteSpace(artist))
.ToList(); {
audio.Artists.Clear();
}
else
{
audio.Artists = SplitArtists(artist)
.Distinct(StringComparer.OrdinalIgnoreCase)
.ToList();
}
} }
var albumArtist = FFProbeHelpers.GetDictionaryValue(tags, "albumartist") ?? FFProbeHelpers.GetDictionaryValue(tags, "album artist") ?? FFProbeHelpers.GetDictionaryValue(tags, "album_artist"); 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"); FetchStudios(audio, tags, "publisher");
} }
audio.SetProviderId(MetadataProviders.MusicBrainzAlbumArtist, FFProbeHelpers.GetDictionaryValue(tags, "MusicBrainz Album Artist Id")); // These support mulitple values, but for now we only store the first.
audio.SetProviderId(MetadataProviders.MusicBrainzArtist, FFProbeHelpers.GetDictionaryValue(tags, "MusicBrainz Artist Id")); 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.MusicBrainzAlbum, FFProbeHelpers.GetDictionaryValue(tags, "MusicBrainz Album Id"));
audio.SetProviderId(MetadataProviders.MusicBrainzReleaseGroup, FFProbeHelpers.GetDictionaryValue(tags, "MusicBrainz Release Group 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 = { '/', '|', ';', '\\' }; private readonly char[] _nameDelimiters = { '/', '|', ';', '\\' };

@ -118,4 +118,27 @@ namespace MediaBrowser.Providers.Music
return item is Audio || item is MusicAlbum; 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;
}
}
} }

@ -13,7 +13,6 @@ using MediaBrowser.Controller.Providers;
using MediaBrowser.Controller.Resolvers; using MediaBrowser.Controller.Resolvers;
using MediaBrowser.Controller.Sorting; using MediaBrowser.Controller.Sorting;
using MediaBrowser.Model.Configuration; using MediaBrowser.Model.Configuration;
using MediaBrowser.Model.Dto;
using MediaBrowser.Model.Entities; using MediaBrowser.Model.Entities;
using MediaBrowser.Model.Logging; using MediaBrowser.Model.Logging;
using MediaBrowser.Naming.Audio; using MediaBrowser.Naming.Audio;
@ -579,7 +578,7 @@ namespace MediaBrowser.Server.Implementations.Library
collectionType = GetContentTypeOverride(fullPath, true); collectionType = GetContentTypeOverride(fullPath, true);
} }
var args = new ItemResolveArgs(ConfigurationManager.ApplicationPaths, this, directoryService) var args = new ItemResolveArgs(ConfigurationManager.ApplicationPaths, directoryService)
{ {
Parent = parent, Parent = parent,
Path = fullPath, Path = fullPath,
@ -753,12 +752,14 @@ namespace MediaBrowser.Server.Implementations.Library
Directory.CreateDirectory(userRootPath); 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;
} }
} }
} }

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

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

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

Loading…
Cancel
Save