mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-05-31 12:14:21 -04:00
feat: allow grouping shows into collections (#13236)
* feat: allow grouping shows into collections * add pre-startup routine to rename EnableGroupingIntoCollections * Update Jellyfin.Server/Migrations/PreStartupRoutines/RenameEnableGroupingIntoCollections.cs
This commit is contained in:
parent
9657708b38
commit
2c499d1e86
@ -29,7 +29,8 @@ namespace Jellyfin.Server.Migrations
|
|||||||
typeof(PreStartupRoutines.CreateNetworkConfiguration),
|
typeof(PreStartupRoutines.CreateNetworkConfiguration),
|
||||||
typeof(PreStartupRoutines.MigrateMusicBrainzTimeout),
|
typeof(PreStartupRoutines.MigrateMusicBrainzTimeout),
|
||||||
typeof(PreStartupRoutines.MigrateNetworkConfiguration),
|
typeof(PreStartupRoutines.MigrateNetworkConfiguration),
|
||||||
typeof(PreStartupRoutines.MigrateEncodingOptions)
|
typeof(PreStartupRoutines.MigrateEncodingOptions),
|
||||||
|
typeof(PreStartupRoutines.RenameEnableGroupingIntoCollections)
|
||||||
};
|
};
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -0,0 +1,63 @@
|
|||||||
|
using System;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Xml.Linq;
|
||||||
|
using Emby.Server.Implementations;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
|
namespace Jellyfin.Server.Migrations.PreStartupRoutines;
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public class RenameEnableGroupingIntoCollections : IMigrationRoutine
|
||||||
|
{
|
||||||
|
private readonly ServerApplicationPaths _applicationPaths;
|
||||||
|
private readonly ILogger<RenameEnableGroupingIntoCollections> _logger;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes a new instance of the <see cref="RenameEnableGroupingIntoCollections"/> class.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="applicationPaths">An instance of <see cref="ServerApplicationPaths"/>.</param>
|
||||||
|
/// <param name="loggerFactory">An instance of the <see cref="ILoggerFactory"/> interface.</param>
|
||||||
|
public RenameEnableGroupingIntoCollections(ServerApplicationPaths applicationPaths, ILoggerFactory loggerFactory)
|
||||||
|
{
|
||||||
|
_applicationPaths = applicationPaths;
|
||||||
|
_logger = loggerFactory.CreateLogger<RenameEnableGroupingIntoCollections>();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public Guid Id => Guid.Parse("E73B777D-CD5C-4E71-957A-B86B3660B7CF");
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public string Name => nameof(RenameEnableGroupingIntoCollections);
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public bool PerformOnNewInstall => false;
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public void Perform()
|
||||||
|
{
|
||||||
|
string path = Path.Combine(_applicationPaths.ConfigurationDirectoryPath, "system.xml");
|
||||||
|
if (!File.Exists(path))
|
||||||
|
{
|
||||||
|
_logger.LogWarning("Configuration file not found: {Path}", path);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
XDocument xmlDocument = XDocument.Load(path);
|
||||||
|
var element = xmlDocument.Descendants("EnableGroupingIntoCollections").FirstOrDefault();
|
||||||
|
if (element is not null)
|
||||||
|
{
|
||||||
|
element.Name = "EnableGroupingMoviesIntoCollections";
|
||||||
|
_logger.LogInformation("The tag <EnableGroupingIntoCollections> was successfully renamed to <EnableGroupingMoviesIntoCollections>.");
|
||||||
|
xmlDocument.Save(path);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex, "An error occurred while updating the XML file: {Message}", ex.Message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1064,11 +1064,6 @@ namespace MediaBrowser.Controller.Entities
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (queryParent is Series)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (queryParent is Season)
|
if (queryParent is Season)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
@ -1088,12 +1083,15 @@ namespace MediaBrowser.Controller.Entities
|
|||||||
|
|
||||||
if (!param.HasValue)
|
if (!param.HasValue)
|
||||||
{
|
{
|
||||||
if (user is not null && !configurationManager.Configuration.EnableGroupingIntoCollections)
|
if (user is not null && query.IncludeItemTypes.Any(type =>
|
||||||
|
(type == BaseItemKind.Movie && !configurationManager.Configuration.EnableGroupingMoviesIntoCollections) ||
|
||||||
|
(type == BaseItemKind.Series && !configurationManager.Configuration.EnableGroupingShowsIntoCollections)))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (query.IncludeItemTypes.Length == 0 || query.IncludeItemTypes.Contains(BaseItemKind.Movie))
|
if (query.IncludeItemTypes.Length == 0
|
||||||
|
|| query.IncludeItemTypes.Any(type => type == BaseItemKind.Movie || type == BaseItemKind.Series))
|
||||||
{
|
{
|
||||||
param = true;
|
param = true;
|
||||||
}
|
}
|
||||||
|
@ -24,7 +24,7 @@ namespace MediaBrowser.Controller.Entities.TV
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Class Series.
|
/// Class Series.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class Series : Folder, IHasTrailers, IHasDisplayOrder, IHasLookupInfo<SeriesInfo>, IMetadataContainer
|
public class Series : Folder, IHasTrailers, IHasDisplayOrder, IHasLookupInfo<SeriesInfo>, IMetadataContainer, ISupportsBoxSetGrouping
|
||||||
{
|
{
|
||||||
public Series()
|
public Series()
|
||||||
{
|
{
|
||||||
|
@ -204,7 +204,9 @@ public class ServerConfiguration : BaseApplicationConfiguration
|
|||||||
|
|
||||||
public bool EnableFolderView { get; set; } = false;
|
public bool EnableFolderView { get; set; } = false;
|
||||||
|
|
||||||
public bool EnableGroupingIntoCollections { get; set; } = false;
|
public bool EnableGroupingMoviesIntoCollections { get; set; } = false;
|
||||||
|
|
||||||
|
public bool EnableGroupingShowsIntoCollections { get; set; } = false;
|
||||||
|
|
||||||
public bool DisplaySpecialsWithinSeasons { get; set; } = true;
|
public bool DisplaySpecialsWithinSeasons { get; set; } = true;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user