mirror of
https://github.com/jellyfin/jellyfin-plugin-tmdbboxsets.git
synced 2024-11-23 14:09:53 +00:00
commit
bca2760706
@ -15,11 +15,11 @@ namespace Jellyfin.Plugin.TMDbBoxSets.Api
|
||||
public class TMDbCollectionsService : IService
|
||||
{
|
||||
private readonly TMDbBoxSetManager _tmDbBoxSetManager;
|
||||
private readonly ILogger _logger;
|
||||
private readonly ILogger<TMDbCollectionsService> _logger;
|
||||
|
||||
public TMDbCollectionsService(ILibraryManager libraryManager, ICollectionManager collectionManager, ILogger logger)
|
||||
public TMDbCollectionsService(ILibraryManager libraryManager, ICollectionManager collectionManager, ILogger<TMDbCollectionsService> logger, ILogger<TMDbBoxSetManager> boxset_logger)
|
||||
{
|
||||
_tmDbBoxSetManager = new TMDbBoxSetManager(libraryManager, collectionManager, logger);
|
||||
_tmDbBoxSetManager = new TMDbBoxSetManager(libraryManager, collectionManager, boxset_logger);
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
|
@ -3,12 +3,12 @@
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netstandard2.1</TargetFramework>
|
||||
<IsPackable>true</IsPackable>
|
||||
<AssemblyVersion>5.0.0.0</AssemblyVersion>
|
||||
<FileVersion>5.0.0.0</FileVersion>
|
||||
<AssemblyVersion>6.0.0.0</AssemblyVersion>
|
||||
<FileVersion>6.0.0.0</FileVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Jellyfin.Controller" Version="10.*" />
|
||||
<PackageReference Include="Jellyfin.Controller" Version="10.*-*" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
@ -11,13 +11,13 @@ namespace Jellyfin.Plugin.TMDbBoxSets.ScheduledTasks
|
||||
{
|
||||
public class RefreshLibraryTask : IScheduledTask
|
||||
{
|
||||
private readonly ILogger _logger;
|
||||
private readonly ILogger<RefreshLibraryTask> _logger;
|
||||
private readonly TMDbBoxSetManager _tmDbBoxSetManager;
|
||||
|
||||
public RefreshLibraryTask(ILibraryManager libraryManager, ICollectionManager collectionManager, ILogger logger)
|
||||
public RefreshLibraryTask(ILibraryManager libraryManager, ICollectionManager collectionManager, ILogger<RefreshLibraryTask> logger, ILogger<TMDbBoxSetManager> boxset_logger)
|
||||
{
|
||||
_logger = logger;
|
||||
_tmDbBoxSetManager = new TMDbBoxSetManager(libraryManager, collectionManager, logger);
|
||||
_tmDbBoxSetManager = new TMDbBoxSetManager(libraryManager, collectionManager, boxset_logger);
|
||||
}
|
||||
public Task Execute(CancellationToken cancellationToken, IProgress<double> progress)
|
||||
{
|
||||
|
@ -20,9 +20,9 @@ namespace Jellyfin.Plugin.TMDbBoxSets
|
||||
private readonly ICollectionManager _collectionManager;
|
||||
private readonly Timer _timer;
|
||||
private readonly HashSet<string> _queuedTmdbCollectionIds;
|
||||
private readonly ILogger _logger; // TODO logging
|
||||
private readonly ILogger<TMDbBoxSetManager> _logger; // TODO logging
|
||||
|
||||
public TMDbBoxSetManager(ILibraryManager libraryManager, ICollectionManager collectionManager, ILogger logger)
|
||||
public TMDbBoxSetManager(ILibraryManager libraryManager, ICollectionManager collectionManager, ILogger<TMDbBoxSetManager> logger)
|
||||
{
|
||||
_libraryManager = libraryManager;
|
||||
_collectionManager = collectionManager;
|
||||
@ -54,7 +54,7 @@ namespace Jellyfin.Plugin.TMDbBoxSets
|
||||
boxSet = _collectionManager.CreateCollection(new CollectionCreationOptions
|
||||
{
|
||||
Name = tmdbCollectionName,
|
||||
ProviderIds = new Dictionary<string, string> {{MetadataProviders.Tmdb.ToString(), tmdbCollectionId}}
|
||||
ProviderIds = new Dictionary<string, string> {{MetadataProvider.Tmdb.ToString(), tmdbCollectionId}}
|
||||
});
|
||||
}
|
||||
|
||||
@ -89,8 +89,8 @@ namespace Jellyfin.Plugin.TMDbBoxSets
|
||||
|
||||
// We are only interested in movies that belong to a TMDb collection
|
||||
return movies.Where(m =>
|
||||
m.HasProviderId(MetadataProviders.TmdbCollection) &&
|
||||
!string.IsNullOrWhiteSpace(m.GetProviderId(MetadataProviders.TmdbCollection))).ToList();
|
||||
m.HasProviderId(MetadataProvider.TmdbCollection) &&
|
||||
!string.IsNullOrWhiteSpace(m.GetProviderId(MetadataProvider.TmdbCollection))).ToList();
|
||||
}
|
||||
|
||||
private IReadOnlyCollection<BoxSet> GetAllBoxSetsFromLibrary()
|
||||
@ -109,7 +109,7 @@ namespace Jellyfin.Plugin.TMDbBoxSets
|
||||
var boxSets = GetAllBoxSetsFromLibrary();
|
||||
|
||||
var movieCollections = GetMoviesFromLibrary()
|
||||
.GroupBy(m => m.GetProviderId(MetadataProviders.TmdbCollection))
|
||||
.GroupBy(m => m.GetProviderId(MetadataProvider.TmdbCollection))
|
||||
.ToArray();
|
||||
|
||||
_logger.LogInformation("Found {Count} TMDb collection(s) across all movies", movieCollections.Length);
|
||||
@ -120,7 +120,7 @@ namespace Jellyfin.Plugin.TMDbBoxSets
|
||||
|
||||
var tmdbCollectionId = movieCollection.Key;
|
||||
|
||||
var boxSet = boxSets.FirstOrDefault(b => b.GetProviderId(MetadataProviders.Tmdb) == tmdbCollectionId);
|
||||
var boxSet = boxSets.FirstOrDefault(b => b.GetProviderId(MetadataProvider.Tmdb) == tmdbCollectionId);
|
||||
AddMoviesToCollection(movieCollection.ToList(), tmdbCollectionId, boxSet);
|
||||
index++;
|
||||
}
|
||||
@ -137,7 +137,7 @@ namespace Jellyfin.Plugin.TMDbBoxSets
|
||||
}
|
||||
|
||||
// TODO: look it up?
|
||||
var tmdbCollectionId = movie.GetProviderId(MetadataProviders.TmdbCollection);
|
||||
var tmdbCollectionId = movie.GetProviderId(MetadataProvider.TmdbCollection);
|
||||
if (string.IsNullOrEmpty(tmdbCollectionId))
|
||||
{
|
||||
return;
|
||||
@ -163,9 +163,9 @@ namespace Jellyfin.Plugin.TMDbBoxSets
|
||||
foreach (var tmdbCollectionId in tmdbCollectionIds)
|
||||
{
|
||||
var movieMatches = movies
|
||||
.Where(m => m.GetProviderId(MetadataProviders.TmdbCollection) == tmdbCollectionId)
|
||||
.Where(m => m.GetProviderId(MetadataProvider.TmdbCollection) == tmdbCollectionId)
|
||||
.ToList();
|
||||
var boxSet = boxSets.FirstOrDefault(b => b.GetProviderId(MetadataProviders.Tmdb) == tmdbCollectionId);
|
||||
var boxSet = boxSets.FirstOrDefault(b => b.GetProviderId(MetadataProvider.Tmdb) == tmdbCollectionId);
|
||||
|
||||
AddMoviesToCollection(movieMatches, tmdbCollectionId, boxSet);
|
||||
}
|
||||
|
@ -1,8 +1,8 @@
|
||||
---
|
||||
name: "TMDb Box Sets"
|
||||
guid: "bc4aad2e-d3d0-4725-a5e2-fd07949e5b42"
|
||||
version: "5.0.0.0"
|
||||
targetAbi: "10.5.0.0"
|
||||
version: "6.0.0.0"
|
||||
targetAbi: "10.6.0.0"
|
||||
owner: "jellyfin"
|
||||
overview: "Automatically create movie box sets based on TMDb collections"
|
||||
description: "Automatically create movie box sets based on TMDb collections"
|
||||
|
Loading…
Reference in New Issue
Block a user