aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Providers
diff options
context:
space:
mode:
authordkanada <dkanada@users.noreply.github.com>2019-08-15 01:00:33 -0700
committerGitHub <noreply@github.com>2019-08-15 01:00:33 -0700
commit685e9e4f58c2e00a0157098a2309b2cb97cb2f14 (patch)
treef931aa410d09e57a7903b709d56c012e4da9b92e /MediaBrowser.Providers
parent535e0d25538a7f19d927d96e3fd4fba553ed83f4 (diff)
parent72436892154892c53c75ee5fdcbcb3bf843ac85c (diff)
Merge pull request #1584 from Bond-009/checksum
Check checksum for plugin downloads
Diffstat (limited to 'MediaBrowser.Providers')
-rw-r--r--MediaBrowser.Providers/Studios/StudiosImageProvider.cs28
1 files changed, 11 insertions, 17 deletions
diff --git a/MediaBrowser.Providers/Studios/StudiosImageProvider.cs b/MediaBrowser.Providers/Studios/StudiosImageProvider.cs
index 4b41589f1..ef412db5a 100644
--- a/MediaBrowser.Providers/Studios/StudiosImageProvider.cs
+++ b/MediaBrowser.Providers/Studios/StudiosImageProvider.cs
@@ -2,10 +2,10 @@ using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
+using System.Net.Http;
using System.Threading;
using System.Threading.Tasks;
using MediaBrowser.Common.Net;
-using MediaBrowser.Common.Progress;
using MediaBrowser.Controller.Configuration;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Providers;
@@ -143,26 +143,20 @@ namespace MediaBrowser.Providers.Studios
if (!fileInfo.Exists || (DateTime.UtcNow - fileSystem.GetLastWriteTimeUtc(fileInfo)).TotalDays > 1)
{
- var temp = await httpClient.GetTempFile(new HttpRequestOptions
- {
- CancellationToken = cancellationToken,
- Progress = new SimpleProgress<double>(),
- Url = url
-
- }).ConfigureAwait(false);
-
Directory.CreateDirectory(Path.GetDirectoryName(file));
- try
- {
- File.Copy(temp, file, true);
- }
- catch
+ using (var res = await httpClient.SendAsync(
+ new HttpRequestOptions
+ {
+ CancellationToken = cancellationToken,
+ Url = url
+ },
+ HttpMethod.Get).ConfigureAwait(false))
+ using (var content = res.Content)
+ using (var fileStream = new FileStream(file, FileMode.Create))
{
-
+ await content.CopyToAsync(fileStream).ConfigureAwait(false);
}
-
- return temp;
}
return file;