mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-08-21 05:43:19 -07:00
Set the View On Emby Url at runtime so the user can configure and change the URL and it will take effect straight away
This commit is contained in:
parent
2b414415ff
commit
2b1eebafd1
1 changed files with 15 additions and 2 deletions
|
@ -3,6 +3,8 @@ using System.Threading.Tasks;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Ombi.Core.Models.Search;
|
using Ombi.Core.Models.Search;
|
||||||
using Ombi.Core.Rule.Interfaces;
|
using Ombi.Core.Rule.Interfaces;
|
||||||
|
using Ombi.Core.Settings;
|
||||||
|
using Ombi.Core.Settings.Models.External;
|
||||||
using Ombi.Helpers;
|
using Ombi.Helpers;
|
||||||
using Ombi.Store.Entities;
|
using Ombi.Store.Entities;
|
||||||
using Ombi.Store.Repository;
|
using Ombi.Store.Repository;
|
||||||
|
@ -11,12 +13,14 @@ namespace Ombi.Core.Rule.Rules.Search
|
||||||
{
|
{
|
||||||
public class EmbyAvailabilityRule : BaseSearchRule, IRules<SearchViewModel>
|
public class EmbyAvailabilityRule : BaseSearchRule, IRules<SearchViewModel>
|
||||||
{
|
{
|
||||||
public EmbyAvailabilityRule(IEmbyContentRepository repo)
|
public EmbyAvailabilityRule(IEmbyContentRepository repo, ISettingsService<EmbySettings> s)
|
||||||
{
|
{
|
||||||
EmbyContentRepository = repo;
|
EmbyContentRepository = repo;
|
||||||
|
EmbySettings = s;
|
||||||
}
|
}
|
||||||
|
|
||||||
private IEmbyContentRepository EmbyContentRepository { get; }
|
private IEmbyContentRepository EmbyContentRepository { get; }
|
||||||
|
private ISettingsService<EmbySettings> EmbySettings { get; }
|
||||||
|
|
||||||
public async Task<RuleResult> Execute(SearchViewModel obj)
|
public async Task<RuleResult> Execute(SearchViewModel obj)
|
||||||
{
|
{
|
||||||
|
@ -60,7 +64,16 @@ namespace Ombi.Core.Rule.Rules.Search
|
||||||
if (item != null)
|
if (item != null)
|
||||||
{
|
{
|
||||||
obj.Available = true;
|
obj.Available = true;
|
||||||
obj.EmbyUrl = item.Url;
|
var s = await EmbySettings.GetSettingsAsync();
|
||||||
|
var server = s.Servers.FirstOrDefault(x => x.ServerHostname != null);
|
||||||
|
if ((server?.ServerHostname ?? string.Empty).HasValue())
|
||||||
|
{
|
||||||
|
obj.EmbyUrl = $"{server.ServerHostname}#!/itemdetails.html?id={item.EmbyId}";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
obj.EmbyUrl = $"https://app.emby.media/#!/itemdetails.html?id={item.EmbyId}";
|
||||||
|
}
|
||||||
|
|
||||||
if (obj.Type == RequestType.TvShow)
|
if (obj.Type == RequestType.TvShow)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue