fix(emby/jellyfin): 🐛 Fixed another issue where we were not correctly displaying the correct status' for movies

This commit is contained in:
tidusjar 2022-02-22 16:41:37 +00:00
commit 5c0556e6f4
8 changed files with 37 additions and 46 deletions

View file

@ -4,9 +4,9 @@ using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Logging;
using Ombi.Core.Models.Search;
using Ombi.Core.Rule.Interfaces;
using Ombi.Core.Settings;
using Ombi.Core.Settings.Models.External;
using Ombi.Core.Services;
using Ombi.Helpers;
using Ombi.Settings.Settings.Models;
using Ombi.Store.Entities;
using Ombi.Store.Repository;
@ -14,16 +14,17 @@ namespace Ombi.Core.Rule.Rules.Search
{
public class EmbyAvailabilityRule : BaseSearchRule, IRules<SearchViewModel>
{
public EmbyAvailabilityRule(IEmbyContentRepository repo, ILogger<EmbyAvailabilityRule> log, ISettingsService<EmbySettings> s)
private readonly IFeatureService _featureService;
public EmbyAvailabilityRule(IEmbyContentRepository repo, ILogger<EmbyAvailabilityRule> log, IFeatureService featureService)
{
EmbyContentRepository = repo;
Log = log;
EmbySettings = s;
_featureService = featureService;
}
private IEmbyContentRepository EmbyContentRepository { get; }
private ILogger Log { get; }
private ISettingsService<EmbySettings> EmbySettings { get; }
public async Task<RuleResult> Execute(SearchViewModel obj)
{
@ -68,13 +69,14 @@ namespace Ombi.Core.Rule.Rules.Search
{
if (obj is SearchMovieViewModel movie)
{
if (item.Has4K)
var is4kEnabled = await _featureService.FeatureEnabled(FeatureNames.Movie4KRequests);
if (item.Has4K && is4kEnabled)
{
movie.Available4K = true;
obj.EmbyUrl = item.Url;
}
if (item.Quality.HasValue())
else
{
obj.Available = true;
obj.EmbyUrl = item.Url;

View file

@ -4,9 +4,9 @@ using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Logging;
using Ombi.Core.Models.Search;
using Ombi.Core.Rule.Interfaces;
using Ombi.Core.Settings;
using Ombi.Core.Settings.Models.External;
using Ombi.Core.Services;
using Ombi.Helpers;
using Ombi.Settings.Settings.Models;
using Ombi.Store.Entities;
using Ombi.Store.Repository;
@ -14,16 +14,17 @@ namespace Ombi.Core.Rule.Rules.Search
{
public class JellyfinAvailabilityRule : BaseSearchRule, IRules<SearchViewModel>
{
public JellyfinAvailabilityRule(IJellyfinContentRepository repo, ILogger<JellyfinAvailabilityRule> log, ISettingsService<JellyfinSettings> s)
private readonly IFeatureService _featureService;
public JellyfinAvailabilityRule(IJellyfinContentRepository repo, ILogger<JellyfinAvailabilityRule> log, IFeatureService featureService)
{
JellyfinContentRepository = repo;
Log = log;
JellyfinSettings = s;
_featureService = featureService;
}
private IJellyfinContentRepository JellyfinContentRepository { get; }
private ILogger Log { get; }
private ISettingsService<JellyfinSettings> JellyfinSettings { get; }
public async Task<RuleResult> Execute(SearchViewModel obj)
{
@ -82,13 +83,13 @@ namespace Ombi.Core.Rule.Rules.Search
}
if (obj is SearchMovieViewModel movie)
{
if (item.Has4K)
var is4kEnabled = await _featureService.FeatureEnabled(FeatureNames.Movie4KRequests);
if (item.Has4K && is4kEnabled)
{
movie.Available4K = true;
obj.JellyfinUrl = item.Url;
}
if (item.Quality.HasValue())
else
{
obj.Available = true;
obj.EmbyUrl = item.Url;