From 22644075e784ccd71d39a27eae6d1f7434f47a00 Mon Sep 17 00:00:00 2001 From: dkanada Date: Sun, 12 Apr 2026 12:42:49 +0900 Subject: add NameStartsWith and NameLessThan filters to Person search --- MediaBrowser.Controller/Entities/InternalPeopleQuery.cs | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'MediaBrowser.Controller') diff --git a/MediaBrowser.Controller/Entities/InternalPeopleQuery.cs b/MediaBrowser.Controller/Entities/InternalPeopleQuery.cs index f4b3910b0e..373ec7ffeb 100644 --- a/MediaBrowser.Controller/Entities/InternalPeopleQuery.cs +++ b/MediaBrowser.Controller/Entities/InternalPeopleQuery.cs @@ -42,6 +42,10 @@ namespace MediaBrowser.Controller.Entities public string NameContains { get; set; } + public string NameStartsWith { get; set; } + + public string NameLessThan { get; set; } + public User User { get; set; } public bool? IsFavorite { get; set; } -- cgit v1.2.3 From bb265cd4030e966aec1afbd31eafc0973531c232 Mon Sep 17 00:00:00 2001 From: dkanada Date: Mon, 13 Apr 2026 13:50:04 +0900 Subject: add NameStartsWithOrGreater parameter to Persons endpoint --- Jellyfin.Api/Controllers/PersonsController.cs | 3 +++ Jellyfin.Server.Implementations/Item/PeopleRepository.cs | 5 +++++ MediaBrowser.Controller/Entities/InternalPeopleQuery.cs | 2 ++ 3 files changed, 10 insertions(+) (limited to 'MediaBrowser.Controller') diff --git a/Jellyfin.Api/Controllers/PersonsController.cs b/Jellyfin.Api/Controllers/PersonsController.cs index a113ded049..1811a219ac 100644 --- a/Jellyfin.Api/Controllers/PersonsController.cs +++ b/Jellyfin.Api/Controllers/PersonsController.cs @@ -52,6 +52,7 @@ public class PersonsController : BaseJellyfinApiController /// The search term. /// Optional. Filter by items whose name starts with the given input string. /// Optional. Filter by items whose name will appear before this value when sorted alphabetically. + /// Optional. Filter by items whose name will appear after this value when sorted alphabetically. /// Optional. Specify additional fields of information to return in the output. /// Optional. Specify additional filters to apply. /// Optional filter by items that are marked as favorite, or not. userId is required. @@ -74,6 +75,7 @@ public class PersonsController : BaseJellyfinApiController [FromQuery] string? searchTerm, [FromQuery] string? nameStartsWith, [FromQuery] string? nameLessThan, + [FromQuery] string? nameStartsWithOrGreater, [FromQuery, ModelBinder(typeof(CommaDelimitedCollectionModelBinder))] ItemFields[] fields, [FromQuery, ModelBinder(typeof(CommaDelimitedCollectionModelBinder))] ItemFilter[] filters, [FromQuery] bool? isFavorite, @@ -103,6 +105,7 @@ public class PersonsController : BaseJellyfinApiController NameContains = searchTerm, NameStartsWith = nameStartsWith, NameLessThan = nameLessThan, + NameStartsWithOrGreater = nameStartsWithOrGreater, User = user, IsFavorite = !isFavorite.HasValue && isFavoriteInFilters ? true : isFavorite, AppearsInItemId = appearsInItemId ?? Guid.Empty, diff --git a/Jellyfin.Server.Implementations/Item/PeopleRepository.cs b/Jellyfin.Server.Implementations/Item/PeopleRepository.cs index adb5e08cf9..7147fbfe7d 100644 --- a/Jellyfin.Server.Implementations/Item/PeopleRepository.cs +++ b/Jellyfin.Server.Implementations/Item/PeopleRepository.cs @@ -245,6 +245,11 @@ public class PeopleRepository(IDbContextFactory dbProvider, I query = query.Where(e => e.Name.CompareTo(filter.NameLessThan.ToLowerInvariant()) < 0); } + if (!string.IsNullOrWhiteSpace(filter.NameStartsWithOrGreater)) + { + query = query.Where(e => e.Name.CompareTo(filter.NameStartsWithOrGreater.ToLowerInvariant()) >= 0); + } + return query; } diff --git a/MediaBrowser.Controller/Entities/InternalPeopleQuery.cs b/MediaBrowser.Controller/Entities/InternalPeopleQuery.cs index 373ec7ffeb..e12ba22343 100644 --- a/MediaBrowser.Controller/Entities/InternalPeopleQuery.cs +++ b/MediaBrowser.Controller/Entities/InternalPeopleQuery.cs @@ -46,6 +46,8 @@ namespace MediaBrowser.Controller.Entities public string NameLessThan { get; set; } + public string NameStartsWithOrGreater { get; set; } + public User User { get; set; } public bool? IsFavorite { get; set; } -- cgit v1.2.3 From 4f1ad3fee0abff7244b738ecff792dcf17feab49 Mon Sep 17 00:00:00 2001 From: Bond_009 Date: Sat, 18 Apr 2026 17:31:29 +0200 Subject: Update to Jellyfin.XmlTv 10.12.0-pre1 --- Directory.Packages.props | 2 +- MediaBrowser.Controller/LiveTv/ProgramInfo.cs | 44 +++++++++++----------- .../Listings/XmlTvListingsProvider.cs | 41 ++++++++++---------- 3 files changed, 43 insertions(+), 44 deletions(-) (limited to 'MediaBrowser.Controller') diff --git a/Directory.Packages.props b/Directory.Packages.props index 34e6a02ff9..d2b715d6aa 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -22,7 +22,7 @@ - + diff --git a/MediaBrowser.Controller/LiveTv/ProgramInfo.cs b/MediaBrowser.Controller/LiveTv/ProgramInfo.cs index 3c3ac2471f..905aad17b9 100644 --- a/MediaBrowser.Controller/LiveTv/ProgramInfo.cs +++ b/MediaBrowser.Controller/LiveTv/ProgramInfo.cs @@ -1,5 +1,3 @@ -#nullable disable - #pragma warning disable CS1591 using System; @@ -12,45 +10,45 @@ namespace MediaBrowser.Controller.LiveTv { public ProgramInfo() { - Genres = new List(); + Genres = []; - ProviderIds = new Dictionary(StringComparer.OrdinalIgnoreCase); - SeriesProviderIds = new Dictionary(StringComparer.OrdinalIgnoreCase); + ProviderIds = new Dictionary(StringComparer.OrdinalIgnoreCase); + SeriesProviderIds = new Dictionary(StringComparer.OrdinalIgnoreCase); } /// /// Gets or sets the id of the program. /// - public string Id { get; set; } + public string? Id { get; set; } /// /// Gets or sets the channel identifier. /// /// The channel identifier. - public string ChannelId { get; set; } + public string? ChannelId { get; set; } /// /// Gets or sets the name of the program. /// - public string Name { get; set; } + public string? Name { get; set; } /// /// Gets or sets the official rating. /// /// The official rating. - public string OfficialRating { get; set; } + public string? OfficialRating { get; set; } /// /// Gets or sets the overview. /// /// The overview. - public string Overview { get; set; } + public string? Overview { get; set; } /// /// Gets or sets the short overview. /// /// The short overview. - public string ShortOverview { get; set; } + public string? ShortOverview { get; set; } /// /// Gets or sets the start date of the program, in UTC. @@ -108,25 +106,25 @@ namespace MediaBrowser.Controller.LiveTv /// Gets or sets the episode title. /// /// The episode title. - public string EpisodeTitle { get; set; } + public string? EpisodeTitle { get; set; } /// /// Gets or sets the image path if it can be accessed directly from the file system. /// /// The image path. - public string ImagePath { get; set; } + public string? ImagePath { get; set; } /// /// Gets or sets the image url if it can be downloaded. /// /// The image URL. - public string ImageUrl { get; set; } + public string? ImageUrl { get; set; } - public string ThumbImageUrl { get; set; } + public string? ThumbImageUrl { get; set; } - public string LogoImageUrl { get; set; } + public string? LogoImageUrl { get; set; } - public string BackdropImageUrl { get; set; } + public string? BackdropImageUrl { get; set; } /// /// Gets or sets a value indicating whether this instance has image. @@ -188,19 +186,19 @@ namespace MediaBrowser.Controller.LiveTv /// Gets or sets the home page URL. /// /// The home page URL. - public string HomePageUrl { get; set; } + public string? HomePageUrl { get; set; } /// /// Gets or sets the series identifier. /// /// The series identifier. - public string SeriesId { get; set; } + public string? SeriesId { get; set; } /// /// Gets or sets the show identifier. /// /// The show identifier. - public string ShowId { get; set; } + public string? ShowId { get; set; } /// /// Gets or sets the season number. @@ -218,10 +216,10 @@ namespace MediaBrowser.Controller.LiveTv /// Gets or sets the etag. /// /// The etag. - public string Etag { get; set; } + public string? Etag { get; set; } - public Dictionary ProviderIds { get; set; } + public Dictionary ProviderIds { get; set; } - public Dictionary SeriesProviderIds { get; set; } + public Dictionary SeriesProviderIds { get; set; } } } diff --git a/src/Jellyfin.LiveTv/Listings/XmlTvListingsProvider.cs b/src/Jellyfin.LiveTv/Listings/XmlTvListingsProvider.cs index b5c884bd10..318c3a2d36 100644 --- a/src/Jellyfin.LiveTv/Listings/XmlTvListingsProvider.cs +++ b/src/Jellyfin.LiveTv/Listings/XmlTvListingsProvider.cs @@ -1,5 +1,3 @@ -#nullable disable - #pragma warning disable CS1591 using System; @@ -62,21 +60,21 @@ namespace Jellyfin.LiveTv.Listings _logger.LogInformation("xmltv path: {Path}", info.Path); string cacheFilename = info.Id + ".xml"; - string cacheFile = Path.Combine(_config.ApplicationPaths.CachePath, "xmltv", cacheFilename); - - if (File.Exists(cacheFile) && File.GetLastWriteTimeUtc(cacheFile) >= DateTime.UtcNow.Subtract(_maxCacheAge)) - { - return cacheFile; - } + string cacheDir = Path.Join(_config.ApplicationPaths.CachePath, "xmltv"); + string cacheFile = Path.Join(cacheDir, cacheFilename); - // Must check if file exists as parent directory may not exist. if (File.Exists(cacheFile)) { + if (File.GetLastWriteTimeUtc(cacheFile) >= DateTime.UtcNow.Subtract(_maxCacheAge)) + { + return cacheFile; + } + File.Delete(cacheFile); } else { - Directory.CreateDirectory(Path.GetDirectoryName(cacheFile)); + Directory.CreateDirectory(cacheDir); } if (info.Path.StartsWith("http", StringComparison.OrdinalIgnoreCase)) @@ -154,22 +152,25 @@ namespace Jellyfin.LiveTv.Listings private static ProgramInfo GetProgramInfo(XmlTvProgram program, ListingsProviderInfo info) { - string episodeTitle = program.Episode.Title; + string? episodeTitle = program.Episode?.Title; var programCategories = program.Categories.Where(c => !string.IsNullOrWhiteSpace(c)).ToList(); + var imageUrl = program.Icons.FirstOrDefault()?.Source; + var rating = program.Ratings.FirstOrDefault()?.Value; + var starRating = program.StarRatings?.FirstOrDefault()?.StarRating; var programInfo = new ProgramInfo { ChannelId = program.ChannelId, EndDate = program.EndDate.UtcDateTime, - EpisodeNumber = program.Episode.Episode, + EpisodeNumber = program.Episode?.Episode, EpisodeTitle = episodeTitle, Genres = programCategories, StartDate = program.StartDate.UtcDateTime, Name = program.Title, Overview = program.Description, ProductionYear = program.CopyrightDate?.Year, - SeasonNumber = program.Episode.Series, - IsSeries = program.Episode.Episode is not null, + SeasonNumber = program.Episode?.Series, + IsSeries = program.Episode?.Episode is not null, IsRepeat = program.IsPreviouslyShown && !program.IsNew, IsPremiere = program.Premiere is not null, IsLive = program.IsLive, @@ -177,11 +178,11 @@ namespace Jellyfin.LiveTv.Listings IsMovie = programCategories.Any(c => info.MovieCategories.Contains(c, StringComparison.OrdinalIgnoreCase)), IsNews = programCategories.Any(c => info.NewsCategories.Contains(c, StringComparison.OrdinalIgnoreCase)), IsSports = programCategories.Any(c => info.SportsCategories.Contains(c, StringComparison.OrdinalIgnoreCase)), - ImageUrl = string.IsNullOrEmpty(program.Icon?.Source) ? null : program.Icon.Source, - HasImage = !string.IsNullOrEmpty(program.Icon?.Source), - OfficialRating = string.IsNullOrEmpty(program.Rating?.Value) ? null : program.Rating.Value, - CommunityRating = program.StarRating, - SeriesId = program.Episode.Episode is null ? null : program.Title?.GetMD5().ToString("N", CultureInfo.InvariantCulture) + ImageUrl = string.IsNullOrEmpty(imageUrl) ? null : imageUrl, + HasImage = !string.IsNullOrEmpty(imageUrl), + OfficialRating = string.IsNullOrEmpty(rating) ? null : rating, + CommunityRating = starRating is null ? null : (float)starRating.Value, + SeriesId = program.Episode?.Episode is null ? null : program.Title?.GetMD5().ToString("N", CultureInfo.InvariantCulture) }; if (string.IsNullOrWhiteSpace(program.ProgramId)) @@ -262,7 +263,7 @@ namespace Jellyfin.LiveTv.Listings { Id = c.Id, Name = c.DisplayName, - ImageUrl = string.IsNullOrEmpty(c.Icon?.Source) ? null : c.Icon.Source, + ImageUrl = string.IsNullOrEmpty(c.Icons.FirstOrDefault()?.Source) ? null : c.Icons.FirstOrDefault()!.Source, Number = string.IsNullOrWhiteSpace(c.Number) ? c.Id : c.Number }).ToList(); } -- cgit v1.2.3