mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-01-15 23:58:57 +00:00
Merge branch 'master' into fix-resharper-warnings
# Conflicts: # Emby.Server.Implementations/Updates/InstallationManager.cs # tests/Jellyfin.Server.Integration.Tests/OpenApiSpecTests.cs
This commit is contained in:
@@ -176,17 +176,12 @@ namespace MediaBrowser.Providers.Plugins.AudioDb
|
||||
Directory.CreateDirectory(Path.GetDirectoryName(path));
|
||||
|
||||
using var response = await _httpClientFactory.CreateClient(NamedClient.Default).GetAsync(url, cancellationToken).ConfigureAwait(false);
|
||||
var stream = await response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false);
|
||||
await using (stream.ConfigureAwait(false))
|
||||
var fileStreamOptions = AsyncFile.WriteOptions;
|
||||
fileStreamOptions.Mode = FileMode.Create;
|
||||
var fs = new FileStream(path, fileStreamOptions);
|
||||
await using (fs.ConfigureAwait(false))
|
||||
{
|
||||
var fileStreamOptions = AsyncFile.WriteOptions;
|
||||
fileStreamOptions.Mode = FileMode.Create;
|
||||
fileStreamOptions.PreallocationSize = stream.Length;
|
||||
var xmlFileStream = new FileStream(path, fileStreamOptions);
|
||||
await using (xmlFileStream.ConfigureAwait(false))
|
||||
{
|
||||
await stream.CopyToAsync(xmlFileStream, cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
await response.Content.CopyToAsync(fs, cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -154,20 +154,15 @@ namespace MediaBrowser.Providers.Plugins.AudioDb
|
||||
|
||||
using var response = await _httpClientFactory.CreateClient(NamedClient.Default).GetAsync(url, cancellationToken).ConfigureAwait(false);
|
||||
response.EnsureSuccessStatusCode();
|
||||
var stream = await response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false);
|
||||
await using (stream.ConfigureAwait(false))
|
||||
{
|
||||
var path = GetArtistInfoPath(_config.ApplicationPaths, musicBrainzId);
|
||||
Directory.CreateDirectory(Path.GetDirectoryName(path));
|
||||
var path = GetArtistInfoPath(_config.ApplicationPaths, musicBrainzId);
|
||||
Directory.CreateDirectory(Path.GetDirectoryName(path));
|
||||
|
||||
var fileStreamOptions = AsyncFile.WriteOptions;
|
||||
fileStreamOptions.Mode = FileMode.Create;
|
||||
fileStreamOptions.PreallocationSize = stream.Length;
|
||||
var xmlFileStream = new FileStream(path, fileStreamOptions);
|
||||
await using (xmlFileStream.ConfigureAwait(false))
|
||||
{
|
||||
await stream.CopyToAsync(xmlFileStream, cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
var fileStreamOptions = AsyncFile.WriteOptions;
|
||||
fileStreamOptions.Mode = FileMode.Create;
|
||||
var xmlFileStream = new FileStream(path, fileStreamOptions);
|
||||
await using (xmlFileStream.ConfigureAwait(false))
|
||||
{
|
||||
await response.Content.CopyToAsync(xmlFileStream, cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@ using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Net.Http.Json;
|
||||
using System.Text;
|
||||
using System.Text.Json;
|
||||
using System.Threading;
|
||||
@@ -137,31 +138,27 @@ namespace MediaBrowser.Providers.Plugins.Omdb
|
||||
var url = OmdbProvider.GetOmdbUrl(urlQuery.ToString());
|
||||
|
||||
using var response = await _httpClientFactory.CreateClient(NamedClient.Default).GetAsync(url, cancellationToken).ConfigureAwait(false);
|
||||
var stream = await response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false);
|
||||
await using (stream.ConfigureAwait(false))
|
||||
if (isSearch)
|
||||
{
|
||||
if (isSearch)
|
||||
var searchResultList = await response.Content.ReadFromJsonAsync<SearchResultList>(_jsonOptions, cancellationToken).ConfigureAwait(false);
|
||||
if (searchResultList?.Search is not null)
|
||||
{
|
||||
var searchResultList = await JsonSerializer.DeserializeAsync<SearchResultList>(stream, _jsonOptions, cancellationToken).ConfigureAwait(false);
|
||||
if (searchResultList?.Search is not null)
|
||||
var resultCount = searchResultList.Search.Count;
|
||||
var result = new RemoteSearchResult[resultCount];
|
||||
for (var i = 0; i < resultCount; i++)
|
||||
{
|
||||
var resultCount = searchResultList.Search.Count;
|
||||
var result = new RemoteSearchResult[resultCount];
|
||||
for (var i = 0; i < resultCount; i++)
|
||||
{
|
||||
result[i] = ResultToMetadataResult(searchResultList.Search[i], searchInfo, indexNumberEnd);
|
||||
}
|
||||
result[i] = ResultToMetadataResult(searchResultList.Search[i], searchInfo, indexNumberEnd);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
else
|
||||
}
|
||||
else
|
||||
{
|
||||
var result = await response.Content.ReadFromJsonAsync<SearchResult>(_jsonOptions, cancellationToken).ConfigureAwait(false);
|
||||
if (string.Equals(result?.Response, "true", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
var result = await JsonSerializer.DeserializeAsync<SearchResult>(stream, _jsonOptions, cancellationToken).ConfigureAwait(false);
|
||||
if (string.Equals(result?.Response, "true", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return new[] { ResultToMetadataResult(result, searchInfo, indexNumberEnd) };
|
||||
}
|
||||
return new[] { ResultToMetadataResult(result, searchInfo, indexNumberEnd) };
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user