reduce imported people

This commit is contained in:
Luke Pulverenti 2016-11-01 14:28:36 -04:00
parent 86de351e23
commit 3952360ce8
3 changed files with 45 additions and 21 deletions

View File

@ -781,24 +781,24 @@ namespace MediaBrowser.MediaEncoding.Probing
}
}
var conductor = FFProbeHelpers.GetDictionaryValue(tags, "conductor");
if (!string.IsNullOrWhiteSpace(conductor))
{
foreach (var person in Split(conductor, false))
{
audio.People.Add(new BaseItemPerson { Name = person, Type = PersonType.Conductor });
}
}
//var conductor = FFProbeHelpers.GetDictionaryValue(tags, "conductor");
//if (!string.IsNullOrWhiteSpace(conductor))
//{
// foreach (var person in Split(conductor, false))
// {
// audio.People.Add(new BaseItemPerson { Name = person, Type = PersonType.Conductor });
// }
//}
var lyricist = FFProbeHelpers.GetDictionaryValue(tags, "lyricist");
//var lyricist = FFProbeHelpers.GetDictionaryValue(tags, "lyricist");
//if (!string.IsNullOrWhiteSpace(lyricist))
//{
// foreach (var person in Split(lyricist, false))
// {
// audio.People.Add(new BaseItemPerson { Name = person, Type = PersonType.Lyricist });
// }
//}
if (!string.IsNullOrWhiteSpace(lyricist))
{
foreach (var person in Split(lyricist, false))
{
audio.People.Add(new BaseItemPerson { Name = person, Type = PersonType.Lyricist });
}
}
// Check for writer some music is tagged that way as alternative to composer/lyricist
var writer = FFProbeHelpers.GetDictionaryValue(tags, "writer");

View File

@ -26,16 +26,16 @@ namespace MediaBrowser.Providers.Movies
private readonly ILogger _logger;
private readonly IJsonSerializer _jsonSerializer;
private readonly ILibraryManager _libraryManager;
private readonly IFileSystem _fileSystem;
private readonly IFileSystem _fileSystem;
private readonly CultureInfo _usCulture = new CultureInfo("en-US");
public GenericMovieDbInfo(ILogger logger, IJsonSerializer jsonSerializer, ILibraryManager libraryManager, IFileSystem fileSystem)
public GenericMovieDbInfo(ILogger logger, IJsonSerializer jsonSerializer, ILibraryManager libraryManager, IFileSystem fileSystem)
{
_logger = logger;
_jsonSerializer = jsonSerializer;
_libraryManager = libraryManager;
_fileSystem = fileSystem;
_fileSystem = fileSystem;
}
public async Task<MetadataResult<T>> GetMetadata(ItemLookupInfo itemId, CancellationToken cancellationToken)
@ -271,6 +271,8 @@ namespace MediaBrowser.Providers.Movies
//and the rest from crew
if (movieData.casts != null && movieData.casts.crew != null)
{
var keepTypes = new[] { PersonType.Director, PersonType.Writer, PersonType.Producer };
foreach (var person in movieData.casts.crew)
{
// Normalize this
@ -280,6 +282,12 @@ namespace MediaBrowser.Providers.Movies
type = PersonType.Writer;
}
if (!keepTypes.Contains(type ?? string.Empty, StringComparer.OrdinalIgnoreCase) &&
!keepTypes.Contains(person.job ?? string.Empty, StringComparer.OrdinalIgnoreCase))
{
continue;
}
var personInfo = new PersonInfo
{
Name = person.name.Trim(),

View File

@ -1,4 +1,5 @@
using MediaBrowser.Model.IO;
using System;
using MediaBrowser.Model.IO;
using MediaBrowser.Common.Net;
using MediaBrowser.Controller.Configuration;
using MediaBrowser.Controller.Entities;
@ -166,9 +167,24 @@ namespace MediaBrowser.Providers.TV
//and the rest from crew
if (credits.crew != null)
{
var keepTypes = new[] { PersonType.Director, PersonType.Writer, PersonType.Producer };
foreach (var person in credits.crew)
{
result.AddPerson(new PersonInfo { Name = person.name.Trim(), Role = person.job, Type = person.department });
// Normalize this
var type = person.department;
if (string.Equals(type, "writing", StringComparison.OrdinalIgnoreCase))
{
type = PersonType.Writer;
}
if (!keepTypes.Contains(type ?? string.Empty, StringComparer.OrdinalIgnoreCase) &&
!keepTypes.Contains(person.job ?? string.Empty, StringComparer.OrdinalIgnoreCase))
{
continue;
}
result.AddPerson(new PersonInfo { Name = person.name.Trim(), Role = person.job, Type = type });
}
}
}