Popcorn.Services.Movie.MovieService.TranslateMovieFullAsync C# (CSharp) Méthode

TranslateMovieFullAsync() public méthode

Translate movie informations (title, description, ...)
public TranslateMovieFullAsync ( MovieFull movieToTranslate, CancellationToken ct ) : Task
movieToTranslate Popcorn.Models.Movie.Full.MovieFull Movie to translate
ct System.Threading.CancellationToken Used to cancel translation
Résultat Task
        public async Task TranslateMovieFullAsync(MovieFull movieToTranslate, CancellationToken ct)
        {
            var watch = Stopwatch.StartNew();

            try
            {
                await Task.Run(async () =>
                {
                    var movie = await TmdbClient.GetMovieAsync(movieToTranslate.ImdbCode,
                        MovieMethods.Credits);
                    movieToTranslate.Title = movie?.Title;
                    movieToTranslate.Genres = movie?.Genres?.Select(a => a.Name).ToList();
                    movieToTranslate.DescriptionFull = movie?.Overview;
                }, ct);
            }
            catch (Exception exception) when (exception is TaskCanceledException)
            {
                Logger.Debug(
                    "TranslateMovieFull cancelled.");
            }
            catch (Exception exception)
            {
                Logger.Error(
                    $"TranslateMovieFull: {exception.Message}");
                throw;
            }
            finally
            {
                watch.Stop();
                var elapsedMs = watch.ElapsedMilliseconds;
                Logger.Debug(
                    $"TranslateMovieFull ({movieToTranslate.ImdbCode}) in {elapsedMs} milliseconds.");
            }
        }