Esempio n. 1
0
    /// <inheritdoc />
    public Task Run(IProgress <double> progress, CancellationToken cancellationToken)
    {
        var posters   = GetItemsWithImageType(ImageType.Primary).Select(x => x.GetImages(ImageType.Primary).First().Path).ToList();
        var backdrops = GetItemsWithImageType(ImageType.Thumb).Select(x => x.GetImages(ImageType.Thumb).First().Path).ToList();

        if (backdrops.Count == 0)
        {
            // Thumb images fit better because they include the title in the image but are not provided with TMDb.
            // Using backdrops as a fallback to generate an image at all
            _logger.LogDebug("No thumb images found. Using backdrops to generate splashscreen");
            backdrops = GetItemsWithImageType(ImageType.Backdrop).Select(x => x.GetImages(ImageType.Backdrop).First().Path).ToList();
        }

        _imageEncoder.CreateSplashscreen(posters, backdrops);
        return(Task.CompletedTask);
    }