|
|
|
@ -71,13 +71,15 @@ namespace Ombi.Schedule.Jobs.Emby
|
|
|
|
|
//await _repo.ExecuteSql("DELETE FROM EmbyEpisode");
|
|
|
|
|
//await _repo.ExecuteSql("DELETE FROM EmbyContent");
|
|
|
|
|
|
|
|
|
|
var movies = await _api.GetAllMovies(server.ApiKey,0, 200, server.AdministratorId, server.FullUri);
|
|
|
|
|
var movies = await _api.GetAllMovies(server.ApiKey, 0, 200, server.AdministratorId, server.FullUri);
|
|
|
|
|
var totalCount = movies.TotalRecordCount;
|
|
|
|
|
var processed = 0;
|
|
|
|
|
var processed = 1;
|
|
|
|
|
|
|
|
|
|
var mediaToAdd = new HashSet<EmbyContent>();
|
|
|
|
|
|
|
|
|
|
while (processed < totalCount)
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
foreach (var movie in movies.Items)
|
|
|
|
|
{
|
|
|
|
@ -87,19 +89,28 @@ namespace Ombi.Schedule.Jobs.Emby
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Get the next batch
|
|
|
|
|
movies = await _api.GetAllMovies(server.ApiKey, processed + 1, 200, server.AdministratorId, server.FullUri);
|
|
|
|
|
movies = await _api.GetAllMovies(server.ApiKey, processed, 200, server.AdministratorId, server.FullUri);
|
|
|
|
|
await _repo.AddRange(mediaToAdd);
|
|
|
|
|
mediaToAdd.Clear();
|
|
|
|
|
}
|
|
|
|
|
catch (Exception)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
throw;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// TV Time
|
|
|
|
|
var tv = await _api.GetAllShows(server.ApiKey, 0, 200, server.AdministratorId, server.FullUri);
|
|
|
|
|
var totalTv = tv.TotalRecordCount;
|
|
|
|
|
processed = 0;
|
|
|
|
|
processed = 1;
|
|
|
|
|
while (processed < totalTv)
|
|
|
|
|
{
|
|
|
|
|
foreach (var tvShow in tv.Items)
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
processed++;
|
|
|
|
|
if (string.IsNullOrEmpty(tvShow.ProviderIds?.Tvdb))
|
|
|
|
|
{
|
|
|
|
@ -127,9 +138,16 @@ namespace Ombi.Schedule.Jobs.Emby
|
|
|
|
|
{
|
|
|
|
|
_logger.LogDebug("We already have TV Show {0}", tvShow.Name);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
catch (Exception)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
throw;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// Get the next batch
|
|
|
|
|
tv = await _api.GetAllShows(server.ApiKey, processed + 1, 200, server.AdministratorId, server.FullUri);
|
|
|
|
|
tv = await _api.GetAllShows(server.ApiKey, processed, 200, server.AdministratorId, server.FullUri);
|
|
|
|
|
await _repo.AddRange(mediaToAdd);
|
|
|
|
|
mediaToAdd.Clear();
|
|
|
|
|
}
|
|
|
|
|