mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-05-27 10:58:44 +01:00
Added poor man's multi-file movie support
This commit is contained in:
@@ -8,6 +8,7 @@ using MediaBrowser.Model.Entities;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
|
||||
namespace MediaBrowser.Server.Implementations.Library.Resolvers.Movies
|
||||
{
|
||||
@@ -17,7 +18,7 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers.Movies
|
||||
public class MovieResolver : BaseVideoResolver<Video>
|
||||
{
|
||||
private IServerApplicationPaths ApplicationPaths { get; set; }
|
||||
|
||||
|
||||
public MovieResolver(IServerApplicationPaths appPaths)
|
||||
{
|
||||
ApplicationPaths = appPaths;
|
||||
@@ -196,10 +197,41 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers.Movies
|
||||
}
|
||||
}
|
||||
|
||||
// If there are multiple video files, return null, and let the VideoResolver catch them later as plain videos
|
||||
if (movies.Count > 1)
|
||||
{
|
||||
return GetMultiFileMovie(movies);
|
||||
}
|
||||
|
||||
return movies.Count == 1 ? movies[0] : null;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets the multi file movie.
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
/// <param name="movies">The movies.</param>
|
||||
/// <returns>``0.</returns>
|
||||
private T GetMultiFileMovie<T>(List<T> movies)
|
||||
where T : Video, new()
|
||||
{
|
||||
var multiPartMovies = movies.OrderBy(i => i.Path)
|
||||
.Where(i => EntityResolutionHelper.IsMultiPartFile(i.Path))
|
||||
.ToList();
|
||||
|
||||
// They must all be part of the sequence
|
||||
if (multiPartMovies.Count != movies.Count)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
var firstPart = multiPartMovies[0];
|
||||
|
||||
firstPart.IsMultiPart = true;
|
||||
|
||||
return firstPart;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether [is DVD directory] [the specified directory name].
|
||||
/// </summary>
|
||||
@@ -209,6 +241,7 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers.Movies
|
||||
{
|
||||
return directoryName.Equals("video_ts", StringComparison.OrdinalIgnoreCase);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether [is hd DVD directory] [the specified directory name].
|
||||
/// </summary>
|
||||
|
||||
@@ -142,9 +142,15 @@ namespace MediaBrowser.Server.Implementations.ScheduledTasks
|
||||
|
||||
var video = item as Video;
|
||||
|
||||
if (video != null && video.Chapters != null)
|
||||
if (video != null)
|
||||
{
|
||||
images = images.Concat(video.Chapters.Where(i => !string.IsNullOrEmpty(i.ImagePath)).Select(i => i.ImagePath));
|
||||
if (video.Chapters != null)
|
||||
{
|
||||
images = images.Concat(video.Chapters.Where(i => !string.IsNullOrEmpty(i.ImagePath)).Select(i => i.ImagePath));
|
||||
}
|
||||
|
||||
var additionalParts = _itemRepo.GetItems(video.AdditionalPartIds).ToList();
|
||||
images = additionalParts.Aggregate(images, (current, subItem) => current.Concat(GetPathsInUse(subItem)));
|
||||
}
|
||||
|
||||
var movie = item as Movie;
|
||||
|
||||
@@ -222,6 +222,7 @@ namespace MediaBrowser.Server.Implementations.ScheduledTasks
|
||||
|
||||
items.AddRange(themeVideos);
|
||||
|
||||
items.AddRange(videos.SelectMany(i => _itemRepo.GetItems(i.AdditionalPartIds).Cast<Video>()).ToList());
|
||||
items.AddRange(videos.OfType<Movie>().SelectMany(i => _itemRepo.GetItems(i.SpecialFeatureIds).Cast<Video>()).ToList());
|
||||
|
||||
return items.Where(i =>
|
||||
|
||||
Reference in New Issue
Block a user