mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-06-03 06:18:28 +01:00
add cinema mode feature
This commit is contained in:
@@ -95,8 +95,7 @@ namespace MediaBrowser.Server.Implementations.Library
|
||||
return true;
|
||||
}
|
||||
|
||||
// Don't misidentify xbmc trailers as a movie
|
||||
if (filename.IndexOf(BaseItem.XbmcTrailerFileSuffix, StringComparison.OrdinalIgnoreCase) != -1)
|
||||
if (BaseItem.ExtraSuffixes.Any(i => filename.IndexOf(i.Key, StringComparison.OrdinalIgnoreCase) != -1))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1193,13 +1193,42 @@ namespace MediaBrowser.Server.Implementations.Library
|
||||
/// <param name="item">The item.</param>
|
||||
/// <param name="user">The user.</param>
|
||||
/// <returns>IEnumerable{System.String}.</returns>
|
||||
public IEnumerable<Video> GetIntros(BaseItem item, User user)
|
||||
public async Task<IEnumerable<Video>> GetIntros(BaseItem item, User user)
|
||||
{
|
||||
return IntroProviders.SelectMany(i => i.GetIntros(item, user))
|
||||
var tasks = IntroProviders
|
||||
.OrderBy(i => (i.GetType().Name.IndexOf("Default", StringComparison.OrdinalIgnoreCase) == -1 ? 1 : 0))
|
||||
.Take(1)
|
||||
.Select(i => GetIntros(i, item, user));
|
||||
|
||||
var items = await Task.WhenAll(tasks).ConfigureAwait(false);
|
||||
|
||||
return items
|
||||
.SelectMany(i => i.ToArray())
|
||||
.Select(ResolveIntro)
|
||||
.Where(i => i != null);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the intros.
|
||||
/// </summary>
|
||||
/// <param name="provider">The provider.</param>
|
||||
/// <param name="item">The item.</param>
|
||||
/// <param name="user">The user.</param>
|
||||
/// <returns>Task<IEnumerable<IntroInfo>>.</returns>
|
||||
private async Task<IEnumerable<IntroInfo>> GetIntros(IIntroProvider provider, BaseItem item, User user)
|
||||
{
|
||||
try
|
||||
{
|
||||
return await provider.GetIntros(item, user).ConfigureAwait(false);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.ErrorException("Error getting intros", ex);
|
||||
|
||||
return new List<IntroInfo>();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets all intro files.
|
||||
/// </summary>
|
||||
@@ -1487,7 +1516,7 @@ namespace MediaBrowser.Server.Implementations.Library
|
||||
|
||||
var item = GetItemById(id) as UserView;
|
||||
|
||||
if (item == null ||
|
||||
if (item == null ||
|
||||
!string.Equals(item.Path, path, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
Directory.CreateDirectory(path);
|
||||
|
||||
@@ -2,8 +2,10 @@
|
||||
using MediaBrowser.Controller.Entities;
|
||||
using MediaBrowser.Controller.Library;
|
||||
using MediaBrowser.Controller.Resolvers;
|
||||
using MediaBrowser.Model.Entities;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
|
||||
namespace MediaBrowser.Server.Implementations.Library.Resolvers
|
||||
{
|
||||
@@ -41,9 +43,15 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers
|
||||
}
|
||||
|
||||
// Support xbmc local trailer convention, but only when looking for local trailers (hence the parent == null check)
|
||||
if (args.Parent == null && _fileSystem.GetFileNameWithoutExtension(args.Path).EndsWith(BaseItem.XbmcTrailerFileSuffix, StringComparison.OrdinalIgnoreCase))
|
||||
if (args.Parent == null)
|
||||
{
|
||||
return base.Resolve(args);
|
||||
var nameWithoutExtension = _fileSystem.GetFileNameWithoutExtension(args.Path);
|
||||
var suffix = BaseItem.ExtraSuffixes.First(i => i.Value == ExtraType.Trailer);
|
||||
|
||||
if (nameWithoutExtension.EndsWith(suffix.Key, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return base.Resolve(args);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -111,8 +111,8 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers.Movies
|
||||
}
|
||||
|
||||
var filename = Path.GetFileName(args.Path);
|
||||
// Don't misidentify xbmc trailers as a movie
|
||||
if (filename.IndexOf(BaseItem.XbmcTrailerFileSuffix, StringComparison.OrdinalIgnoreCase) != -1)
|
||||
// Don't misidentify extras or trailers
|
||||
if (BaseItem.ExtraSuffixes.Any(i => filename.IndexOf(i.Key, StringComparison.OrdinalIgnoreCase) != -1))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
@@ -229,8 +229,8 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers.Movies
|
||||
continue;
|
||||
}
|
||||
|
||||
// Don't misidentify xbmc trailers as a movie
|
||||
if (filename.IndexOf(BaseItem.XbmcTrailerFileSuffix, StringComparison.OrdinalIgnoreCase) != -1)
|
||||
// Don't misidentify extras or trailers as a movie
|
||||
if (BaseItem.ExtraSuffixes.Any(i => filename.IndexOf(i.Key, StringComparison.OrdinalIgnoreCase) != -1))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user