Skip to content

Commit

Permalink
Enabling mixed content libraries #1598
Browse files Browse the repository at this point in the history
  • Loading branch information
mregni committed Aug 5, 2021
1 parent 697bc9e commit 1453a70
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 10 deletions.
2 changes: 1 addition & 1 deletion EmbyStat.Clients.Base/Http/BaseHttpClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ public int GetMovieCount(string parentId)
{
ParentId = parentId,
Recursive = true,
IncludeItemTypes = new[] { nameof(Movie), nameof(BoxSet) },
IncludeItemTypes = new[] { nameof(Movie) },
StartIndex = 0,
Limit = 1,
EnableTotalRecordCount = true
Expand Down
2 changes: 1 addition & 1 deletion EmbyStat.Common/Models/Net/BaseItemDto.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public class BaseItemDto

public override string ToString()
{
return $"id: {Id} - Name:{Name} - Type:{CollectionType.ToLibraryType()}";
return $"id: {Id} - Name:{Name} - Type:{CollectionType.ToLibraryType()} - RawType:{CollectionType}";
}
}
}
15 changes: 7 additions & 8 deletions EmbyStat.Jobs/Jobs/Sync/MovieSyncJob.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,31 +70,30 @@ public override async Task RunJobAsync()
await LogInformation($"Found {libraries.Count} root items, getting ready for processing");
await LogProgress(15);

await ProcessMoviesAsync(libraries, cancellationToken);
await ProcessMoviesAsync(cancellationToken);
await LogProgress(55);

await CalculateStatistics();
await LogProgress(100);
}

private async Task ProcessMoviesAsync(IEnumerable<Library> libraries, CancellationToken cancellationToken)
private async Task ProcessMoviesAsync(CancellationToken cancellationToken)
{
await LogInformation("Lets start processing movies");
_movieRepository.RemoveMovies();

var neededLibraries = libraries.Where(x => Settings.MovieLibraries.Any(y => y == x.Id)).ToList();
var logIncrementBase = Math.Round(40 / (double)neededLibraries.Count, 1);
foreach (var library in neededLibraries)

var logIncrementBase = Math.Round(40 / (double)Settings.MovieLibraries.Count, 1);
foreach (var libraryId in Settings.MovieLibraries)
{
var collectionId = library.Id;
var collectionId = libraryId;
var totalCount = await GetTotalLibraryMovieCount(collectionId);
if (totalCount == 0)
{
continue; ;
}
var increment = logIncrementBase / (totalCount / (double)100);

await LogInformation($"Found {totalCount} movies in {library.Name} library");
await LogInformation($"Found {totalCount} movies in (NAME REMOVED FOR DEV VERSION) library");
var processed = 0;
var j = 0;
const int limit = 100;
Expand Down

0 comments on commit 1453a70

Please sign in to comment.