From 1473dace877285fef73d96386d1ea610e6135228 Mon Sep 17 00:00:00 2001 From: Mike Nolan Date: Sun, 16 Oct 2022 11:02:17 -0500 Subject: [PATCH] Maybe fix deadlock --- Tesses.YouTubeDownloader.Net6/Program.cs | 4 ++-- Tesses.YouTubeDownloader/TYTDBase.cs | 7 ++++--- Tesses.YouTubeDownloader/Tesses.YouTubeDownloader.csproj | 6 +++--- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/Tesses.YouTubeDownloader.Net6/Program.cs b/Tesses.YouTubeDownloader.Net6/Program.cs index c52f3c0..bfb7c53 100644 --- a/Tesses.YouTubeDownloader.Net6/Program.cs +++ b/Tesses.YouTubeDownloader.Net6/Program.cs @@ -15,7 +15,7 @@ namespace Tesses.YouTubeDownloader.Net6 TYTDCurrentDirectory currentDirectory=new TYTDCurrentDirectory(new HttpClient()); TYTDServer server=new TYTDServer(currentDirectory); server.RootServer.Server=new StaticServer("WebSite"); - currentDirectory.CanDownload=false; + currentDirectory.CanDownload=true; HttpServerListener listener=new HttpServerListener(new System.Net.IPEndPoint(System.Net.IPAddress.Any,3252),server.InnerServer); currentDirectory.StartLoop(); TYTDStorage.FFmpeg ="/usr/bin/ffmpeg"; @@ -24,4 +24,4 @@ namespace Tesses.YouTubeDownloader.Net6 } } -} \ No newline at end of file +} diff --git a/Tesses.YouTubeDownloader/TYTDBase.cs b/Tesses.YouTubeDownloader/TYTDBase.cs index 46b0045..f52a7c5 100644 --- a/Tesses.YouTubeDownloader/TYTDBase.cs +++ b/Tesses.YouTubeDownloader/TYTDBase.cs @@ -59,9 +59,9 @@ namespace Tesses.YouTubeDownloader } - public bool FileExists(string path) + public bool FileExists(string path) { - return FileExistsAsync(path).GetAwaiter().GetResult(); + return Task.Run(()=>FileExistsAsync(path)).GetAwaiter().GetResult(); } public virtual async IAsyncEnumerable GetVideoIdsAsync() @@ -213,6 +213,7 @@ namespace Tesses.YouTubeDownloader public virtual bool DownloadExists(string url) { string enc=$"FileInfo/{B64.Base64UrlEncodes(url)}.json"; + return FileExists(enc); } public virtual bool PlaylistInfoExists(PlaylistId id) @@ -245,7 +246,7 @@ namespace Tesses.YouTubeDownloader public virtual bool DirectoryExists(string path) { - return DirectoryExistsAsync(path).GetAwaiter().GetResult(); + return Task.Run(()=>DirectoryExistsAsync(path)).GetAwaiter().GetResult(); } public virtual IEnumerable EnumerateFiles(string path) diff --git a/Tesses.YouTubeDownloader/Tesses.YouTubeDownloader.csproj b/Tesses.YouTubeDownloader/Tesses.YouTubeDownloader.csproj index df9801d..08415b7 100644 --- a/Tesses.YouTubeDownloader/Tesses.YouTubeDownloader.csproj +++ b/Tesses.YouTubeDownloader/Tesses.YouTubeDownloader.csproj @@ -7,9 +7,9 @@ Tesses.YouTubeDownloader Mike Nolan Tesses - 1.1.9 - 1.1.9 - 1.1.9 + 1.2.0 + 1.2.0 + 1.2.0 A YouTube Downloader LGPL-3.0-only true