diff --git a/MediaBrowser.Api/AlbumsService.cs b/MediaBrowser.Api/AlbumsService.cs
index 17eec73d3..2b68e432e 100644
--- a/MediaBrowser.Api/AlbumsService.cs
+++ b/MediaBrowser.Api/AlbumsService.cs
@@ -82,9 +82,9 @@ namespace MediaBrowser.Api
.SelectMany(i => new[] { i.AlbumArtist, i.Artist })
.Where(i => !string.IsNullOrEmpty(i))
.Distinct(StringComparer.OrdinalIgnoreCase)
- .ToList();
+ .ToDictionary(i => i, StringComparer.OrdinalIgnoreCase);
- return points + artists1.Where(i => artists2.Contains(i, StringComparer.OrdinalIgnoreCase)).Sum(i => 5);
+ return points + artists1.Where(artists2.ContainsKey).Sum(i => 5);
}
}
}
diff --git a/MediaBrowser.Api/SimilarItemsHelper.cs b/MediaBrowser.Api/SimilarItemsHelper.cs
index 08b8a246d..03ee8c191 100644
--- a/MediaBrowser.Api/SimilarItemsHelper.cs
+++ b/MediaBrowser.Api/SimilarItemsHelper.cs
@@ -156,10 +156,10 @@ namespace MediaBrowser.Api
}
// Find common genres
- points += item1.Genres.Where(i => item2.Genres.Contains(i, StringComparer.OrdinalIgnoreCase)).Sum(i => 5);
+ points += item1.Genres.Where(i => item2.Genres.Contains(i, StringComparer.OrdinalIgnoreCase)).Sum(i => 10);
// Find common tags
- points += item1.Tags.Where(i => item2.Tags.Contains(i, StringComparer.OrdinalIgnoreCase)).Sum(i => 5);
+ points += item1.Tags.Where(i => item2.Tags.Contains(i, StringComparer.OrdinalIgnoreCase)).Sum(i => 10);
// Find common studios
points += item1.Studios.Where(i => item2.Studios.Contains(i, StringComparer.OrdinalIgnoreCase)).Sum(i => 3);
@@ -168,23 +168,23 @@ namespace MediaBrowser.Api
points += item1.People.Where(i => item2PeopleNames.Contains(i.Name, StringComparer.OrdinalIgnoreCase)).Sum(i =>
{
- if (string.Equals(i.Type, PersonType.Director, StringComparison.OrdinalIgnoreCase))
+ if (string.Equals(i.Type, PersonType.Director, StringComparison.OrdinalIgnoreCase) || string.Equals(i.Role, PersonType.Director, StringComparison.OrdinalIgnoreCase))
{
return 5;
}
- if (string.Equals(i.Type, PersonType.Actor, StringComparison.OrdinalIgnoreCase))
+ if (string.Equals(i.Type, PersonType.Actor, StringComparison.OrdinalIgnoreCase) || string.Equals(i.Role, PersonType.Actor, StringComparison.OrdinalIgnoreCase))
{
return 3;
}
- if (string.Equals(i.Type, PersonType.Composer, StringComparison.OrdinalIgnoreCase))
+ if (string.Equals(i.Type, PersonType.Composer, StringComparison.OrdinalIgnoreCase) || string.Equals(i.Role, PersonType.Composer, StringComparison.OrdinalIgnoreCase))
{
return 3;
}
- if (string.Equals(i.Type, PersonType.GuestStar, StringComparison.OrdinalIgnoreCase))
+ if (string.Equals(i.Type, PersonType.GuestStar, StringComparison.OrdinalIgnoreCase) || string.Equals(i.Role, PersonType.GuestStar, StringComparison.OrdinalIgnoreCase))
{
return 3;
}
- if (string.Equals(i.Type, PersonType.Writer, StringComparison.OrdinalIgnoreCase))
+ if (string.Equals(i.Type, PersonType.Writer, StringComparison.OrdinalIgnoreCase) || string.Equals(i.Role, PersonType.Writer, StringComparison.OrdinalIgnoreCase))
{
return 2;
}
diff --git a/MediaBrowser.Api/UserLibrary/GenresService.cs b/MediaBrowser.Api/UserLibrary/GenresService.cs
index 7d434aef0..f10ca9cf4 100644
--- a/MediaBrowser.Api/UserLibrary/GenresService.cs
+++ b/MediaBrowser.Api/UserLibrary/GenresService.cs
@@ -157,7 +157,7 @@ namespace MediaBrowser.Api.UserLibrary
{
var name = DeSlugGenreName(request.Name, LibraryManager);
- var items = GetItems(request.UserId).Where(i => i.Genres != null && i.Genres.Contains(name, StringComparer.OrdinalIgnoreCase)).ToList();
+ var items = GetItems(request.UserId).Where(i => i.Genres.Contains(name, StringComparer.OrdinalIgnoreCase)).ToList();
var counts = new ItemByNameCounts
{
diff --git a/MediaBrowser.Api/UserLibrary/ItemsService.cs b/MediaBrowser.Api/UserLibrary/ItemsService.cs
index a8b54f10c..6ff480e3f 100644
--- a/MediaBrowser.Api/UserLibrary/ItemsService.cs
+++ b/MediaBrowser.Api/UserLibrary/ItemsService.cs
@@ -629,7 +629,7 @@ namespace MediaBrowser.Api.UserLibrary
items = items.Where(item =>
item.People != null &&
item.People.Any(p =>
- p.Name.Equals(personName, StringComparison.OrdinalIgnoreCase) && types.Contains(p.Type, StringComparer.OrdinalIgnoreCase)));
+ p.Name.Equals(personName, StringComparison.OrdinalIgnoreCase) && (types.Contains(p.Type, StringComparer.OrdinalIgnoreCase) || types.Contains(p.Role, StringComparer.OrdinalIgnoreCase))));
}
}
diff --git a/MediaBrowser.Api/UserLibrary/PersonsService.cs b/MediaBrowser.Api/UserLibrary/PersonsService.cs
index d5134de0a..37df763d2 100644
--- a/MediaBrowser.Api/UserLibrary/PersonsService.cs
+++ b/MediaBrowser.Api/UserLibrary/PersonsService.cs
@@ -203,7 +203,7 @@ namespace MediaBrowser.Api.UserLibrary
return itemsList.Where(i => i.People.Any(p => p.Name.Equals(name, StringComparison.OrdinalIgnoreCase)));
}
- return itemsList.Where(i => i.People.Any(p => p.Name.Equals(name, StringComparison.OrdinalIgnoreCase) && personTypes.Contains(p.Type ?? string.Empty, StringComparer.OrdinalIgnoreCase)));
+ return itemsList.Where(i => i.People.Any(p => p.Name.Equals(name, StringComparison.OrdinalIgnoreCase) && (personTypes.Contains(p.Type ?? string.Empty, StringComparer.OrdinalIgnoreCase) || personTypes.Contains(p.Role ?? string.Empty, StringComparer.OrdinalIgnoreCase))));
}, GetEntity)
);
}
@@ -222,7 +222,7 @@ namespace MediaBrowser.Api.UserLibrary
people :
- people.Where(p => personTypes.Contains(p.Type ?? string.Empty, StringComparer.OrdinalIgnoreCase));
+ people.Where(p => personTypes.Contains(p.Type ?? string.Empty, StringComparer.OrdinalIgnoreCase) || personTypes.Contains(p.Role ?? string.Empty, StringComparer.OrdinalIgnoreCase));
}
///
diff --git a/MediaBrowser.Controller/Providers/BaseMetadataProvider.cs b/MediaBrowser.Controller/Providers/BaseMetadataProvider.cs
index a05266b0c..b524a11aa 100644
--- a/MediaBrowser.Controller/Providers/BaseMetadataProvider.cs
+++ b/MediaBrowser.Controller/Providers/BaseMetadataProvider.cs
@@ -1,4 +1,5 @@
-using System.IO;
+using System.Collections.Generic;
+using System.IO;
using System.Linq;
using System.Text;
using MediaBrowser.Common.Extensions;
@@ -361,19 +362,20 @@ namespace MediaBrowser.Controller.Providers
var sb = new StringBuilder();
- var extensions = FilestampExtensions;
+ var extensionsList = FilestampExtensions;
+ var extensions = extensionsList.ToDictionary(i => i, StringComparer.OrdinalIgnoreCase);
// Record the name of each file
// Need to sort these because accoring to msdn docs, our i/o methods are not guaranteed in any order
foreach (var file in resolveArgs.FileSystemChildren
- .Where(i => IncludeInFileStamp(i, extensions))
+ .Where(i => IncludeInFileStamp(i, extensions, extensionsList.Length))
.OrderBy(f => f.Name))
{
sb.Append(file.Name);
}
foreach (var file in resolveArgs.MetadataFiles
- .Where(i => IncludeInFileStamp(i, extensions))
+ .Where(i => IncludeInFileStamp(i, extensions, extensionsList.Length))
.OrderBy(f => f.Name))
{
sb.Append(file.Name);
@@ -387,8 +389,9 @@ namespace MediaBrowser.Controller.Providers
///
/// The file.
/// The extensions.
+ /// The num extensions.
/// true if XXXX, false otherwise
- private bool IncludeInFileStamp(FileSystemInfo file, string[] extensions)
+ private bool IncludeInFileStamp(FileSystemInfo file, Dictionary extensions, int numExtensions)
{
try
{
@@ -397,7 +400,7 @@ namespace MediaBrowser.Controller.Providers
return false;
}
- return extensions.Length == 0 || extensions.Contains(file.Extension, StringComparer.OrdinalIgnoreCase);
+ return numExtensions == 0 || extensions.ContainsKey(file.Extension);
}
catch (IOException ex)
{
diff --git a/MediaBrowser.Providers/MediaInfo/BaseFFProbeProvider.cs b/MediaBrowser.Providers/MediaInfo/BaseFFProbeProvider.cs
index b757a5ff9..643bcf2cd 100644
--- a/MediaBrowser.Providers/MediaInfo/BaseFFProbeProvider.cs
+++ b/MediaBrowser.Providers/MediaInfo/BaseFFProbeProvider.cs
@@ -139,7 +139,7 @@ namespace MediaBrowser.Providers.MediaInfo
stream.Language = GetDictionaryValue(streamInfo.tags, "language");
}
- if (streamInfo.codec_type.Equals("audio", StringComparison.OrdinalIgnoreCase))
+ if (string.Equals(streamInfo.codec_type, "audio", StringComparison.OrdinalIgnoreCase))
{
stream.Type = MediaStreamType.Audio;
@@ -150,11 +150,11 @@ namespace MediaBrowser.Providers.MediaInfo
stream.SampleRate = int.Parse(streamInfo.sample_rate, UsCulture);
}
}
- else if (streamInfo.codec_type.Equals("subtitle", StringComparison.OrdinalIgnoreCase))
+ else if (string.Equals(streamInfo.codec_type, "subtitle", StringComparison.OrdinalIgnoreCase))
{
stream.Type = MediaStreamType.Subtitle;
}
- else if (streamInfo.codec_type.Equals("video", StringComparison.OrdinalIgnoreCase))
+ else if (string.Equals(streamInfo.codec_type, "video", StringComparison.OrdinalIgnoreCase))
{
stream.Type = MediaStreamType.Video;
diff --git a/MediaBrowser.Providers/Movies/FanArtMovieUpdatesPrescanTask.cs b/MediaBrowser.Providers/Movies/FanArtMovieUpdatesPrescanTask.cs
index e7bde94c4..f06009f4b 100644
--- a/MediaBrowser.Providers/Movies/FanArtMovieUpdatesPrescanTask.cs
+++ b/MediaBrowser.Providers/Movies/FanArtMovieUpdatesPrescanTask.cs
@@ -115,7 +115,9 @@ namespace MediaBrowser.Providers.Movies
var updates = _jsonSerializer.DeserializeFromString>(json);
- return updates.Select(i => i.id).Where(i => existingIds.Contains(i, StringComparer.OrdinalIgnoreCase));
+ var existingDictionary = existingIds.ToDictionary(i => i, StringComparer.OrdinalIgnoreCase);
+
+ return updates.Select(i => i.id).Where(existingDictionary.ContainsKey);
}
}
}
diff --git a/MediaBrowser.Providers/Music/FanArtAlbumProvider.cs b/MediaBrowser.Providers/Music/FanArtAlbumProvider.cs
index 12539d2ba..b02128a37 100644
--- a/MediaBrowser.Providers/Music/FanArtAlbumProvider.cs
+++ b/MediaBrowser.Providers/Music/FanArtAlbumProvider.cs
@@ -55,6 +55,15 @@ namespace MediaBrowser.Providers.Music
Current = this;
}
+ ///
+ /// Gets the priority.
+ ///
+ /// The priority.
+ public override MetadataProviderPriority Priority
+ {
+ get { return MetadataProviderPriority.Fourth; }
+ }
+
///
/// Supportses the specified item.
///
diff --git a/MediaBrowser.Providers/Music/FanArtUpdatesPrescanTask.cs b/MediaBrowser.Providers/Music/FanArtUpdatesPrescanTask.cs
index 0e899b174..f7c3374d1 100644
--- a/MediaBrowser.Providers/Music/FanArtUpdatesPrescanTask.cs
+++ b/MediaBrowser.Providers/Music/FanArtUpdatesPrescanTask.cs
@@ -119,9 +119,11 @@ namespace MediaBrowser.Providers.Music
return new List();
}
+ var existingDictionary = existingArtistIds.ToDictionary(i => i, StringComparer.OrdinalIgnoreCase);
+
var updates = _jsonSerializer.DeserializeFromString>(json);
- return updates.Select(i => i.id).Where(i => existingArtistIds.Contains(i, StringComparer.OrdinalIgnoreCase));
+ return updates.Select(i => i.id).Where(existingDictionary.ContainsKey);
}
}
}
diff --git a/MediaBrowser.Providers/Music/LastfmAlbumProvider.cs b/MediaBrowser.Providers/Music/LastfmAlbumProvider.cs
index 84a3c3cd3..e32bf2360 100644
--- a/MediaBrowser.Providers/Music/LastfmAlbumProvider.cs
+++ b/MediaBrowser.Providers/Music/LastfmAlbumProvider.cs
@@ -30,6 +30,15 @@ namespace MediaBrowser.Providers.Music
return BlankId;
}
+ ///
+ /// Gets the priority.
+ ///
+ /// The priority.
+ public override MetadataProviderPriority Priority
+ {
+ get { return MetadataProviderPriority.Third; }
+ }
+
private bool HasAltMeta(BaseItem item)
{
return item.LocationType == LocationType.FileSystem && item.ResolveArgs.ContainsMetaFileByName("album.xml");
diff --git a/MediaBrowser.Providers/TV/FanArtTvUpdatesPrescanTask.cs b/MediaBrowser.Providers/TV/FanArtTvUpdatesPrescanTask.cs
index 53e2d6d23..047741055 100644
--- a/MediaBrowser.Providers/TV/FanArtTvUpdatesPrescanTask.cs
+++ b/MediaBrowser.Providers/TV/FanArtTvUpdatesPrescanTask.cs
@@ -120,9 +120,11 @@ namespace MediaBrowser.Providers.TV
return new List();
}
+ var existingDictionary = existingSeriesIds.ToDictionary(i => i, StringComparer.OrdinalIgnoreCase);
+
var updates = _jsonSerializer.DeserializeFromString>(json);
- return updates.Select(i => i.id).Where(i => existingSeriesIds.Contains(i, StringComparer.OrdinalIgnoreCase));
+ return updates.Select(i => i.id).Where(existingDictionary.ContainsKey);
}
}
}
diff --git a/MediaBrowser.Providers/TV/TvdbPrescanTask.cs b/MediaBrowser.Providers/TV/TvdbPrescanTask.cs
index 913620f12..2e6038b76 100644
--- a/MediaBrowser.Providers/TV/TvdbPrescanTask.cs
+++ b/MediaBrowser.Providers/TV/TvdbPrescanTask.cs
@@ -151,10 +151,12 @@ namespace MediaBrowser.Providers.TV
var seriesNodes = doc.SelectNodes("//Series");
+ var existingDictionary = existingSeriesIds.ToDictionary(i => i, StringComparer.OrdinalIgnoreCase);
+
var seriesList = seriesNodes == null ? new string[] { } :
seriesNodes.Cast()
.Select(i => i.InnerText)
- .Where(i => !string.IsNullOrWhiteSpace(i) && existingSeriesIds.Contains(i, StringComparer.OrdinalIgnoreCase));
+ .Where(i => !string.IsNullOrWhiteSpace(i) && existingDictionary.ContainsKey(i));
return new Tuple, string>(seriesList, newUpdateTime);
}
diff --git a/MediaBrowser.Server.Implementations/Library/LibraryManager.cs b/MediaBrowser.Server.Implementations/Library/LibraryManager.cs
index 26cada6cc..e06107b63 100644
--- a/MediaBrowser.Server.Implementations/Library/LibraryManager.cs
+++ b/MediaBrowser.Server.Implementations/Library/LibraryManager.cs
@@ -846,11 +846,12 @@ namespace MediaBrowser.Server.Implementations.Library
var tasks = new List();
- var includedPersonTypes = new[] { PersonType.Actor, PersonType.Director, PersonType.GuestStar, PersonType.Writer, PersonType.Director, PersonType.Producer };
+ var includedPersonTypes = new[] { PersonType.Actor, PersonType.Director, PersonType.GuestStar, PersonType.Writer, PersonType.Director, PersonType.Producer }
+ .ToDictionary(i => i, StringComparer.OrdinalIgnoreCase);
var people = RootFolder.RecursiveChildren
.Where(c => c.People != null)
- .SelectMany(c => c.People.Where(p => includedPersonTypes.Contains(p.Type, StringComparer.OrdinalIgnoreCase) || includedPersonTypes.Contains(p.Role, StringComparer.OrdinalIgnoreCase)))
+ .SelectMany(c => c.People.Where(p => includedPersonTypes.ContainsKey(p.Type ?? string.Empty) || includedPersonTypes.ContainsKey(p.Role ?? string.Empty)))
.DistinctBy(p => p.Name, StringComparer.OrdinalIgnoreCase)
.ToList();