mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-07-09 03:04:24 -04:00
Remove limit of 7 home sections
This commit is contained in:
parent
3c7eb6b324
commit
f3263c7d8e
@ -1,10 +1,12 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using System.Linq;
|
||||||
using Jellyfin.Data.Entities;
|
using Jellyfin.Data.Entities;
|
||||||
using Jellyfin.Data.Enums;
|
using Jellyfin.Data.Enums;
|
||||||
using MediaBrowser.Controller;
|
using MediaBrowser.Controller;
|
||||||
using MediaBrowser.Controller.Configuration;
|
using MediaBrowser.Controller.Configuration;
|
||||||
using MediaBrowser.Controller.Net;
|
using MediaBrowser.Controller.Net;
|
||||||
using MediaBrowser.Model.Entities;
|
using MediaBrowser.Model.Entities;
|
||||||
|
using MediaBrowser.Model.Querying;
|
||||||
using MediaBrowser.Model.Services;
|
using MediaBrowser.Model.Services;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
@ -135,16 +137,19 @@ namespace MediaBrowser.Api
|
|||||||
prefs.ScrollDirection = request.ScrollDirection;
|
prefs.ScrollDirection = request.ScrollDirection;
|
||||||
prefs.HomeSections.Clear();
|
prefs.HomeSections.Clear();
|
||||||
|
|
||||||
for (int i = 0; i < 7; i++)
|
foreach (var key in request.CustomPrefs.Keys.Where(key => key.StartsWith("homesection")))
|
||||||
{
|
{
|
||||||
if (request.CustomPrefs.TryGetValue("homesection" + i, out var homeSection))
|
var order = int.Parse(key.Substring("homesection".Length));
|
||||||
|
if (!Enum.TryParse<HomeSectionType>(request.CustomPrefs[key], true, out var type))
|
||||||
{
|
{
|
||||||
prefs.HomeSections.Add(new HomeSection
|
type = order < 7 ? defaults[order] : HomeSectionType.None;
|
||||||
{
|
|
||||||
Order = i,
|
|
||||||
Type = Enum.TryParse<HomeSectionType>(homeSection, true, out var type) ? type : defaults[i]
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
prefs.HomeSections.Add(new HomeSection
|
||||||
|
{
|
||||||
|
Order = order,
|
||||||
|
Type = type
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
_displayPreferencesManager.SaveChanges(prefs);
|
_displayPreferencesManager.SaveChanges(prefs);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user