public object Get(GetRemoteImages request)
        {
            var item = _libraryManager.GetItemById(request.Id);

            var result = GetRemoteImageResult(item, request);

            return(ToOptimizedSerializedResultUsingCache(result));
        }
Пример #2
0
        public object Get(GetRemoteImages request)
        {
            var item = _dtoService.GetItemByDtoId(request.Id);

            var result = GetRemoteImageResult(item, request);

            return(ToOptimizedSerializedResultUsingCache(result));
        }
Пример #3
0
        public async Task <object> Get(GetRemoteImages request)
        {
            var item = _libraryManager.GetItemById(request.Id);

            var images = await _providerManager.GetAvailableRemoteImages(item, new RemoteImageQuery
            {
                ProviderName             = request.ProviderName,
                IncludeAllLanguages      = request.IncludeAllLanguages,
                IncludeDisabledProviders = true,
                ImageType = request.Type
            }, CancellationToken.None).ConfigureAwait(false);

            var imagesList = images.ToArray();

            var allProviders = _providerManager.GetRemoteImageProviderInfo(item);

            if (request.Type.HasValue)
            {
                allProviders = allProviders.Where(i => i.SupportedImages.Contains(request.Type.Value));
            }

            var result = new RemoteImageResult
            {
                TotalRecordCount = imagesList.Length,
                Providers        = allProviders.Select(i => i.Name)
                                   .Distinct(StringComparer.OrdinalIgnoreCase)
                                   .ToArray()
            };

            if (request.StartIndex.HasValue)
            {
                imagesList = imagesList.Skip(request.StartIndex.Value)
                             .ToArray();
            }

            if (request.Limit.HasValue)
            {
                imagesList = imagesList.Take(request.Limit.Value)
                             .ToArray();
            }

            result.Images = imagesList;

            return(result);
        }
Пример #4
0
        public async Task <object> Get(GetRemoteImages request)
        {
            var item = _libraryManager.GetItemById(request.Id);

            return(await GetRemoteImageResult(item, request).ConfigureAwait(false));
        }