mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-07-15 01:32:55 -07:00
Trigger a metadata refresh when we finish scanning the libraries
This commit is contained in:
parent
6b2e9760e3
commit
0c7a13f728
4 changed files with 14 additions and 5 deletions
|
@ -9,6 +9,7 @@ using Ombi.Api.Emby.Models.Movie;
|
||||||
using Ombi.Core.Settings;
|
using Ombi.Core.Settings;
|
||||||
using Ombi.Core.Settings.Models.External;
|
using Ombi.Core.Settings.Models.External;
|
||||||
using Ombi.Helpers;
|
using Ombi.Helpers;
|
||||||
|
using Ombi.Schedule.Jobs.Ombi;
|
||||||
using Ombi.Store.Entities;
|
using Ombi.Store.Entities;
|
||||||
using Ombi.Store.Repository;
|
using Ombi.Store.Repository;
|
||||||
using Serilog;
|
using Serilog;
|
||||||
|
@ -19,13 +20,14 @@ namespace Ombi.Schedule.Jobs.Emby
|
||||||
public class EmbyContentSync : IEmbyContentSync
|
public class EmbyContentSync : IEmbyContentSync
|
||||||
{
|
{
|
||||||
public EmbyContentSync(ISettingsService<EmbySettings> settings, IEmbyApi api, ILogger<EmbyContentSync> logger,
|
public EmbyContentSync(ISettingsService<EmbySettings> settings, IEmbyApi api, ILogger<EmbyContentSync> logger,
|
||||||
IEmbyContentRepository repo, IEmbyEpisodeSync epSync)
|
IEmbyContentRepository repo, IEmbyEpisodeSync epSync, IRefreshMetadata metadata)
|
||||||
{
|
{
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
_settings = settings;
|
_settings = settings;
|
||||||
_api = api;
|
_api = api;
|
||||||
_repo = repo;
|
_repo = repo;
|
||||||
_episodeSync = epSync;
|
_episodeSync = epSync;
|
||||||
|
_metadata = metadata;
|
||||||
_settings.ClearCache();
|
_settings.ClearCache();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,6 +36,7 @@ namespace Ombi.Schedule.Jobs.Emby
|
||||||
private readonly IEmbyApi _api;
|
private readonly IEmbyApi _api;
|
||||||
private readonly IEmbyContentRepository _repo;
|
private readonly IEmbyContentRepository _repo;
|
||||||
private readonly IEmbyEpisodeSync _episodeSync;
|
private readonly IEmbyEpisodeSync _episodeSync;
|
||||||
|
private readonly IRefreshMetadata _metadata;
|
||||||
|
|
||||||
|
|
||||||
public async Task Start()
|
public async Task Start()
|
||||||
|
@ -56,6 +59,7 @@ namespace Ombi.Schedule.Jobs.Emby
|
||||||
|
|
||||||
// Episodes
|
// Episodes
|
||||||
BackgroundJob.Enqueue(() => _episodeSync.Start());
|
BackgroundJob.Enqueue(() => _episodeSync.Start());
|
||||||
|
BackgroundJob.Enqueue(() => _metadata.Start());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -37,6 +37,7 @@ using Ombi.Api.Plex.Models;
|
||||||
using Ombi.Core.Settings;
|
using Ombi.Core.Settings;
|
||||||
using Ombi.Core.Settings.Models.External;
|
using Ombi.Core.Settings.Models.External;
|
||||||
using Ombi.Helpers;
|
using Ombi.Helpers;
|
||||||
|
using Ombi.Schedule.Jobs.Ombi;
|
||||||
using Ombi.Schedule.Jobs.Plex.Interfaces;
|
using Ombi.Schedule.Jobs.Plex.Interfaces;
|
||||||
using Ombi.Store.Entities;
|
using Ombi.Store.Entities;
|
||||||
using Ombi.Store.Repository;
|
using Ombi.Store.Repository;
|
||||||
|
@ -46,13 +47,14 @@ namespace Ombi.Schedule.Jobs.Plex
|
||||||
public class PlexContentSync : IPlexContentSync
|
public class PlexContentSync : IPlexContentSync
|
||||||
{
|
{
|
||||||
public PlexContentSync(ISettingsService<PlexSettings> plex, IPlexApi plexApi, ILogger<PlexContentSync> logger, IPlexContentRepository repo,
|
public PlexContentSync(ISettingsService<PlexSettings> plex, IPlexApi plexApi, ILogger<PlexContentSync> logger, IPlexContentRepository repo,
|
||||||
IPlexEpisodeSync epsiodeSync)
|
IPlexEpisodeSync epsiodeSync, IRefreshMetadata metadataRefresh)
|
||||||
{
|
{
|
||||||
Plex = plex;
|
Plex = plex;
|
||||||
PlexApi = plexApi;
|
PlexApi = plexApi;
|
||||||
Logger = logger;
|
Logger = logger;
|
||||||
Repo = repo;
|
Repo = repo;
|
||||||
EpisodeSync = epsiodeSync;
|
EpisodeSync = epsiodeSync;
|
||||||
|
Metadata = metadataRefresh;
|
||||||
plex.ClearCache();
|
plex.ClearCache();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -61,6 +63,7 @@ namespace Ombi.Schedule.Jobs.Plex
|
||||||
private ILogger<PlexContentSync> Logger { get; }
|
private ILogger<PlexContentSync> Logger { get; }
|
||||||
private IPlexContentRepository Repo { get; }
|
private IPlexContentRepository Repo { get; }
|
||||||
private IPlexEpisodeSync EpisodeSync { get; }
|
private IPlexEpisodeSync EpisodeSync { get; }
|
||||||
|
private IRefreshMetadata Metadata { get; }
|
||||||
|
|
||||||
public async Task CacheContent(bool recentlyAddedSearch = false)
|
public async Task CacheContent(bool recentlyAddedSearch = false)
|
||||||
{
|
{
|
||||||
|
@ -87,6 +90,7 @@ namespace Ombi.Schedule.Jobs.Plex
|
||||||
|
|
||||||
Logger.LogInformation("Starting EP Cacher");
|
Logger.LogInformation("Starting EP Cacher");
|
||||||
BackgroundJob.Enqueue(() => EpisodeSync.Start());
|
BackgroundJob.Enqueue(() => EpisodeSync.Start());
|
||||||
|
BackgroundJob.Enqueue(() => Metadata.Start());
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task StartTheCache(PlexSettings plexSettings, bool recentlyAddedSearch)
|
private async Task StartTheCache(PlexSettings plexSettings, bool recentlyAddedSearch)
|
||||||
|
|
|
@ -50,12 +50,13 @@ namespace Ombi.Schedule.Jobs.Plex
|
||||||
await Cache(server);
|
await Cache(server);
|
||||||
}
|
}
|
||||||
|
|
||||||
BackgroundJob.Enqueue(() => _availabilityChecker.Start());
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
_log.LogError(LoggingEvents.Cacher, e, "Caching Episodes Failed");
|
_log.LogError(LoggingEvents.Cacher, e, "Caching Episodes Failed");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BackgroundJob.Enqueue(() => _availabilityChecker.Start());
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task Cache(PlexServers settings)
|
private async Task Cache(PlexServers settings)
|
||||||
|
|
|
@ -21,7 +21,7 @@ namespace Ombi.Settings.Settings.Models
|
||||||
}
|
}
|
||||||
public static string PlexContent(JobSettings s)
|
public static string PlexContent(JobSettings s)
|
||||||
{
|
{
|
||||||
return Get(s.PlexContentSync, Cron.HourInterval(6));
|
return Get(s.PlexContentSync, Cron.Daily(2));
|
||||||
}
|
}
|
||||||
public static string PlexRecentlyAdded(JobSettings s)
|
public static string PlexRecentlyAdded(JobSettings s)
|
||||||
{
|
{
|
||||||
|
@ -50,7 +50,7 @@ namespace Ombi.Settings.Settings.Models
|
||||||
}
|
}
|
||||||
public static string RefreshMetadata(JobSettings s)
|
public static string RefreshMetadata(JobSettings s)
|
||||||
{
|
{
|
||||||
return Get(s.RefreshMetadata, Cron.Daily(3));
|
return Get(s.RefreshMetadata, Cron.DayInterval(2));
|
||||||
}
|
}
|
||||||
|
|
||||||
private static string Get(string settings, string defaultCron)
|
private static string Get(string settings, string defaultCron)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue