private async Task UpdateStatusMovieObjects(DinContext context, IMovieClient movieClient) { try { var content = await context.AddedContent.Where(c => c.Type.Equals(ContentType.Movie) && !c.Status.Equals(ContentStatus.Done)).ToListAsync(); var queue = (await movieClient.GetQueue()).ToList(); var now = DateTime.Now; _logger.LogInformation($"Updating: {content.Count} movies"); foreach (var c in content) { var movie = await movieClient.GetMovieByIdAsync(c.SystemId); var item = queue.Find(q => q.Movie.SystemId.Equals(c.SystemId)); if (movie.Downloaded) { c.Status = ContentStatus.Done; continue; } if (item != null) { c.Status = ContentStatus.Downloading; c.Percentage = Math.Round(1 - (item.SizeLeft / item.Size), 2); c.Eta = (int)item.TimeLeft.TotalSeconds; } if (now >= c.DateAdded.AddDays(2) && c.Percentage > 0.0) { c.Status = ContentStatus.Stuck; continue; } if (now >= c.DateAdded.AddDays(3)) { c.Status = ContentStatus.NotAvailable; } } } catch (Exception e) { _logger.LogError($"Updating movies encounterd error: {e.Message}"); } }
public MovieService(IMovieClient movieClient) { _movieClient = movieClient; }
public MovieController(IMovieClient movieClient) { _movieClient = movieClient; }
public MovieService(IMovieClient client, IMovieMapper mapper) { _client = client; _mapper = mapper; }
public MovieService(IMovieClient movieClient) { this.movieClient = movieClient; }
public MovieController(IFindService findService, IMovieClient movieClient, IMapper mapper) { _findService = findService; _movieClient = movieClient; _mapper = mapper; }
public SearchService(IMovieClient movieClient) { _movieClient = movieClient; }
public RandomService(IMovieClient movieClient, IFindService findService) { _movieClient = movieClient; _findService = findService; }
public MovieController(IMovieClient movieClient, IAuthorizationProvider authorizationProvider) { this.movieClient = movieClient; this.authorizationProvider = authorizationProvider; }
public SettingsService(IMovieClient movieClient) { _movieClient = movieClient; }
public FindService(IMovieClient movieClient) { _movieClient = movieClient; }
public MovieService(DinContext context, IMovieClient movieClient, ITMDBClientConfig config, IMapper mapper) : base(context, mapper) { _movieClient = movieClient; _tmdbKey = config.Key; }