mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-07-09 03:04:24 -04:00
fixes #206 - Adding roles, deleting actors, changing names - not being picked up
This commit is contained in:
parent
b443d591a2
commit
c2c081c8e4
@ -31,6 +31,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
Studios = new List<string>();
|
||||
People = new List<PersonInfo>();
|
||||
CriticReviews = new List<ItemReview>();
|
||||
Taglines = new List<string>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -880,10 +881,10 @@ namespace MediaBrowser.Controller.Entities
|
||||
OfficialRating = null;
|
||||
CustomRating = null;
|
||||
Overview = null;
|
||||
Taglines = null;
|
||||
Taglines.Clear();
|
||||
Language = null;
|
||||
Studios = null;
|
||||
Genres = null;
|
||||
Studios.Clear();
|
||||
Genres.Clear();
|
||||
CommunityRating = null;
|
||||
RunTimeTicks = null;
|
||||
AspectRatio = null;
|
||||
@ -1052,24 +1053,6 @@ namespace MediaBrowser.Controller.Entities
|
||||
return (DateTime.UtcNow - DateCreated).TotalDays < ConfigurationManager.Configuration.RecentItemDays;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds people to the item
|
||||
/// </summary>
|
||||
/// <param name="people">The people.</param>
|
||||
/// <exception cref="System.ArgumentNullException"></exception>
|
||||
public void AddPeople(IEnumerable<PersonInfo> people)
|
||||
{
|
||||
if (people == null)
|
||||
{
|
||||
throw new ArgumentNullException();
|
||||
}
|
||||
|
||||
foreach (var person in people)
|
||||
{
|
||||
AddPerson(person);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds a person to the item
|
||||
/// </summary>
|
||||
@ -1087,12 +1070,6 @@ namespace MediaBrowser.Controller.Entities
|
||||
throw new ArgumentNullException();
|
||||
}
|
||||
|
||||
if (People == null)
|
||||
{
|
||||
People = new List<PersonInfo> { person };
|
||||
return;
|
||||
}
|
||||
|
||||
// If the type is GuestStar and there's already an Actor entry, then update it to avoid dupes
|
||||
if (string.Equals(person.Type, PersonType.GuestStar, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
@ -1123,24 +1100,6 @@ namespace MediaBrowser.Controller.Entities
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds studios to the item
|
||||
/// </summary>
|
||||
/// <param name="studios">The studios.</param>
|
||||
/// <exception cref="System.ArgumentNullException"></exception>
|
||||
public void AddStudios(IEnumerable<string> studios)
|
||||
{
|
||||
if (studios == null)
|
||||
{
|
||||
throw new ArgumentNullException();
|
||||
}
|
||||
|
||||
foreach (var name in studios)
|
||||
{
|
||||
AddStudio(name);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds a studio to the item
|
||||
/// </summary>
|
||||
@ -1153,11 +1112,6 @@ namespace MediaBrowser.Controller.Entities
|
||||
throw new ArgumentNullException("name");
|
||||
}
|
||||
|
||||
if (Studios == null)
|
||||
{
|
||||
Studios = new List<string>();
|
||||
}
|
||||
|
||||
if (!Studios.Contains(name, StringComparer.OrdinalIgnoreCase))
|
||||
{
|
||||
Studios.Add(name);
|
||||
@ -1176,11 +1130,6 @@ namespace MediaBrowser.Controller.Entities
|
||||
throw new ArgumentNullException("name");
|
||||
}
|
||||
|
||||
if (Taglines == null)
|
||||
{
|
||||
Taglines = new List<string>();
|
||||
}
|
||||
|
||||
if (!Taglines.Contains(name, StringComparer.OrdinalIgnoreCase))
|
||||
{
|
||||
Taglines.Add(name);
|
||||
@ -1222,11 +1171,6 @@ namespace MediaBrowser.Controller.Entities
|
||||
throw new ArgumentNullException("name");
|
||||
}
|
||||
|
||||
if (Genres == null)
|
||||
{
|
||||
Genres = new List<string>();
|
||||
}
|
||||
|
||||
if (!Genres.Contains(name, StringComparer.OrdinalIgnoreCase))
|
||||
{
|
||||
Genres.Add(name);
|
||||
@ -1256,24 +1200,6 @@ namespace MediaBrowser.Controller.Entities
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds genres to the item
|
||||
/// </summary>
|
||||
/// <param name="genres">The genres.</param>
|
||||
/// <exception cref="System.ArgumentNullException"></exception>
|
||||
public void AddGenres(IEnumerable<string> genres)
|
||||
{
|
||||
if (genres == null)
|
||||
{
|
||||
throw new ArgumentNullException();
|
||||
}
|
||||
|
||||
foreach (var name in genres)
|
||||
{
|
||||
AddGenre(name);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Marks the item as either played or unplayed
|
||||
/// </summary>
|
||||
|
@ -58,6 +58,11 @@ namespace MediaBrowser.Controller.Providers
|
||||
ValidationType = ValidationType.None
|
||||
};
|
||||
|
||||
item.Taglines.Clear();
|
||||
item.Studios.Clear();
|
||||
item.Genres.Clear();
|
||||
item.People.Clear();
|
||||
|
||||
// Use XmlReader for best performance
|
||||
using (var reader = XmlReader.Create(metadataFile, settings))
|
||||
{
|
||||
@ -496,7 +501,10 @@ namespace MediaBrowser.Controller.Providers
|
||||
{
|
||||
case "Person":
|
||||
{
|
||||
item.AddPeople(GetPersonsFromXmlNode(reader.ReadSubtree()));
|
||||
foreach (var person in GetPersonsFromXmlNode(reader.ReadSubtree()))
|
||||
{
|
||||
item.AddPerson(person);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -171,7 +171,12 @@ namespace MediaBrowser.Controller.Providers.MediaInfo
|
||||
val.Split(new[] {'/', '|'}, StringSplitOptions.RemoveEmptyEntries)
|
||||
.Where(i => !string.Equals(i, audio.Artist, StringComparison.OrdinalIgnoreCase) && !string.Equals(i, audio.AlbumArtist, StringComparison.OrdinalIgnoreCase));
|
||||
|
||||
audio.AddStudios(studios);
|
||||
audio.Studios.Clear();
|
||||
|
||||
foreach (var studio in studios)
|
||||
{
|
||||
audio.AddStudio(studio);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -186,7 +191,12 @@ namespace MediaBrowser.Controller.Providers.MediaInfo
|
||||
|
||||
if (!string.IsNullOrEmpty(val))
|
||||
{
|
||||
audio.AddGenres(val.Split(new[] { '/', '|' }, StringSplitOptions.RemoveEmptyEntries));
|
||||
audio.Genres.Clear();
|
||||
|
||||
foreach (var genre in val.Split(new[] { '/', '|' }, StringSplitOptions.RemoveEmptyEntries))
|
||||
{
|
||||
audio.AddGenre(genre);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -909,7 +909,12 @@ namespace MediaBrowser.Controller.Providers.Movies
|
||||
movie.Budget = movieData.budget;
|
||||
movie.Revenue = movieData.revenue;
|
||||
|
||||
if (!string.IsNullOrEmpty(movieData.tagline)) movie.AddTagline(movieData.tagline);
|
||||
if (!string.IsNullOrEmpty(movieData.tagline))
|
||||
{
|
||||
movie.Taglines.Clear();
|
||||
movie.AddTagline(movieData.tagline);
|
||||
}
|
||||
|
||||
movie.SetProviderId(MetadataProviders.Imdb, movieData.imdb_id);
|
||||
float rating;
|
||||
string voteAvg = movieData.vote_average.ToString(CultureInfo.InvariantCulture);
|
||||
@ -957,16 +962,27 @@ namespace MediaBrowser.Controller.Providers.Movies
|
||||
//studios
|
||||
if (movieData.production_companies != null)
|
||||
{
|
||||
//always clear so they don't double up
|
||||
movie.AddStudios(movieData.production_companies.Select(c => c.name));
|
||||
movie.Studios.Clear();
|
||||
|
||||
foreach (var studio in movieData.production_companies.Select(c => c.name))
|
||||
{
|
||||
movie.AddStudio(studio);
|
||||
}
|
||||
}
|
||||
|
||||
//genres
|
||||
if (movieData.genres != null)
|
||||
{
|
||||
movie.AddGenres(movieData.genres.Select(g => g.name));
|
||||
movie.Genres.Clear();
|
||||
|
||||
foreach (var genre in movieData.genres.Select(g => g.name))
|
||||
{
|
||||
movie.AddGenre(genre);
|
||||
}
|
||||
}
|
||||
|
||||
movie.People.Clear();
|
||||
|
||||
//Actors, Directors, Writers - all in People
|
||||
//actors come from cast
|
||||
if (movieData.cast != null)
|
||||
|
@ -61,6 +61,8 @@ namespace MediaBrowser.Controller.Providers.Music
|
||||
|
||||
private static void AddGenres(BaseItem item, LastfmTags tags)
|
||||
{
|
||||
item.Genres.Clear();
|
||||
|
||||
foreach (var tag in tags.tag)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(tag.name))
|
||||
|
@ -260,24 +260,35 @@ namespace MediaBrowser.Controller.Providers.TV
|
||||
episode.ProductionYear = airDate.Year;
|
||||
}
|
||||
|
||||
episode.People.Clear();
|
||||
|
||||
var actors = doc.SafeGetString("//GuestStars");
|
||||
if (actors != null)
|
||||
{
|
||||
episode.AddPeople(actors.Split(new[] { '|' }, StringSplitOptions.RemoveEmptyEntries).Select(str => new PersonInfo { Type = PersonType.GuestStar, Name = str }));
|
||||
foreach (var person in actors.Split(new[] { '|' }, StringSplitOptions.RemoveEmptyEntries).Select(str => new PersonInfo { Type = PersonType.GuestStar, Name = str }))
|
||||
{
|
||||
episode.AddPerson(person);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
var directors = doc.SafeGetString("//Director");
|
||||
if (directors != null)
|
||||
{
|
||||
episode.AddPeople(directors.Split(new[] { '|' }, StringSplitOptions.RemoveEmptyEntries).Select(str => new PersonInfo { Type = PersonType.Director, Name = str }));
|
||||
foreach (var person in actors.Split(new[] { '|' }, StringSplitOptions.RemoveEmptyEntries).Select(str => new PersonInfo { Type = PersonType.Director, Name = str }))
|
||||
{
|
||||
episode.AddPerson(person);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
var writers = doc.SafeGetString("//Writer");
|
||||
if (writers != null)
|
||||
{
|
||||
episode.AddPeople(writers.Split(new[] { '|' }, StringSplitOptions.RemoveEmptyEntries).Select(str => new PersonInfo { Type = PersonType.Writer, Name = str }));
|
||||
foreach (var person in actors.Split(new[] { '|' }, StringSplitOptions.RemoveEmptyEntries).Select(str => new PersonInfo { Type = PersonType.Writer, Name = str }))
|
||||
{
|
||||
episode.AddPerson(person);
|
||||
}
|
||||
}
|
||||
|
||||
if (ConfigurationManager.Configuration.SaveLocalMeta)
|
||||
|
@ -232,8 +232,16 @@ namespace MediaBrowser.Controller.Providers.TV
|
||||
}
|
||||
|
||||
string s = doc.SafeGetString("//Network");
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(s))
|
||||
series.AddStudios(new List<string>(s.Trim().Split('|')));
|
||||
{
|
||||
series.Studios.Clear();
|
||||
|
||||
foreach (var studio in s.Trim().Split('|'))
|
||||
{
|
||||
series.AddStudio(studio);
|
||||
}
|
||||
}
|
||||
|
||||
series.OfficialRating = doc.SafeGetString("//ContentRating");
|
||||
|
||||
@ -244,7 +252,12 @@ namespace MediaBrowser.Controller.Providers.TV
|
||||
string[] genres = g.Trim('|').Split('|');
|
||||
if (g.Length > 0)
|
||||
{
|
||||
series.AddGenres(genres);
|
||||
series.Genres.Clear();
|
||||
|
||||
foreach (var genre in genres)
|
||||
{
|
||||
series.AddGenre(genre);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -305,7 +318,11 @@ namespace MediaBrowser.Controller.Providers.TV
|
||||
}
|
||||
|
||||
var xmlNodeList = docActors.SelectNodes("Actors/Actor");
|
||||
|
||||
if (xmlNodeList != null)
|
||||
{
|
||||
series.People.Clear();
|
||||
|
||||
foreach (XmlNode p in xmlNodeList)
|
||||
{
|
||||
string actorName = p.SafeGetString("Name");
|
||||
@ -329,6 +346,7 @@ namespace MediaBrowser.Controller.Providers.TV
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user