This commit is contained in:
Luke Pulverenti 2013-06-16 09:58:08 -04:00
commit ea619383e9
14 changed files with 147 additions and 116 deletions

View File

@ -266,9 +266,17 @@ namespace MediaBrowser.Api
item.OfficialRating = request.OfficialRating;
item.CustomRating = request.CustomRating;
item.DontFetchMeta = !(request.EnableInternetProviders ?? true);
item.LockedFields = request.LockedFields;
item.LockedImages = request.LockedImages;
if (request.EnableInternetProviders ?? true)
{
item.LockedFields = request.LockedFields;
item.LockedImages = request.LockedImages;
}
else
{
item.LockedFields.Clear();
item.LockedImages.Clear();
}
foreach (var pair in request.ProviderIds.ToList())
{
if (string.IsNullOrEmpty(pair.Value))

View File

@ -310,7 +310,7 @@ namespace MediaBrowser.Providers.Movies
string path;
var hd = ConfigurationManager.Configuration.DownloadHDFanArt ? "hd" : "";
if (ConfigurationManager.Configuration.DownloadMovieImages.Logo && !item.HasImage(ImageType.Logo))
if (ConfigurationManager.Configuration.DownloadMovieImages.Logo && !item.HasImage(ImageType.Logo) && !item.LockedImages.Contains(ImageType.Logo))
{
var node =
doc.SelectSingleNode("//fanart/movie/movielogos/" + hd + "movielogo[@lang = \"" + language + "\"]/@url") ??
@ -328,7 +328,7 @@ namespace MediaBrowser.Providers.Movies
}
cancellationToken.ThrowIfCancellationRequested();
if (ConfigurationManager.Configuration.DownloadMovieImages.Art && !item.HasImage(ImageType.Art))
if (ConfigurationManager.Configuration.DownloadMovieImages.Art && !item.HasImage(ImageType.Art) && !item.LockedImages.Contains(ImageType.Art))
{
var node =
doc.SelectSingleNode("//fanart/movie/moviearts/" + hd + "movieart[@lang = \"" + language + "\"]/@url") ??
@ -343,7 +343,7 @@ namespace MediaBrowser.Providers.Movies
}
cancellationToken.ThrowIfCancellationRequested();
if (ConfigurationManager.Configuration.DownloadMovieImages.Disc && !item.HasImage(ImageType.Disc))
if (ConfigurationManager.Configuration.DownloadMovieImages.Disc && !item.HasImage(ImageType.Disc) && !item.LockedImages.Contains(ImageType.Disc))
{
var node = doc.SelectSingleNode("//fanart/movie/moviediscs/moviedisc[@lang = \"" + language + "\"]/@url") ??
doc.SelectSingleNode("//fanart/movie/moviediscs/moviedisc/@url");
@ -356,7 +356,7 @@ namespace MediaBrowser.Providers.Movies
cancellationToken.ThrowIfCancellationRequested();
if (ConfigurationManager.Configuration.DownloadMovieImages.Banner && !item.HasImage(ImageType.Banner))
if (ConfigurationManager.Configuration.DownloadMovieImages.Banner && !item.HasImage(ImageType.Banner) && !item.LockedImages.Contains(ImageType.Banner))
{
var node = doc.SelectSingleNode("//fanart/movie/moviebanners/moviebanner[@lang = \"" + language + "\"]/@url") ??
doc.SelectSingleNode("//fanart/movie/moviebanners/moviebanner/@url");
@ -369,7 +369,7 @@ namespace MediaBrowser.Providers.Movies
cancellationToken.ThrowIfCancellationRequested();
if (ConfigurationManager.Configuration.DownloadMovieImages.Thumb && !item.HasImage(ImageType.Thumb))
if (ConfigurationManager.Configuration.DownloadMovieImages.Thumb && !item.HasImage(ImageType.Thumb) && !item.LockedImages.Contains(ImageType.Thumb))
{
var node = doc.SelectSingleNode("//fanart/movie/moviethumbs/moviethumb[@lang = \"" + language + "\"]/@url") ??
doc.SelectSingleNode("//fanart/movie/moviethumbs/moviethumb/@url");

View File

@ -232,7 +232,7 @@ namespace MediaBrowser.Providers.Movies
var status = ProviderRefreshStatus.Success;
// poster
if (images.posters != null && images.posters.Count > 0 && !item.HasImage(ImageType.Primary))
if (images.posters != null && images.posters.Count > 0 && !item.HasImage(ImageType.Primary) && !item.LockedImages.Contains(ImageType.Primary))
{
var tmdbSettings = await MovieDbProvider.Current.GetTmdbSettings(cancellationToken).ConfigureAwait(false);
@ -273,7 +273,7 @@ namespace MediaBrowser.Providers.Movies
cancellationToken.ThrowIfCancellationRequested();
// backdrops - only download if earlier providers didn't find any (fanart)
if (images.backdrops != null && images.backdrops.Count > 0 && ConfigurationManager.Configuration.DownloadMovieImages.Backdrops && item.BackdropImagePaths.Count == 0)
if (images.backdrops != null && images.backdrops.Count > 0 && ConfigurationManager.Configuration.DownloadMovieImages.Backdrops && item.BackdropImagePaths.Count == 0 && !item.LockedImages.Contains(ImageType.Backdrop))
{
var tmdbSettings = await MovieDbProvider.Current.GetTmdbSettings(cancellationToken).ConfigureAwait(false);

View File

@ -720,9 +720,14 @@ namespace MediaBrowser.Providers.Movies
{
if (movie != null && movieData != null)
{
movie.Name = movieData.title ?? movieData.original_title ?? movie.Name;
movie.Overview = movieData.overview;
if (!movie.LockedFields.Contains(MetadataFields.Name))
{
movie.Name = movieData.title ?? movieData.original_title ?? movie.Name;
}
if (!movie.LockedFields.Contains(MetadataFields.Overview))
{
movie.Overview = movieData.overview;
}
movie.Overview = movie.Overview != null ? movie.Overview.Replace("\n\n", "\n") : null;
movie.HomePageUrl = movieData.homepage;
movie.Budget = movieData.budget;
@ -798,7 +803,7 @@ namespace MediaBrowser.Providers.Movies
movie.OriginalRunTimeTicks = TimeSpan.FromMinutes(movieData.runtime).Ticks;
//studios
if (movieData.production_companies != null)
if (movieData.production_companies != null && !movie.LockedFields.Contains(MetadataFields.Studios))
{
movie.Studios.Clear();
@ -809,7 +814,7 @@ namespace MediaBrowser.Providers.Movies
}
//genres
if (movieData.genres != null)
if (movieData.genres != null && !movie.LockedFields.Contains(MetadataFields.Genres))
{
movie.Genres.Clear();
@ -824,7 +829,7 @@ namespace MediaBrowser.Providers.Movies
//Actors, Directors, Writers - all in People
//actors come from cast
if (movieData.casts != null && movieData.casts.cast != null)
if (movieData.casts != null && movieData.casts.cast != null && !movie.LockedFields.Contains(MetadataFields.Cast))
{
foreach (var actor in movieData.casts.cast.OrderBy(a => a.order)) movie.AddPerson(new PersonInfo { Name = actor.name, Role = actor.character, Type = PersonType.Actor });
}
@ -835,7 +840,7 @@ namespace MediaBrowser.Providers.Movies
foreach (var person in movieData.casts.crew) movie.AddPerson(new PersonInfo { Name = person.name, Role = person.job, Type = person.department });
}
if (movieData.keywords != null && movieData.keywords.keywords != null)
if (movieData.keywords != null && movieData.keywords.keywords != null && !movie.LockedFields.Contains(MetadataFields.Tags))
{
movie.Tags = movieData.keywords.keywords.Select(i => i.name).ToList();
}

View File

@ -265,7 +265,7 @@ namespace MediaBrowser.Providers.Movies
//still nothing - just get first one
profile = searchResult.profiles[0];
}
if (profile != null && !person.HasImage(ImageType.Primary))
if (profile != null && !person.HasImage(ImageType.Primary) && !person.LockedImages.Contains(ImageType.Primary))
{
var tmdbSettings = await MovieDbProvider.Current.GetTmdbSettings(cancellationToken).ConfigureAwait(false);

View File

@ -187,7 +187,7 @@ namespace MediaBrowser.Providers.Music
cancellationToken.ThrowIfCancellationRequested();
if (ConfigurationManager.Configuration.DownloadMusicAlbumImages.Disc && !item.HasImage(ImageType.Disc))
if (ConfigurationManager.Configuration.DownloadMusicAlbumImages.Disc && !item.HasImage(ImageType.Disc) && !item.LockedImages.Contains(ImageType.Disc))
{
// Try try with the release entry Id, if that doesn't produce anything try the release group id
var node = doc.SelectSingleNode("//fanart/music/albums/album[@id=\"" + releaseEntryId + "\"]/cdart/@url");
@ -205,7 +205,7 @@ namespace MediaBrowser.Providers.Music
}
}
if (ConfigurationManager.Configuration.DownloadMusicAlbumImages.Primary && !item.HasImage(ImageType.Primary))
if (ConfigurationManager.Configuration.DownloadMusicAlbumImages.Primary && !item.HasImage(ImageType.Primary) && !item.LockedImages.Contains(ImageType.Primary))
{
// Try try with the release entry Id, if that doesn't produce anything try the release group id
var node = doc.SelectSingleNode("//fanart/music/albums/album[@id=\"" + releaseEntryId + "\"]/albumcover/@url");

View File

@ -301,7 +301,7 @@ namespace MediaBrowser.Providers.Music
string path;
var hd = ConfigurationManager.Configuration.DownloadHDFanArt ? "hd" : "";
if (ConfigurationManager.Configuration.DownloadMusicArtistImages.Logo && !item.HasImage(ImageType.Logo))
if (ConfigurationManager.Configuration.DownloadMusicArtistImages.Logo && !item.HasImage(ImageType.Logo) && !item.LockedImages.Contains(ImageType.Logo))
{
var node =
doc.SelectSingleNode("//fanart/music/musiclogos/" + hd + "musiclogo/@url") ??
@ -314,7 +314,7 @@ namespace MediaBrowser.Providers.Music
}
cancellationToken.ThrowIfCancellationRequested();
if (ConfigurationManager.Configuration.DownloadMusicArtistImages.Backdrops && item.BackdropImagePaths.Count == 0)
if (ConfigurationManager.Configuration.DownloadMusicArtistImages.Backdrops && item.BackdropImagePaths.Count == 0 && !item.LockedImages.Contains(ImageType.Backdrop))
{
var nodes = doc.SelectNodes("//fanart/music/artistbackgrounds//@url");
if (nodes != null)
@ -338,7 +338,7 @@ namespace MediaBrowser.Providers.Music
cancellationToken.ThrowIfCancellationRequested();
if (ConfigurationManager.Configuration.DownloadMusicArtistImages.Art && !item.HasImage(ImageType.Art))
if (ConfigurationManager.Configuration.DownloadMusicArtistImages.Art && !item.HasImage(ImageType.Art) && !item.LockedImages.Contains(ImageType.Art))
{
var node =
doc.SelectSingleNode("//fanart/music/musicarts/" + hd + "musicart/@url") ??
@ -351,7 +351,7 @@ namespace MediaBrowser.Providers.Music
}
cancellationToken.ThrowIfCancellationRequested();
if (ConfigurationManager.Configuration.DownloadMusicArtistImages.Banner && !item.HasImage(ImageType.Banner))
if (ConfigurationManager.Configuration.DownloadMusicArtistImages.Banner && !item.HasImage(ImageType.Banner) && !item.LockedImages.Contains(ImageType.Banner))
{
var node = doc.SelectSingleNode("//fanart/music/musicbanners/" + hd + "musicbanner/@url") ??
doc.SelectSingleNode("//fanart/music/musicbanners/musicbanner/@url");
@ -365,7 +365,7 @@ namespace MediaBrowser.Providers.Music
cancellationToken.ThrowIfCancellationRequested();
// Artist thumbs are actually primary images (they are square/portrait)
if (ConfigurationManager.Configuration.DownloadMusicArtistImages.Primary && !item.HasImage(ImageType.Primary))
if (ConfigurationManager.Configuration.DownloadMusicArtistImages.Primary && !item.HasImage(ImageType.Primary) && !item.LockedImages.Contains(ImageType.Primary))
{
var node = doc.SelectSingleNode("//fanart/music/artistthumbs/artistthumb/@url");
path = node != null ? node.Value : null;

View File

@ -19,10 +19,11 @@ namespace MediaBrowser.Providers.Music
if (data.bio != null)
{
Int32.TryParse(data.bio.yearformed, out yearFormed);
artist.Overview = data.bio.content;
if (!string.IsNullOrEmpty(data.bio.placeformed))
if (!artist.LockedFields.Contains(MetadataFields.Overview))
{
artist.Overview = data.bio.content;
}
if (!string.IsNullOrEmpty(data.bio.placeformed) && !artist.LockedFields.Contains(MetadataFields.ProductionLocations))
{
artist.AddProductionLocation(data.bio.placeformed);
}
@ -30,7 +31,7 @@ namespace MediaBrowser.Providers.Music
artist.PremiereDate = yearFormed > 0 ? new DateTime(yearFormed, 1, 1, 0, 0, 0, DateTimeKind.Utc) : (DateTime?)null;
artist.ProductionYear = yearFormed;
if (data.tags != null)
if (data.tags != null && !artist.LockedFields.Contains(MetadataFields.Tags))
{
AddTags(artist, data.tags);
}
@ -52,13 +53,15 @@ namespace MediaBrowser.Providers.Music
var overview = data.wiki != null ? data.wiki.content : null;
item.Overview = overview;
if (!item.LockedFields.Contains(MetadataFields.Overview))
{
item.Overview = overview;
}
DateTime release;
DateTime.TryParse(data.releasedate, out release);
item.PremiereDate = release;
item.ProductionYear = release.Year;
if (data.toptags != null)
if (data.toptags != null && !item.LockedFields.Contains(MetadataFields.Tags))
{
AddTags(item, data.toptags);
}

View File

@ -164,8 +164,8 @@ namespace MediaBrowser.Providers.TV
}
var language = ConfigurationManager.Configuration.PreferredMetadataLanguage.ToLower();
if (ConfigurationManager.Configuration.DownloadSeasonImages.Thumb && !season.HasImage(ImageType.Thumb))
if (ConfigurationManager.Configuration.DownloadSeasonImages.Thumb && !season.HasImage(ImageType.Thumb) && !season.LockedImages.Contains(ImageType.Thumb))
{
var node = doc.SelectSingleNode("//fanart/series/seasonthumbs/seasonthumb[@lang = \"" + language + "\"][@season = \"" + seasonNumber + "\"]/@url") ??
doc.SelectSingleNode("//fanart/series/seasonthumbs/seasonthumb[@season = \"" + seasonNumber + "\"]/@url");

View File

@ -225,7 +225,7 @@ namespace MediaBrowser.Providers.TV
var language = ConfigurationManager.Configuration.PreferredMetadataLanguage.ToLower();
var hd = ConfigurationManager.Configuration.DownloadHDFanArt ? "hdtv" : "clear";
if (ConfigurationManager.Configuration.DownloadSeriesImages.Logo && !item.HasImage(ImageType.Logo))
if (ConfigurationManager.Configuration.DownloadSeriesImages.Logo && !item.HasImage(ImageType.Logo) && !item.LockedImages.Contains(ImageType.Logo))
{
var node = doc.SelectSingleNode("//fanart/series/" + hd + "logos/" + hd + "logo[@lang = \"" + language + "\"]/@url") ??
doc.SelectSingleNode("//fanart/series/clearlogos/clearlogo[@lang = \"" + language + "\"]/@url") ??
@ -241,7 +241,7 @@ namespace MediaBrowser.Providers.TV
cancellationToken.ThrowIfCancellationRequested();
hd = ConfigurationManager.Configuration.DownloadHDFanArt ? "hd" : "";
if (ConfigurationManager.Configuration.DownloadSeriesImages.Art && !item.HasImage(ImageType.Art))
if (ConfigurationManager.Configuration.DownloadSeriesImages.Art && !item.HasImage(ImageType.Art) && !item.LockedImages.Contains(ImageType.Art))
{
var node = doc.SelectSingleNode("//fanart/series/" + hd + "cleararts/" + hd + "clearart[@lang = \"" + language + "\"]/@url") ??
doc.SelectSingleNode("//fanart/series/cleararts/clearart[@lang = \"" + language + "\"]/@url") ??
@ -256,7 +256,7 @@ namespace MediaBrowser.Providers.TV
cancellationToken.ThrowIfCancellationRequested();
if (ConfigurationManager.Configuration.DownloadSeriesImages.Thumb && !item.HasImage(ImageType.Thumb))
if (ConfigurationManager.Configuration.DownloadSeriesImages.Thumb && !item.HasImage(ImageType.Thumb) && !item.LockedImages.Contains(ImageType.Thumb))
{
var node = doc.SelectSingleNode("//fanart/series/tvthumbs/tvthumb[@lang = \"" + language + "\"]/@url") ??
doc.SelectSingleNode("//fanart/series/tvthumbs/tvthumb/@url");
@ -267,7 +267,7 @@ namespace MediaBrowser.Providers.TV
}
}
if (ConfigurationManager.Configuration.DownloadSeriesImages.Banner && !item.HasImage(ImageType.Banner))
if (ConfigurationManager.Configuration.DownloadSeriesImages.Banner && !item.HasImage(ImageType.Banner) && !item.LockedImages.Contains(ImageType.Banner))
{
var node = doc.SelectSingleNode("//fanart/series/tbbanners/tvbanner[@lang = \"" + language + "\"]/@url") ??
doc.SelectSingleNode("//fanart/series/tbbanners/tvbanner/@url");
@ -278,7 +278,7 @@ namespace MediaBrowser.Providers.TV
}
}
if (ConfigurationManager.Configuration.DownloadMovieImages.Backdrops && item.BackdropImagePaths.Count == 0)
if (ConfigurationManager.Configuration.DownloadMovieImages.Backdrops && item.BackdropImagePaths.Count == 0 && !item.LockedImages.Contains(ImageType.Backdrop))
{
var nodes = doc.SelectNodes("//fanart/series/showbackgrounds//@url");

View File

@ -274,7 +274,7 @@ namespace MediaBrowser.Providers.TV
var doc = new XmlDocument();
doc.LoadXml(episodeNode.OuterXml);
if (!episode.HasImage(ImageType.Primary))
if (!episode.HasImage(ImageType.Primary) && !episode.LockedImages.Contains(ImageType.Primary))
{
var p = doc.SafeGetString("//filename");
if (p != null)
@ -291,14 +291,18 @@ namespace MediaBrowser.Providers.TV
}
}
}
episode.Overview = doc.SafeGetString("//Overview");
if (!episode.LockedFields.Contains(MetadataFields.Overview))
{
episode.Overview = doc.SafeGetString("//Overview");
}
if (usingAbsoluteData)
episode.IndexNumber = doc.SafeGetInt32("//absolute_number", -1);
if (episode.IndexNumber < 0)
episode.IndexNumber = doc.SafeGetInt32("//EpisodeNumber");
episode.Name = doc.SafeGetString("//EpisodeName");
if (!episode.LockedFields.Contains(MetadataFields.Name))
{
episode.Name = doc.SafeGetString("//EpisodeName");
}
episode.CommunityRating = doc.SafeGetSingle("//Rating", -1, 10);
var firstAired = doc.SafeGetString("//FirstAired");
DateTime airDate;
@ -307,47 +311,48 @@ namespace MediaBrowser.Providers.TV
episode.PremiereDate = airDate.ToUniversalTime();
episode.ProductionYear = airDate.Year;
}
episode.People.Clear();
var actors = doc.SafeGetString("//GuestStars");
if (actors != null)
if (!episode.LockedFields.Contains(MetadataFields.Cast))
{
// Sometimes tvdb actors have leading spaces
foreach (var person in actors.Split(new[] { '|' }, StringSplitOptions.RemoveEmptyEntries)
.Where(i => !string.IsNullOrWhiteSpace(i))
.Select(str => new PersonInfo { Type = PersonType.GuestStar, Name = str.Trim() }))
episode.People.Clear();
var actors = doc.SafeGetString("//GuestStars");
if (actors != null)
{
episode.AddPerson(person);
// Sometimes tvdb actors have leading spaces
foreach (var person in actors.Split(new[] {'|'}, StringSplitOptions.RemoveEmptyEntries)
.Where(i => !string.IsNullOrWhiteSpace(i))
.Select(str => new PersonInfo {Type = PersonType.GuestStar, Name = str.Trim()}))
{
episode.AddPerson(person);
}
}
var directors = doc.SafeGetString("//Director");
if (directors != null)
{
// Sometimes tvdb actors have leading spaces
foreach (var person in directors.Split(new[] {'|'}, StringSplitOptions.RemoveEmptyEntries)
.Where(i => !string.IsNullOrWhiteSpace(i))
.Select(str => new PersonInfo {Type = PersonType.Director, Name = str.Trim()}))
{
episode.AddPerson(person);
}
}
var writers = doc.SafeGetString("//Writer");
if (writers != null)
{
// Sometimes tvdb actors have leading spaces
foreach (var person in writers.Split(new[] {'|'}, StringSplitOptions.RemoveEmptyEntries)
.Where(i => !string.IsNullOrWhiteSpace(i))
.Select(str => new PersonInfo {Type = PersonType.Writer, Name = str.Trim()}))
{
episode.AddPerson(person);
}
}
}
var directors = doc.SafeGetString("//Director");
if (directors != null)
{
// Sometimes tvdb actors have leading spaces
foreach (var person in directors.Split(new[] { '|' }, StringSplitOptions.RemoveEmptyEntries)
.Where(i => !string.IsNullOrWhiteSpace(i))
.Select(str => new PersonInfo { Type = PersonType.Director, Name = str.Trim() }))
{
episode.AddPerson(person);
}
}
var writers = doc.SafeGetString("//Writer");
if (writers != null)
{
// Sometimes tvdb actors have leading spaces
foreach (var person in writers.Split(new[] { '|' }, StringSplitOptions.RemoveEmptyEntries)
.Where(i => !string.IsNullOrWhiteSpace(i))
.Select(str => new PersonInfo { Type = PersonType.Writer, Name = str.Trim() }))
{
episode.AddPerson(person);
}
}
if (ConfigurationManager.Configuration.SaveLocalMeta)
{
//if (!Directory.Exists(episode.MetaLocation)) Directory.CreateDirectory(episode.MetaLocation);

View File

@ -225,7 +225,7 @@ namespace MediaBrowser.Providers.TV
return;
}
if (!season.HasImage(ImageType.Primary))
if (!season.HasImage(ImageType.Primary) && !season.LockedImages.Contains(ImageType.Primary))
{
var n = images.SelectSingleNode("//Banner[BannerType='season'][BannerType2='season'][Season='" + seasonNumber + "'][Language='" + ConfigurationManager.Configuration.PreferredMetadataLanguage + "']") ??
images.SelectSingleNode("//Banner[BannerType='season'][BannerType2='season'][Season='" + seasonNumber + "'][Language='en']");
@ -238,7 +238,7 @@ namespace MediaBrowser.Providers.TV
}
}
if (ConfigurationManager.Configuration.DownloadSeasonImages.Banner && !season.HasImage(ImageType.Banner))
if (ConfigurationManager.Configuration.DownloadSeasonImages.Banner && !season.HasImage(ImageType.Banner) && !season.LockedImages.Contains(ImageType.Banner))
{
var n = images.SelectSingleNode("//Banner[BannerType='season'][BannerType2='seasonwide'][Season='" + seasonNumber + "'][Language='" + ConfigurationManager.Configuration.PreferredMetadataLanguage + "']") ??
images.SelectSingleNode("//Banner[BannerType='season'][BannerType2='seasonwide'][Season='" + seasonNumber + "'][Language='en']");
@ -273,7 +273,7 @@ namespace MediaBrowser.Providers.TV
}
}
if (ConfigurationManager.Configuration.DownloadSeasonImages.Backdrops && season.BackdropImagePaths.Count == 0)
if (ConfigurationManager.Configuration.DownloadSeasonImages.Backdrops && season.BackdropImagePaths.Count == 0 && !season.LockedImages.Contains(ImageType.Backdrop))
{
var n = images.SelectSingleNode("//Banner[BannerType='fanart'][Season='" + seasonNumber + "']");
if (n != null)

View File

@ -282,12 +282,13 @@ namespace MediaBrowser.Providers.TV
seriesDoc.Load(seriesXmlPath);
FetchMainInfo(series, seriesDoc);
if (!series.LockedFields.Contains(MetadataFields.Cast))
{
var actorsDoc = new XmlDocument();
actorsDoc.Load(actorsXmlPath);
var actorsDoc = new XmlDocument();
actorsDoc.Load(actorsXmlPath);
FetchActors(series, actorsDoc, seriesDoc);
FetchActors(series, actorsDoc, seriesDoc);
}
if (ConfigurationManager.Configuration.SaveLocalMeta)
{
var ms = new MemoryStream();
@ -370,8 +371,14 @@ namespace MediaBrowser.Providers.TV
/// <param name="doc">The doc.</param>
private void FetchMainInfo(Series series, XmlDocument doc)
{
series.Name = doc.SafeGetString("//SeriesName");
series.Overview = doc.SafeGetString("//Overview");
if (!series.LockedFields.Contains(MetadataFields.Name))
{
series.Name = doc.SafeGetString("//SeriesName");
}
if (!series.LockedFields.Contains(MetadataFields.Overview))
{
series.Overview = doc.SafeGetString("//Overview");
}
series.CommunityRating = doc.SafeGetSingle("//Rating", 0, 10);
series.AirDays = TVUtils.GetAirDays(doc.SafeGetString("//Airs_DayOfWeek"));
series.AirTime = doc.SafeGetString("//Airs_Time");
@ -384,36 +391,39 @@ namespace MediaBrowser.Providers.TV
//Runtime is in minutes, and 1 tick = 10000 ms
series.RunTimeTicks = doc.SafeGetInt32("//Runtime") * 6;
string s = doc.SafeGetString("//Network");
if (!string.IsNullOrWhiteSpace(s))
if (!series.LockedFields.Contains(MetadataFields.Studios))
{
series.Studios.Clear();
string s = doc.SafeGetString("//Network");
foreach (var studio in s.Trim().Split('|'))
if (!string.IsNullOrWhiteSpace(s))
{
series.AddStudio(studio);
}
}
series.Studios.Clear();
series.OfficialRating = doc.SafeGetString("//ContentRating");
string g = doc.SafeGetString("//Genre");
if (g != null)
{
string[] genres = g.Trim('|').Split('|');
if (g.Length > 0)
{
series.Genres.Clear();
foreach (var genre in genres)
foreach (var studio in s.Trim().Split('|'))
{
series.AddGenre(genre);
series.AddStudio(studio);
}
}
}
series.OfficialRating = doc.SafeGetString("//ContentRating");
if (!series.LockedFields.Contains(MetadataFields.Genres))
{
string g = doc.SafeGetString("//Genre");
if (g != null)
{
string[] genres = g.Trim('|').Split('|');
if (g.Length > 0)
{
series.Genres.Clear();
foreach (var genre in genres)
{
series.AddGenre(genre);
}
}
}
}
if (series.Status == SeriesStatus.Ended) {
var document = XDocument.Load(new XmlNodeReader(doc));

View File

@ -227,7 +227,7 @@ namespace MediaBrowser.Providers.TV
/// <returns>Task.</returns>
private async Task FetchImages(Series series, XmlDocument images, CancellationToken cancellationToken)
{
if (!series.HasImage(ImageType.Primary))
if (!series.HasImage(ImageType.Primary) && !series.LockedImages.Contains(ImageType.Primary))
{
var n = images.SelectSingleNode("//Banner[BannerType='poster']");
if (n != null)
@ -242,7 +242,7 @@ namespace MediaBrowser.Providers.TV
}
}
if (ConfigurationManager.Configuration.DownloadSeriesImages.Banner && !series.HasImage(ImageType.Banner))
if (ConfigurationManager.Configuration.DownloadSeriesImages.Banner && !series.HasImage(ImageType.Banner) && !series.LockedImages.Contains(ImageType.Banner))
{
var n = images.SelectSingleNode("//Banner[BannerType='series']");
if (n != null)
@ -257,7 +257,7 @@ namespace MediaBrowser.Providers.TV
}
}
if (series.BackdropImagePaths.Count == 0)
if (series.BackdropImagePaths.Count == 0 && !series.LockedImages.Contains(ImageType.Backdrop))
{
var bdNo = series.BackdropImagePaths.Count;