pull/3925/head
crobibero 4 years ago
parent 1325815182
commit 767c73e5c1

@ -1065,13 +1065,13 @@ namespace Jellyfin.Api.Controllers
/// <response code="200">Available countries returned.</response> /// <response code="200">Available countries returned.</response>
/// <returns>A <see cref="FileResult"/> containing the available countries.</returns> /// <returns>A <see cref="FileResult"/> containing the available countries.</returns>
[HttpGet("ListingProviders/SchedulesDirect/Countries")] [HttpGet("ListingProviders/SchedulesDirect/Countries")]
[Authorize(Policy = Policies.DefaultAuthorization)] // [Authorize(Policy = Policies.DefaultAuthorization)]
[ProducesResponseType(StatusCodes.Status200OK)] [ProducesResponseType(StatusCodes.Status200OK)]
public async Task<ActionResult> GetSchedulesDirectCountries() public async Task<ActionResult> GetSchedulesDirectCountries()
{ {
var client = _httpClientFactory.CreateClient(); var client = _httpClientFactory.CreateClient();
// https://json.schedulesdirect.org/20141201/available/countries // https://json.schedulesdirect.org/20141201/available/countries
using var response = await client.GetAsync("https://json.schedulesdirect.org/20141201/available/countries") var response = await client.GetAsync("https://json.schedulesdirect.org/20141201/available/countries")
.ConfigureAwait(false); .ConfigureAwait(false);
return File(await response.Content.ReadAsStreamAsync().ConfigureAwait(false), MediaTypeNames.Application.Json); return File(await response.Content.ReadAsStreamAsync().ConfigureAwait(false), MediaTypeNames.Application.Json);

@ -36,7 +36,7 @@ namespace Jellyfin.Api.Helpers
httpClient.DefaultRequestHeaders.Add(HeaderNames.UserAgent, useragent); httpClient.DefaultRequestHeaders.Add(HeaderNames.UserAgent, useragent);
} }
using var response = await httpClient.GetAsync(state.MediaPath).ConfigureAwait(false); var response = await httpClient.GetAsync(state.MediaPath).ConfigureAwait(false);
var contentType = response.Content.Headers.ContentType.ToString(); var contentType = response.Content.Headers.ContentType.ToString();
controller.Response.Headers[HeaderNames.AcceptRanges] = "none"; controller.Response.Headers[HeaderNames.AcceptRanges] = "none";

@ -466,10 +466,11 @@ namespace MediaBrowser.Providers.Manager
try try
{ {
using var response = await provider.GetImageResponse(url, cancellationToken).ConfigureAwait(false); using var response = await provider.GetImageResponse(url, cancellationToken).ConfigureAwait(false);
await using var stream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false);
await _providerManager.SaveImage( await _providerManager.SaveImage(
item, item,
await response.Content.ReadAsStreamAsync().ConfigureAwait(false), stream,
response.Content.Headers.ContentType.MediaType, response.Content.Headers.ContentType.MediaType,
type, type,
null, null,
@ -590,9 +591,10 @@ namespace MediaBrowser.Providers.Manager
} }
} }
await using var stream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false);
await _providerManager.SaveImage( await _providerManager.SaveImage(
item, item,
await response.Content.ReadAsStreamAsync().ConfigureAwait(false), stream,
response.Content.Headers.ContentType.MediaType, response.Content.Headers.ContentType.MediaType,
imageType, imageType,
null, null,

@ -180,9 +180,10 @@ namespace MediaBrowser.Providers.Manager
}; };
} }
await using var stream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false);
await SaveImage( await SaveImage(
item, item,
await response.Content.ReadAsStreamAsync().ConfigureAwait(false), stream,
contentType, contentType,
type, type,
imageIndex, imageIndex,

Loading…
Cancel
Save