aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Server.Implementations/Intros/DefaultIntroProvider.cs
diff options
context:
space:
mode:
Diffstat (limited to 'MediaBrowser.Server.Implementations/Intros/DefaultIntroProvider.cs')
-rw-r--r--MediaBrowser.Server.Implementations/Intros/DefaultIntroProvider.cs34
1 files changed, 19 insertions, 15 deletions
diff --git a/MediaBrowser.Server.Implementations/Intros/DefaultIntroProvider.cs b/MediaBrowser.Server.Implementations/Intros/DefaultIntroProvider.cs
index 37131ad2c..edc329ec4 100644
--- a/MediaBrowser.Server.Implementations/Intros/DefaultIntroProvider.cs
+++ b/MediaBrowser.Server.Implementations/Intros/DefaultIntroProvider.cs
@@ -78,13 +78,11 @@ namespace MediaBrowser.Server.Implementations.Intros
if (config.EnableIntrosFromMoviesInLibrary)
{
- var inputItems = _libraryManager.GetItems(new InternalItemsQuery
+ var inputItems = _libraryManager.GetItems(new InternalItemsQuery(user)
{
- IncludeItemTypes = new[] { typeof(Movie).Name },
+ IncludeItemTypes = new[] { typeof(Movie).Name }
- User = user
-
- }).Items;
+ }, new string[]{});
var itemsWithTrailers = inputItems
.Where(i =>
@@ -163,7 +161,7 @@ namespace MediaBrowser.Server.Implementations.Intros
private IEnumerable<IntroInfo> GetResult(BaseItem item, IEnumerable<ItemWithTrailer> candidates, CinemaModeConfiguration config, int? ratingLevel)
{
var customIntros = !string.IsNullOrWhiteSpace(config.CustomIntroPath) ?
- GetCustomIntros(item) :
+ GetCustomIntros(config) :
new List<IntroInfo>();
var trailerLimit = config.TrailerLimit;
@@ -212,11 +210,11 @@ namespace MediaBrowser.Server.Implementations.Intros
return _serverConfig.GetConfiguration<CinemaModeConfiguration>("cinemamode");
}
- private List<IntroInfo> GetCustomIntros(BaseItem item)
+ private List<IntroInfo> GetCustomIntros(CinemaModeConfiguration options)
{
try
{
- return GetCustomIntroFiles()
+ return GetCustomIntroFiles(options, true, false)
.OrderBy(i => Guid.NewGuid())
.Select(i => new IntroInfo
{
@@ -230,17 +228,23 @@ namespace MediaBrowser.Server.Implementations.Intros
}
}
- private IEnumerable<string> GetCustomIntroFiles(CinemaModeConfiguration options = null)
+ private IEnumerable<string> GetCustomIntroFiles(CinemaModeConfiguration options, bool enableCustomIntros, bool enableMediaInfoIntros)
{
- options = options ?? GetOptions();
+ var list = new List<string>();
+
+ if (enableCustomIntros && !string.IsNullOrWhiteSpace(options.CustomIntroPath))
+ {
+ list.AddRange(_fileSystem.GetFilePaths(options.CustomIntroPath, true)
+ .Where(_libraryManager.IsVideoFile));
+ }
- if (string.IsNullOrWhiteSpace(options.CustomIntroPath))
+ if (enableMediaInfoIntros && !string.IsNullOrWhiteSpace(options.MediaInfoIntroPath))
{
- return new List<string>();
+ list.AddRange(_fileSystem.GetFilePaths(options.MediaInfoIntroPath, true)
+ .Where(_libraryManager.IsVideoFile));
}
- return _fileSystem.GetFilePaths(options.CustomIntroPath, true)
- .Where(_libraryManager.IsVideoFile);
+ return list.Distinct(StringComparer.OrdinalIgnoreCase);
}
private bool FilterByParentalRating(int? ratingLevel, BaseItem item)
@@ -341,7 +345,7 @@ namespace MediaBrowser.Server.Implementations.Intros
public IEnumerable<string> GetAllIntroFiles()
{
- return GetCustomIntroFiles();
+ return GetCustomIntroFiles(GetOptions(), true, true);
}
private bool IsSupporter