diff --git a/TMDbBoxSets.sln b/Jellyfin.Plugin.TMDbBoxSets.sln similarity index 81% rename from TMDbBoxSets.sln rename to Jellyfin.Plugin.TMDbBoxSets.sln index bcf4553..ecc59c1 100644 --- a/TMDbBoxSets.sln +++ b/Jellyfin.Plugin.TMDbBoxSets.sln @@ -3,7 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 15 VisualStudioVersion = 15.0.28307.136 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TMDbBoxSets", "TMDbBoxSets\TMDbBoxSets.csproj", "{A6C0029B-F304-4577-92D3-32153DCE1FDC}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Jellyfin.Plugin.TMDbBoxSets", "Jellyfin.Plugin.TMDbBoxSets\Jellyfin.Plugin.TMDbBoxSets.csproj", "{A6C0029B-F304-4577-92D3-32153DCE1FDC}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution diff --git a/TMDbBoxSets/Api/TMDbCollectionsService.cs b/Jellyfin.Plugin.TMDbBoxSets/Api/TMDbCollectionsService.cs similarity index 95% rename from TMDbBoxSets/Api/TMDbCollectionsService.cs rename to Jellyfin.Plugin.TMDbBoxSets/Api/TMDbCollectionsService.cs index 11b5123..9a6794c 100644 --- a/TMDbBoxSets/Api/TMDbCollectionsService.cs +++ b/Jellyfin.Plugin.TMDbBoxSets/Api/TMDbCollectionsService.cs @@ -2,7 +2,7 @@ using System; using MediaBrowser.Model.Services; using Microsoft.Extensions.Logging; -namespace TMDbBoxSets.Api +namespace Jellyfin.Plugin.TMDbBoxSets.Api { [Route("/TMDbCollections/Refresh", "POST", Summary = "Refreshes collection metadata for all movies")] public class RefreshMetadataRequest : IReturnVoid diff --git a/TMDbBoxSets/Configuration/PluginConfiguration.cs b/Jellyfin.Plugin.TMDbBoxSets/Configuration/PluginConfiguration.cs similarity index 76% rename from TMDbBoxSets/Configuration/PluginConfiguration.cs rename to Jellyfin.Plugin.TMDbBoxSets/Configuration/PluginConfiguration.cs index 6dadb92..5a4abf5 100644 --- a/TMDbBoxSets/Configuration/PluginConfiguration.cs +++ b/Jellyfin.Plugin.TMDbBoxSets/Configuration/PluginConfiguration.cs @@ -1,6 +1,6 @@ using MediaBrowser.Model.Plugins; -namespace TMDbBoxSets.Configuration +namespace Jellyfin.Plugin.TMDbBoxSets.Configuration { public class PluginConfiguration : BasePluginConfiguration { diff --git a/TMDbBoxSets/TMDbBoxSets.csproj b/Jellyfin.Plugin.TMDbBoxSets/Jellyfin.Plugin.TMDbBoxSets.csproj similarity index 100% rename from TMDbBoxSets/TMDbBoxSets.csproj rename to Jellyfin.Plugin.TMDbBoxSets/Jellyfin.Plugin.TMDbBoxSets.csproj diff --git a/TMDbBoxSets/Plugin.cs b/Jellyfin.Plugin.TMDbBoxSets/Plugin.cs similarity index 93% rename from TMDbBoxSets/Plugin.cs rename to Jellyfin.Plugin.TMDbBoxSets/Plugin.cs index fca027f..83a6b97 100644 --- a/TMDbBoxSets/Plugin.cs +++ b/Jellyfin.Plugin.TMDbBoxSets/Plugin.cs @@ -1,12 +1,12 @@ using System; using System.Collections.Generic; +using Jellyfin.Plugin.TMDbBoxSets.Configuration; using MediaBrowser.Common.Configuration; using MediaBrowser.Common.Plugins; using MediaBrowser.Model.Plugins; using MediaBrowser.Model.Serialization; -using TMDbBoxSets.Configuration; -namespace TMDbBoxSets +namespace Jellyfin.Plugin.TMDbBoxSets { public class Plugin : BasePlugin, IHasWebPages { diff --git a/Jellyfin.Plugin.TMDbBoxSets/ScheduledTasks/RefreshLibraryTask.cs b/Jellyfin.Plugin.TMDbBoxSets/ScheduledTasks/RefreshLibraryTask.cs new file mode 100644 index 0000000..01c50f9 --- /dev/null +++ b/Jellyfin.Plugin.TMDbBoxSets/ScheduledTasks/RefreshLibraryTask.cs @@ -0,0 +1,43 @@ +using System; +using System.Collections.Generic; +using System.Threading; +using System.Threading.Tasks; +using MediaBrowser.Controller.Collections; +using MediaBrowser.Controller.Library; +using MediaBrowser.Model.Tasks; +using Microsoft.Extensions.Logging; + +namespace Jellyfin.Plugin.TMDbBoxSets.ScheduledTasks +{ + public class RefreshLibraryTask : IScheduledTask + { + private readonly ILogger _logger; + private readonly TMDbBoxSetManager _tmDbBoxSetManager; + + public RefreshLibraryTask(ILibraryManager libraryManager, ICollectionManager collectionManager, ILogger logger) + { + _logger = logger; + _tmDbBoxSetManager = new TMDbBoxSetManager(libraryManager, collectionManager, logger); + } + public Task Execute(CancellationToken cancellationToken, IProgress progress) + { + _logger.LogInformation("Starting TMDbBoxSets refresh library task"); + _tmDbBoxSetManager.ScanLibrary(progress); + _logger.LogInformation("TMDbBoxSets refresh library task finished"); + return Task.CompletedTask; + } + + public IEnumerable GetDefaultTriggers() + { + // Run this task every 24 hours + return new[] { + new TaskTriggerInfo { Type = TaskTriggerInfo.TriggerInterval, IntervalTicks = TimeSpan.FromHours(24).Ticks} + }; + } + + public string Name => "Scan library for new box sets"; + public string Key => "TMDbBoxSetsRefreshLibraryTask"; + public string Description => "Scans all libraries for movies and adds them to box sets if the conditions are met"; + public string Category => "TMDb"; + } +} diff --git a/TMDbBoxSets/TMDbBoxSetManager.cs b/Jellyfin.Plugin.TMDbBoxSets/TMDbBoxSetManager.cs similarity index 96% rename from TMDbBoxSets/TMDbBoxSetManager.cs rename to Jellyfin.Plugin.TMDbBoxSets/TMDbBoxSetManager.cs index c6f9bf1..5a17b5a 100644 --- a/TMDbBoxSets/TMDbBoxSetManager.cs +++ b/Jellyfin.Plugin.TMDbBoxSets/TMDbBoxSetManager.cs @@ -12,7 +12,7 @@ using MediaBrowser.Model.Entities; using MediaBrowser.Model.Querying; using Microsoft.Extensions.Logging; -namespace TMDbBoxSets +namespace Jellyfin.Plugin.TMDbBoxSets { public class TMDbBoxSetManager : IServerEntryPoint {