aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Providers/Plugins/AudioDb/AudioDbArtistProvider.cs
diff options
context:
space:
mode:
authorBond_009 <bond.009@outlook.com>2023-10-11 18:32:57 +0200
committerBond_009 <bond.009@outlook.com>2023-10-11 18:32:57 +0200
commitd7748cfa0476280cce9dba34b4512cc58760c8bb (patch)
tree368389260833164e812cbb192989023c017cd755 /MediaBrowser.Providers/Plugins/AudioDb/AudioDbArtistProvider.cs
parent26571a8c51b9670f198e58175463e1d3db5441ee (diff)
Multiple Stream changes
* Remove useless MemoryStream in DlnaHttpClient * Use HttpContent.ReadFromJsonAsync extension * Call ConfigureAwait for IAsyncDisposable * Use HttpContent.CopyToAsync where possible
Diffstat (limited to 'MediaBrowser.Providers/Plugins/AudioDb/AudioDbArtistProvider.cs')
-rw-r--r--MediaBrowser.Providers/Plugins/AudioDb/AudioDbArtistProvider.cs21
1 files changed, 8 insertions, 13 deletions
diff --git a/MediaBrowser.Providers/Plugins/AudioDb/AudioDbArtistProvider.cs b/MediaBrowser.Providers/Plugins/AudioDb/AudioDbArtistProvider.cs
index f3385b3a9..92742b1aa 100644
--- a/MediaBrowser.Providers/Plugins/AudioDb/AudioDbArtistProvider.cs
+++ b/MediaBrowser.Providers/Plugins/AudioDb/AudioDbArtistProvider.cs
@@ -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 fileStreamOptions = AsyncFile.WriteOptions;
+ fileStreamOptions.Mode = FileMode.Create;
+ var xmlFileStream = new FileStream(path, fileStreamOptions);
+ await using (xmlFileStream.ConfigureAwait(false))
{
- 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);
- }
+ await response.Content.CopyToAsync(xmlFileStream, cancellationToken).ConfigureAwait(false);
}
}